diff options
author | rxi <rxi@users.noreply.github.com> | 2020-07-21 15:25:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-21 15:25:54 +0100 |
commit | b6c5cfec661cc0a13b34f06c23f82fa5d2d57af3 (patch) | |
tree | e683fd3bc6074a7165fca78ec0b948a8eab26dcc | |
parent | c2113fd151236dd8ad613746513ad3d7a0ee1225 (diff) | |
parent | 84f6d3443f5b4d53cb551bfc20f31967e2c1bce9 (diff) | |
download | lite-xl-plugins-b6c5cfec661cc0a13b34f06c23f82fa5d2d57af3.tar.gz lite-xl-plugins-b6c5cfec661cc0a13b34f06c23f82fa5d2d57af3.zip |
Merge pull request #81 from kaitsh/elixir_syntax
Add syntax highlighting for Elixir
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/language_elixir.lua | 92 |
2 files changed, 93 insertions, 0 deletions
@@ -38,6 +38,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_elixir`](plugins/language_elixir.lua?raw=1) | Syntax for the [Elixir](https://elixir-lang.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 diff --git a/plugins/language_elixir.lua b/plugins/language_elixir.lua new file mode 100644 index 0000000..f87fad9 --- /dev/null +++ b/plugins/language_elixir.lua @@ -0,0 +1,92 @@ +local syntax = require "core.syntax" + +syntax.add { + files = { "%.ex$", "%.exs$"}, + comment = "#", + patterns = { + { pattern = "#.*\n", type = "comment" }, + { pattern = { ':"', '"', '\\' }, type = "number" }, + { pattern = { '"""', '"""', '\\' }, type = "string" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { '~%a[/"|\'%(%[%{<]', '[/"|\'%)%]%}>]', '\\' }, type = "string"}, + { pattern = "-?0x%x+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*f?", type = "number" }, + { pattern = "-?%.?%d+f?", type = "number" }, + { pattern = ':"?[%a_][%w_]*"?', type = "number" }, + { pattern = "[%a][%w_!?]*%f[(]", type = "function" }, + { pattern = "%u%w+", type = "normal" }, + { pattern = "@[%a_][%w_]*", type = "keyword2" }, + { pattern = "_%a[%w_]*", type = "keyword2" }, + { pattern = "[%+%-=/%*<>!|&]", type = "operator" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + ["def"] = "keyword", + ["defp"] = "keyword", + ["defguard"] = "keyword", + ["defguardp"] = "keyword", + ["defmodule"] = "keyword", + ["defprotocol"] = "keyword", + ["defimpl"] = "keyword", + ["defrecord"] = "keyword", + ["defrecordp"] = "keyword", + ["defmacro"] = "keyword", + ["defmacrop"] = "keyword", + ["defdelegate"] = "keyword", + ["defoverridable"] = "keyword", + ["defexception"] = "keyword", + ["defcallback"] = "keyword", + ["defstruct"] = "keyword", + ["for"] = "keyword", + ["case"] = "keyword", + ["when"] = "keyword", + ["with"] = "keyword", + ["cond"] = "keyword", + ["if"] = "keyword", + ["unless"] = "keyword", + ["try"] = "keyword", + ["receive"] = "keyword", + ["after"] = "keyword", + ["raise"] = "keyword", + ["rescue"] = "keyword", + ["catch"] = "keyword", + ["else"] = "keyword", + ["quote"] = "keyword", + ["unquote"] = "keyword", + ["super"] = "keyword", + ["unquote_splicing"] = "keyword", + ["do"] = "keyword", + ["end"] = "keyword", + ["fn"] = "keyword", + ["import"] = "keyword2", + ["alias"] = "keyword2", + ["use"] = "keyword2", + ["require"] = "keyword2", + ["and"] = "operator", + ["or"] = "operator", + ["true"] = "literal", + ["false"] = "literal", + ["nil"] = "literal", + }, +} + +syntax.add { + files = { "%.l?eex$" }, + patterns = { + { pattern = { "<!%-%-", "%-%->" }, type = "comment" }, + { pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" }, + { pattern = { '<%%=?', '%%>' }, type = "normal" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.]*f?", type = "number" }, + { pattern = "-?%.?%d+f?", type = "number" }, + { pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" }, + { pattern = "%f[^<][%a_][%w_]*", type = "function" }, + { pattern = "%f[^<]/[%a_][%w_]*", type = "function" }, + { pattern = "[%a_][%w_]*", type = "keyword" }, + { pattern = "[/<>=]", type = "operator" }, + }, + symbols = {}, +} |