diff options
author | Takase <20792268+takase1121@users.noreply.github.com> | 2021-05-31 11:18:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 11:18:12 +0800 |
commit | 0d87d70140b8c318ca171330658d3a7cf00f5037 (patch) | |
tree | eb333ce5d63f7f393b61ac544124be5398496d3a /plugins/language_jsx.lua | |
parent | a07e30be3827f9444f967ba633171ea8c90cd41e (diff) | |
parent | 5b9a3bd28d937d131da5821f075952df80c14040 (diff) | |
download | lite-xl-plugins-0d87d70140b8c318ca171330658d3a7cf00f5037.tar.gz lite-xl-plugins-0d87d70140b8c318ca171330658d3a7cf00f5037.zip |
Merge branch 'master' into contextmenu
Diffstat (limited to 'plugins/language_jsx.lua')
-rw-r--r-- | plugins/language_jsx.lua | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/plugins/language_jsx.lua b/plugins/language_jsx.lua new file mode 100644 index 0000000..2648c68 --- /dev/null +++ b/plugins/language_jsx.lua @@ -0,0 +1,69 @@ +-- mod-version:1 -- 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", + }, +} |