diff options
author | Francesco Abbate <francesco.bbt@gmail.com> | 2021-08-06 19:16:32 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2021-08-06 19:16:52 +0200 |
commit | 661f13314d3ea05e4ccd9cfe3266def42eb41b05 (patch) | |
tree | 19daf2860592fef535c8e0ba3fd046e01fab92e4 | |
parent | fa1914282dd6d4b2c1638b0d5df9af0080f1825e (diff) | |
download | lite-xl-plugins-661f13314d3ea05e4ccd9cfe3266def42eb41b05.tar.gz lite-xl-plugins-661f13314d3ea05e4ccd9cfe3266def42eb41b05.zip |
Add syntax of Lobster language
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/language_lobster.lua | 66 |
2 files changed, 67 insertions, 0 deletions
@@ -65,6 +65,7 @@ Plugin | Description [`language_jsx`](plugins/language_jsx.lua?raw=1) | Syntax for the [JSX](https://reactjs.org/docs/introducing-jsx.html) language for the React framework in JavaScript [`language_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1) | Syntax for [Kaitai](http://kaitai.io/) struct files [`language_liquid`](plugins/language_liquid.lua?raw=1) | Syntax for [Liquid](https://shopify.github.io/liquid/) templating language +[`language_lobster`](plugins/language_lobster.lua?raw=1) | Syntax for [Lobster](https://strlen.com/lobster/) programming language [`language_make`](plugins/language_make.lua?raw=1) | Syntax for the Make build system language [`language_meson`](plugins/language_meson.lua?raw=1) | Syntax for the [Meson](https://mesonbuild.com) build system language [`language_moon`](plugins/language_moon.lua?raw=1) | Syntax for the [MoonScript](https://moonscript.org) scripting language diff --git a/plugins/language_lobster.lua b/plugins/language_lobster.lua new file mode 100644 index 0000000..8b4d899 --- /dev/null +++ b/plugins/language_lobster.lua @@ -0,0 +1,66 @@ +-- mod-version:1 -- lite-xl 1.16 +local syntax = require "core.syntax" + +syntax.add { + files = "%.lobster$", + comment = "//", + patterns = { + { pattern = "//.-\n", type = "comment" }, + { pattern = { "/%*", "%*/" }, type = "comment" }, + + { pattern = "struct%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { pattern = "class%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { pattern = "import%s+from", type = "keyword" }, + + { pattern = { '"', '"', '\\' }, type = "string" }, + { 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" }, + }, + symbols = { + ["import"] = "keyword", + ["def"] = "keyword", + ["fn"] = "keyword", + ["return"] = "keyword", + ["program"] = "keyword", + ["private"] = "keyword", + ["resource"] = "keyword", + + -- not really keywords but provides control-flow constructs + ["if"] = "keyword", + ["for"] = "keyword", + ["while"] = "keyword", + ["else"] = "keyword", + + ["enum"] = "keyword", + ["enum_flags"] = "keyword", + + ["int"] = "keyword2", + ["float"] = "keyword2", + ["string"] = "keyword2", + ["any"] = "keyword2", + ["void"] = "keyword2", + + ["is"] = "keyword", + ["typeof"] = "keyword", + ["var"] = "keyword", + ["let"] = "keyword", + ["pakfile"] = "keyword", + ["switch"] = "keyword", + ["case"] = "keyword", + ["default"] = "keyword", + ["namespace"] = "keyword", + + ["not"] = "operator", + ["and"] = "operator", + ["or"] = "operator", + + ["nil"] = "literal", + }, +} + |