diff options
author | rxi <rxi@users.noreply.github.com> | 2021-03-19 16:50:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-19 16:50:00 +0000 |
commit | 8a8b9701b95d1ccddb4cf719468d32c72f523f1f (patch) | |
tree | 8d083196e7e3d2370f43317bef11657587347954 | |
parent | edf05b25dd6384733aa94dfb7ecb9b176e70975d (diff) | |
parent | 522790e4eda30143edab6902863d17a61919e436 (diff) | |
download | lite-xl-plugins-8a8b9701b95d1ccddb4cf719468d32c72f523f1f.tar.gz lite-xl-plugins-8a8b9701b95d1ccddb4cf719468d32c72f523f1f.zip |
Merge pull request #132 from nikneym/master
MoonScript language support
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/language_moon.lua | 61 |
2 files changed, 62 insertions, 0 deletions
@@ -55,6 +55,7 @@ Plugin | Description [`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_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 [`language_nim`](plugins/language_nim.lua?raw=1) | Syntax for the [Nim](https://nim-lang.org) programming language [`language_objc`](plugins/language_objc.lua?raw=1) | Syntax for the [Objective C](https://en.wikipedia.org/wiki/Objective-C) programming language [`language_odin`](plugins/language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) programming language diff --git a/plugins/language_moon.lua b/plugins/language_moon.lua new file mode 100644 index 0000000..4817743 --- /dev/null +++ b/plugins/language_moon.lua @@ -0,0 +1,61 @@ +local syntax = require "core.syntax" + +syntax.add { + files = "%.moon$", + headers = "^#!.*[ /]moon", + comment = "--", + patterns = { + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { "%[%[", "%]%]" }, type = "string" }, + { pattern = "%-%-.-\n", type = "comment" }, + { pattern = "-?0x%x+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?%.?%d+", type = "number" }, + { pattern = "%.%.%.?", type = "keyword2" }, + { pattern = "[<>~=]=", type = "keyword2" }, + { pattern = "[%+%-=/%*%^%%#<>]", type = "keyword2" }, + { pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + { pattern = {"\\", "[%a_][%w_]*"}, type = "function" }, + { pattern = {"%.", "[%a_][%w_]*"}, type = "function" }, + { pattern = {"@", "[%a_][%w_]*"}, type = "keyword2" }, + { pattern = "!", type = "keyword2" }, + { pattern = "[%p]", type = "keyword" }, + }, + symbols = { + ["if"] = "keyword", + ["then"] = "keyword", + ["else"] = "keyword", + ["when"] = "keyword", + ["elseif"] = "keyword", + ["do"] = "keyword", + ["->"] = "keyword", + ["while"] = "keyword", + ["for"] = "keyword", + ["break"] = "keyword", + ["continue"] = "keyword", + ["export"] = "keyword", + ["unless"] = "keyword", + ["return"] = "keyword", + ["in"] = "keyword", + ["not"] = "keyword", + ["and"] = "keyword", + ["or"] = "keyword", + ["import"] = "keyword", + ["as"] = "keyword", + ["from"] = "keyword", + ["class"] = "keyword", + ["extends"] = "keyword", + ["switch"] = "keyword", + ["with"] = "keyword", + ["using"] = "keyword", + ["super"] = "keyword2", + ["self"] = "keyword2", + ["#"] = "keyword2", + ["true"] = "literal", + ["false"] = "literal", + ["nil"] = "literal", + }, +} + |