aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2021-12-23 21:03:23 -0500
committerGitHub <noreply@github.com>2021-12-23 21:03:23 -0500
commitddd7ca5f67ea12e47f875ff684c938e3476021f3 (patch)
tree9f6ee2717010385da29f40e4fa271f83966fc4f2
parentdbf4e80ac89c4fdca4c220d6317479d6b3572398 (diff)
parentd023edf5ea9791726ed0c3f559c735dadb99b3ad (diff)
downloadlite-xl-plugins-ddd7ca5f67ea12e47f875ff684c938e3476021f3.tar.gz
lite-xl-plugins-ddd7ca5f67ea12e47f875ff684c938e3476021f3.zip
Merge pull request #6 from Tamnac/master
Add Crystal Language support
-rw-r--r--README.md1
-rw-r--r--plugins/language_crystal.lua95
2 files changed, 96 insertions, 0 deletions
diff --git a/README.md b/README.md
index c77b65b..6804da5 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,7 @@ Plugin | Description
[`language_bib`](plugins/language_bib.lua?raw=1) | Syntax for [BibTex](https://en.wikipedia.org/wiki/BibTeX) files
[`language_cmake`](plugins/language_cmake.lua?raw=1) | Syntax for the CMake build system language
[`language_cpp`](plugins/language_cpp.lua?raw=1) | Syntax for the [C++](https://isocpp.org/) programming language
+[`language_crystal`](https://github.com/Tamnac/lite-xl-plugins) | Syntax for the [Crystal](https://crystal-lang.org) programming language
[`language_csharp`](plugins/language_csharp.lua?raw=1) | Syntax for the [C#](http://csharp.net) programming language
[`language_d`](plugins/language_d.lua?raw=1) | Syntax for the [D](https://dlang.org/) programming language
[`language_dart`](plugins/language_dart.lua?raw=1) | Syntax for the [Dart](https://dart.dev/) programming languiage
diff --git a/plugins/language_crystal.lua b/plugins/language_crystal.lua
new file mode 100644
index 0000000..ef4ba03
--- /dev/null
+++ b/plugins/language_crystal.lua
@@ -0,0 +1,95 @@
+-- mod-version:2 -- lite-xl 2.0
+-- based on the ruby plugin, see https://github.com/Tamnac/lite-xl-plugins to contribute
+local syntax = require "core.syntax"
+
+syntax.add {
+ name = "Crystal",
+ files = { "%.cr" },
+ headers = "^#!.*[ /]crystal",
+ comment = "#",
+ patterns = {
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "-?0x%x+", type = "number" },
+ { pattern = "%#.-\n", type = "comment" },
+ { 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 = "keyword2" },
+ { pattern = "::[%w_]*", type = "symbol" },
+ { pattern = ":[%w_]*", type = "keyword2" },
+ { pattern = "[%a_][%w_]*:[^:]", type = "keyword2" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["__ENCODING__"] = "keyword",
+ ["__FILE__"] = "keyword",
+ ["__LINE__"] = "keyword",
+ ["alias"] = "keyword",
+ ["annotation"] = "keyword2",
+ ["Array"] = "keyword2",
+ ["BEGIN"] = "keyword",
+ ["begin"] = "keyword",
+ ["Bool"] = "keyword2",
+ ["break"] = "keyword",
+ ["case"] = "keyword",
+ ["Char"] = "keyword2",
+ ["class"] = "keyword",
+ ["def"] = "keyword",
+ ["defined?"] = "keyword",
+ ["do"] = "keyword",
+ ["else"] = "keyword",
+ ["elsif"] = "keyword",
+ ["END"] = "keyword",
+ ["end"] = "keyword",
+ ["ensure"] = "keyword",
+ ["enum"] = "keyword2",
+ ["extend"] = "keyword",
+ ["false"] = "literal",
+ ["Float32"] = "keyword2",
+ ["Float64"] = "keyword2",
+ ["fun"] = "keyword",
+ ["if"] = "keyword",
+ ["in"] = "keyword",
+ ["include"] = "keyword",
+ ["Int8"] = "keyword2",
+ ["Int16"] = "keyword2",
+ ["Int32"] = "keyword2",
+ ["Int64"] = "keyword2",
+ ["module"] = "keyword",
+ ["NamedTuple"] = "keyword2",
+ ["next"] = "keyword",
+ ["nil"] = "literal",
+ ["not"] = "keyword",
+ ["out"] = "function",
+ ["private"] = "keyword",
+ ["Proc"] = "keyword2",
+ ["redo"] = "keyword",
+ ["require"] = "keyword",
+ ["rescue"] = "keyword",
+ ["retry"] = "keyword",
+ ["return"] = "keyword",
+ ["self"] = "keyword",
+ ["String"] = "keyword2",
+ ["struct"] = "keyword2",
+ ["super"] = "keyword",
+ ["then"] = "keyword",
+ ["times"] = "function",
+ ["true"] = "literal",
+ ["Tuple"] = "keyword2",
+ ["UInt8"] = "keyword2",
+ ["UInt16"] = "keyword2",
+ ["UInt32"] = "keyword2",
+ ["UInt64"] = "keyword2",
+ ["undef"] = "keyword",
+ ["union"] = "keyword2",
+ ["unless"] = "keyword",
+ ["until"] = "keyword",
+ ["when"] = "keyword",
+ ["while"] = "keyword",
+ ["yield"] = "keyword"
+ },
+}
+
+