diff options
author | Francesco <francesco.bbt@gmail.com> | 2021-06-07 22:22:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 22:22:39 +0200 |
commit | 762b96a1e68be83f0dbcf1d7a0f4ef2c82b15e87 (patch) | |
tree | f5750cf7c54f0a5b495fc94cfeae3456f57599bc | |
parent | e9c69e44bfa260eb492ca519768fddb1b0c5417b (diff) | |
parent | 636623cf5cf46a8ba6740d13769e48fa191df279 (diff) | |
download | lite-xl-plugins-762b96a1e68be83f0dbcf1d7a0f4ef2c82b15e87.tar.gz lite-xl-plugins-762b96a1e68be83f0dbcf1d7a0f4ef2c82b15e87.zip |
Merge pull request #27 from movwf/master
Added TSX syntax highlighting.
-rw-r--r-- | plugins/language_tsx.lua | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/plugins/language_tsx.lua b/plugins/language_tsx.lua new file mode 100644 index 0000000..9dd93ad --- /dev/null +++ b/plugins/language_tsx.lua @@ -0,0 +1,72 @@ +-- 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 = { "%.tsx$" }, + 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 = "interface%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { pattern = "type%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { 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", + ["implements"] = "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", + }, +} |