aboutsummaryrefslogtreecommitdiff
path: root/plugins
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 /plugins
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>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/language_hare.lua91
1 files changed, 91 insertions, 0 deletions
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",
+ },
+}