diff options
author | ThaCuber <70547062+ThaCuber@users.noreply.github.com> | 2022-12-25 18:34:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-25 18:34:12 -0400 |
commit | b02654093452d2fd0ef7c9a458a5d2d04c7b4a1b (patch) | |
tree | 7117d73b38f975ba9b3afa35cc0dbbe9faf3a0ea | |
parent | 363c3eb859ddbe1efad5949ad087c8e7db6cee41 (diff) | |
download | lite-xl-plugins-b02654093452d2fd0ef7c9a458a5d2d04c7b4a1b.tar.gz lite-xl-plugins-b02654093452d2fd0ef7c9a458a5d2d04c7b4a1b.zip |
Improved language_wren.lua (#171)
* optimize and improve language_wren.lua
* <number>. was highlighted when it shouldn't be
* added scientific notation
* added hexadecimal and scientific notation
* fixed identifier highlight
* added a bunch of things
setters and getters are now highlighted as functions (it just looks nice)
when extending a class, the derived class' name is the one highlighted, and not the parent class' name (kinda hacky at the moment)
highlighted anything in between two pipes (|) that isn't a pipe for when making standalone functions with parameters
-rw-r--r-- | plugins/language_wren.lua | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/language_wren.lua b/plugins/language_wren.lua index 2022dbf..593cd46 100644 --- a/plugins/language_wren.lua +++ b/plugins/language_wren.lua @@ -5,22 +5,31 @@ syntax.add { name = "Wren", files = { "%.wren$" }, comment = "//", + block_comment = {"/*", "*/"}, patterns = { { pattern = "//.-\n", type = "comment" }, { pattern = { "/%*", "%*/" }, type = "comment" }, { pattern = { '"', '"', '\\' }, type = "string" }, - { pattern = { "'", "'", '\\' }, type = "string" }, - { pattern = "-?%.?%d+", type = "number" }, + { pattern = "%d+%.%d+[Ee]%d+", type = "number" }, + { pattern = "%d+%.%d+", type = "number" }, + { pattern = "%d+[Ee]%d+", type = "number" }, + { pattern = "0x%x+", type = "number" }, + { pattern = "%d+", type = "number" }, { pattern = "%.%.%.?", type = "operator" }, { pattern = "[<>!=]=", type = "operator" }, + { pattern = "|[^|]+|%s+", type = "string" }, { pattern = "[%+%-=/%*%^%%<>!~|&?:]", type = "operator" }, - { pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" }, - { pattern = "[%a_][%w_]*", type = "symbol" }, + { pattern = "_[%w_]*", type = "keyword2" }, + { pattern = "%a[%w_]*()%s+()is()%s+%a[%w_]*%s*%f[{]", type = {"function", "normal", "keyword", "normal"}}, + { pattern = "%a[%w_]*%s*=()%s*%f[(]", type = {"function", "normal"} }, + { pattern = "%a[%w_]*()%s*%f[({]", type = {"function", "normal"} }, + { pattern = "%a[%w_]+", type = "symbol" }, }, symbols = { ["break"] = "keyword", ["class"] = "keyword", ["construct"] = "keyword", + ["continue"] = "keyword", ["else"] = "keyword", ["for"] = "keyword", ["foreign"] = "keyword", |