86 lines
2.9 KiB
Lua
86 lines
2.9 KiB
Lua
|
local syntax = require "core.syntax"
|
||
|
|
||
|
syntax.add {
|
||
|
files = { "%.ts$", "%.d.ts$", "%.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 = "[%a_][%w_]*%f[(]", type = "function" },
|
||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||
|
},
|
||
|
symbols = {
|
||
|
["any"] = "keyword2",
|
||
|
["arguments"] = "keyword2",
|
||
|
["as"] = "keyword2",
|
||
|
["async"] = "keyword",
|
||
|
["await"] = "keyword",
|
||
|
["boolean"] = "keyword2",
|
||
|
["break"] = "keyword",
|
||
|
["case"] = "keyword",
|
||
|
["catch"] = "keyword",
|
||
|
["class"] = "keyword",
|
||
|
["const"] = "keyword",
|
||
|
["constructor"]= "keyword2",
|
||
|
["continue"] = "keyword",
|
||
|
["debugger"] = "keyword",
|
||
|
["declare"] = "keyword2",
|
||
|
["default"] = "keyword",
|
||
|
["delete"] = "keyword",
|
||
|
["do"] = "keyword",
|
||
|
["else"] = "keyword",
|
||
|
["enum"] = "keyword2",
|
||
|
["export"] = "keyword",
|
||
|
["extends"] = "keyword",
|
||
|
["false"] = "literal",
|
||
|
["finally"] = "keyword",
|
||
|
["for"] = "keyword",
|
||
|
["from"] = "keyword",
|
||
|
["function"] = "keyword",
|
||
|
["get"] = "keyword",
|
||
|
["if"] = "keyword",
|
||
|
["implements"] = "keyword2",
|
||
|
["import"] = "keyword",
|
||
|
["in"] = "keyword",
|
||
|
["Infinity"] = "keyword2",
|
||
|
["instanceof"] = "keyword",
|
||
|
["interface"] = "keyword2",
|
||
|
["let"] = "keyword",
|
||
|
["module"] = "keyword2",
|
||
|
["new"] = "keyword",
|
||
|
["null"] = "literal",
|
||
|
["number"] = "keyword2",
|
||
|
["of"] = "keyword2",
|
||
|
["package"] = "keyword2",
|
||
|
["private"] = "keyword2",
|
||
|
["protected"] = "keyword2",
|
||
|
["public"] = "keyword2",
|
||
|
["require"] = "keyword2",
|
||
|
["return"] = "keyword",
|
||
|
["set"] = "keyword",
|
||
|
["static"] = "keyword",
|
||
|
["string"] = "keyword2",
|
||
|
["super"] = "keyword",
|
||
|
["switch"] = "keyword",
|
||
|
["symbol"] = "keyword2",
|
||
|
["this"] = "keyword2",
|
||
|
["throw"] = "keyword",
|
||
|
["true"] = "literal",
|
||
|
["try"] = "keyword",
|
||
|
["type"] = "keyword2",
|
||
|
["typeof"] = "keyword",
|
||
|
["undefined"] = "literal",
|
||
|
["var"] = "keyword",
|
||
|
["void"] = "keyword",
|
||
|
["while"] = "keyword",
|
||
|
["with"] = "keyword",
|
||
|
["yield"] = "keyword",
|
||
|
},
|
||
|
}
|