aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuhkis <88197425+Tuhkis@users.noreply.github.com>2023-07-24 20:28:03 +0300
committerGitHub <noreply@github.com>2023-07-24 19:28:03 +0200
commitdcba3e8f602eb1537a788a59f32484255371445e (patch)
treedd2beaae27a0a821ec42f589a0fa916481a3ef81
parent7ad72c86573867acd24549c725ccab45343ffb20 (diff)
downloadlite-xl-plugins-dcba3e8f602eb1537a788a59f32484255371445e.tar.gz
lite-xl-plugins-dcba3e8f602eb1537a788a59f32484255371445e.zip
Hare language support (#269)
* Hare support * Add all keywords from language spec * Add to table * Missed flexible constant types * add fini init and test * manifest.json * Better comment pattern Co-authored-by: Guldoman <giulio.lettieri@gmail.com> --------- Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
-rw-r--r--README.md1
-rw-r--r--manifest.json7
-rw-r--r--plugins/language_hare.lua91
3 files changed, 99 insertions, 0 deletions
diff --git a/README.md b/README.md
index b31e9f5..0a0cec1 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,7 @@ but only with a `url` must provide a `checksum` that matches the existing plugin
| [`language_go`](plugins/language_go.lua?raw=1) | Syntax for the [Go](https://golang.org/) programming language |
| [`language_gravity`](plugins/language_gravity.lua?raw=1) | Syntax for the [Gravity](https://marcobambini.github.io/gravity/) programming language. |
| [`language_haxe`](plugins/language_haxe.lua?raw=1) | Syntax for the [Haxe](https://haxe.org) programming language |
+| [`language_hare`](plugins/language_hare.lua?raw=1) | Syntax for the [Hare](https://harelang.org/) programming language |
| [`language_hlsl`](plugins/language_hlsl.lua?raw=1) | Syntax for the [HLSL](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl) programming language |
| [`language_hs`](plugins/language_hs.lua?raw=1) | Syntax for the [Haskell](https://www.haskell.org/) programming language |
| [`language_htaccess`](/plugins/language_htaccess.lua?raw=1) | Syntax for [.htaccess](https://httpd.apache.org/docs/2.4/howto/htaccess.html) files. |
diff --git a/manifest.json b/manifest.json
index 5e5da03..560411a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -558,6 +558,13 @@
"mod_version": "3"
},
{
+ "description": "Syntax for the [Hare](https://haxelang.org) programming language",
+ "version": "0.1",
+ "path": "plugins/language_hare.lua",
+ "id": "language_hare",
+ "mod_version": "3"
+ },
+ {
"description": "Syntax for the [Haxe](https://haxe.org) programming language",
"version": "0.1",
"path": "plugins/language_haxe.lua",
diff --git a/plugins/language_hare.lua b/plugins/language_hare.lua
new file mode 100644
index 0000000..fba4f44
--- /dev/null
+++ b/plugins/language_hare.lua
@@ -0,0 +1,91 @@
+-- mod-version:3
+local syntax = require "core.syntax"
+
+syntax.add {
+ name = "Hare",
+ files = { "%.ha$" },
+ comment = "//",
+ patterns = {
+ { pattern = "//.*", type = "comment" },
+ -- { pattern = { "/%*", "%*/" }, type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "-?0x%x+", type = "number" },
+ { pattern = "-?%d+[%d%.eE]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ { pattern = "^@", type = "keyword" },
+ },
+ symbols = {
+ ["export"] = "keyword",
+ ["fn"] = "keyword",
+ ["use"] = "keyword",
+ ["const"] = "keyword",
+ ["let"] = "keyword",
+ ["defer"] = "keyword",
+ ["static"] = "keyword",
+ ["yield"] = "keyword",
+ ["case"] = "keyword",
+ ["match"] = "keyword",
+ ["return"] = "keyword",
+ ["switch"] = "keyword",
+ ["for"] = "keyword",
+ ["if"] = "keyword",
+ ["type"] = "keyword",
+ ["abort"] = "keyword",
+ ["align"] = "keyword",
+ ["alloc"] = "keyword",
+ ["break"] = "keyword",
+ ["continue"] = "keyword",
+ ["def"] = "keyword",
+ ["delete"] = "keyword",
+ ["else"] = "keyword",
+ ["free"] = "keyword",
+ ["insert"] = "keyword",
+ ["is"] = "keyword",
+ ["len"] = "keyword",
+ ["offset"] = "keyword",
+ ["vaarg"] = "keyword",
+ ["vaend"] = "keyword",
+ ["vastart"] = "keyword",
+ ["fini"] = "keyword",
+ ["init"] = "keyword",
+ ["test"] = "keyword",
+
+ ["nullable"] = "keyword2",
+ ["str"] = "keyword2",
+ ["void"] = "keyword2",
+ ["int"] = "keyword2",
+ ["uint"] = "keyword2",
+ ["struct"] = "keyword2",
+ ["union"] = "keyword2",
+ ["enum"] = "keyword2",
+ ["u8"] = "keyword2",
+ ["u16"] = "keyword2",
+ ["u32"] = "keyword2",
+ ["u64"] = "keyword2",
+ ["i8"] = "keyword2",
+ ["i16"] = "keyword2",
+ ["i32"] = "keyword2",
+ ["i64"] = "keyword2",
+ ["f32"] = "keyword2",
+ ["f64"] = "keyword2",
+ ["size"] = "keyword2",
+ ["rune"] = "keyword2",
+ ["bool"] = "keyword2",
+ ["valist"] = "keyword2",
+ ["uintptr"] = "keyword2",
+ ["rconst"] = "keyword2",
+ ["fconst"] = "keyword2",
+ ["iconst"] = "keyword2",
+
+ ["fmt"] = "literal",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["signed"] = "literal",
+ ["unsigned"] = "literal",
+ ["null"] = "literal",
+ },
+}