aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-06-23 13:26:39 +0100
committerGitHub <noreply@github.com>2020-06-23 13:26:39 +0100
commite7d3925f739e87f4d18521a2902b678f05bbfe85 (patch)
tree8bd3efdb05df10a40c014e07e02a4fa7c5cbd20a
parent420bde4ae8b4e0633f54d809ce5ffc5b1b87f50e (diff)
parent5963d30bf14deb6d299055cd3a5db2b7e8e640c4 (diff)
downloadlite-xl-plugins-e7d3925f739e87f4d18521a2902b678f05bbfe85.tar.gz
lite-xl-plugins-e7d3925f739e87f4d18521a2902b678f05bbfe85.zip
Merge pull request #65 from imolein/elm-lang-support
Add Elm lang support
-rw-r--r--README.md1
-rw-r--r--plugins/language_elm.lua47
2 files changed, 48 insertions, 0 deletions
diff --git a/README.md b/README.md
index e86d9c9..1754b69 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,7 @@ Plugin | Description
[`language_cpp`](plugins/language_cpp.lua?raw=1) | Syntax for the [C++](https://isocpp.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_elm`](plugins/language_elm.lua?raw=1) | Syntax for the [Elm](https://elm-lang.org) programming language
[`language_fe`](plugins/language_fe.lua?raw=1) | Syntax for the [fe](https://github.com/rxi/fe) programming language
[`language_fennel`](plugins/language_fennel.lua?raw=1) | Syntax for the [fennel](https://fennel-lang.org) programming language
[`language_gdscript`](plugins/language_gdscript.lua?raw=1) | Syntax for the [Godot Engine](https://godotengine.org/)'s GDScript scripting language
diff --git a/plugins/language_elm.lua b/plugins/language_elm.lua
new file mode 100644
index 0000000..4f449a0
--- /dev/null
+++ b/plugins/language_elm.lua
@@ -0,0 +1,47 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.elm$" },
+ comment = "%-%-",
+ patterns = {
+ { pattern = {"%-%-", "\n"}, type = "comment" },
+ { pattern = { "{%-", "%-}" }, type = "comment" },
+ { 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 = "[=:|&<>%+%-%*\\/%^%%]", type = "operator" },
+ { pattern = "[%a_'][%w_']*", type = "symbol" },
+ },
+ symbols = {
+ ["as"] = "keyword",
+ ["case"] = "keyword",
+ ["of"] = "keyword",
+ ["if"] = "keyword",
+ ["then"] = "keyword",
+ ["else"] = "keyword",
+ ["import"] = "keyword",
+ ["module"] = "keyword",
+ ["exposing"] = "keyword",
+ ["let"] = "keyword",
+ ["in"] = "keyword",
+ ["type"] = "keyword",
+ ["alias"] = "keyword",
+ ["port"] = "keyword",
+ ["and"] = "keyword",
+ ["or"] = "keyword",
+ ["xor"] = "keyword",
+ ["not"] = "keyword",
+ ["number"] = "keyword2",
+ ["Bool"] = "keyword2",
+ ["Char"] = "keyword2",
+ ["Float"] = "keyword2",
+ ["Int"] = "keyword2",
+ ["String"] = "keyword2",
+ ["True"] = "literal",
+ ["False"] = "literal",
+ },
+}