diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | plugins/language_jsx.lua | 69 | ||||
-rw-r--r-- | plugins/language_ruby.lua | 74 |
3 files changed, 145 insertions, 0 deletions
@@ -56,6 +56,7 @@ Plugin | Description [`language_hs`](plugins/language_hs.lua?raw=1) | Syntax for the [Haskell](https://www.haskell.org/) programming language [`language_java`](plugins/language_java.lua?raw=1) | Syntax for the [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) programming language [`language_jiyu`](plugins/language_jiyu.lua?raw=1) | Syntax for the [jiyu](https://github.com/machinamentum/jiyu) programming language +[`language_jsx`](plugins/language_jsx.lua?raw=1) | Syntax for the [JSX](https://reactjs.org/docs/introducing-jsx.html) language for the React framework in JavaScript [`language_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1) | Syntax for [Kaitai](http://kaitai.io/) struct files [`language_make`](plugins/language_make.lua?raw=1) | Syntax for the Make build system language [`language_meson`](plugins/language_meson.lua?raw=1) | Syntax for the [Meson](https://mesonbuild.com) build system language @@ -68,6 +69,7 @@ Plugin | Description [`language_powershell`](plugins/language_powershell.lua?raw=1) | Syntax for [PowerShell](https://docs.microsoft.com/en-us/powershell) scripting language [`language_psql`](plugins/language_psql.lua?raw=1) | Syntax for the postgresql database access language [`language_rust`](plugins/language_rust.lua?raw=1) | Syntax for the [Rust](https://rust-lang.org/) programming language +[`language_ruby`](plugins/language_ruby.lua?raw=1) | Syntax for the [Ruby](https://www.ruby-lang.org/) programming language [`language sass`](plugins/language_sass.lua?raw=1) | Syntax for the [Sass](https://sass-lang.com/) CSS preprocessor [`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language [`language_teal`](plugins/language_teal.lua?raw=1) | Syntax for the [Teal](https://github.com/teal-language/tl) programming language, a typed dialect of Lua. diff --git a/plugins/language_jsx.lua b/plugins/language_jsx.lua new file mode 100644 index 0000000..c6d3ba5 --- /dev/null +++ b/plugins/language_jsx.lua @@ -0,0 +1,69 @@ +-- lite-xl 1.16 +-- Almost identical to JS, with the exception that / shouldn't denote a regex. Current JS syntax highlighter will highlight half the document due to closing tags. +local syntax = require "core.syntax" + +syntax.add { + files = { "%.jsx$" }, + comment = "//", + patterns = { + { pattern = "//.-\n", type = "comment" }, + { pattern = { "/%*", "%*/" }, type = "comment" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { "`", "`", '\\' }, type = "string" }, + { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?%.?%d+", type = "number" }, + { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + ["async"] = "keyword", + ["await"] = "keyword", + ["break"] = "keyword", + ["case"] = "keyword", + ["catch"] = "keyword", + ["class"] = "keyword", + ["const"] = "keyword", + ["continue"] = "keyword", + ["debugger"] = "keyword", + ["default"] = "keyword", + ["delete"] = "keyword", + ["do"] = "keyword", + ["else"] = "keyword", + ["export"] = "keyword", + ["extends"] = "keyword", + ["finally"] = "keyword", + ["for"] = "keyword", + ["function"] = "keyword", + ["get"] = "keyword", + ["if"] = "keyword", + ["import"] = "keyword", + ["in"] = "keyword", + ["instanceof"] = "keyword", + ["let"] = "keyword", + ["new"] = "keyword", + ["return"] = "keyword", + ["set"] = "keyword", + ["static"] = "keyword", + ["super"] = "keyword", + ["switch"] = "keyword", + ["throw"] = "keyword", + ["try"] = "keyword", + ["typeof"] = "keyword", + ["var"] = "keyword", + ["void"] = "keyword", + ["while"] = "keyword", + ["with"] = "keyword", + ["yield"] = "keyword", + ["true"] = "literal", + ["false"] = "literal", + ["null"] = "literal", + ["undefined"] = "literal", + ["arguments"] = "keyword2", + ["Infinity"] = "keyword2", + ["NaN"] = "keyword2", + ["this"] = "keyword2", + }, +} diff --git a/plugins/language_ruby.lua b/plugins/language_ruby.lua new file mode 100644 index 0000000..e010f91 --- /dev/null +++ b/plugins/language_ruby.lua @@ -0,0 +1,74 @@ +-- lite-xl 1.16 +local syntax = require "core.syntax" + +syntax.add { + files = { "%.rb", "%.gemspec" }, + headers = "^#!.*[ /]ruby", + 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 = { + ["nil"] = "literal", + ["end"] = "literal", + ["true"] = "literal", + ["false"] = "literal", + ["private"] = "keyword", + ["extend"] = "keyword", + ["include"] = "keyword", + ["require"] = "keyword", + ["require_dependency"] = "keyword", + ["__ENCODING__"] = "keyword", + ["__LINE__"] = "keyword", + ["__FILE__"] = "keyword", + ["BEGIN"] = "keyword", + ["END"] = "keyword", + ["alias"] = "keyword", + ["and"] = "keyword", + ["begin"] = "keyword", + ["break"] = "keyword", + ["case"] = "keyword", + ["class"] = "keyword", + ["def"] = "keyword", + ["defined?"] = "keyword", + ["do"] = "keyword", + ["else"] = "keyword", + ["elsif"] = "keyword", + ["end"] = "keyword", + ["ensure"] = "keyword", + ["for"] = "keyword", + ["if"] = "keyword", + ["in"] = "keyword", + ["module"] = "keyword", + ["next"] = "keyword", + ["not"] = "keyword", + ["or"] = "keyword", + ["redo"] = "keyword", + ["rescue"] = "keyword", + ["retry"] = "keyword", + ["return"] = "keyword", + ["self"] = "keyword", + ["super"] = "keyword", + ["then"] = "keyword", + ["true"] = "keyword", + ["undef"] = "keyword", + ["unless"] = "keyword", + ["until"] = "keyword", + ["when"] = "keyword", + ["while"] = "keyword", + ["yield"] = "keyword" + }, +} + |