aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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",
+ },
+}