2019-12-28 11:16:32 +00:00
|
|
|
local syntax = require "core.syntax"
|
|
|
|
|
|
|
|
syntax.add {
|
|
|
|
files = { "%.js$", "%.json$", "%.cson$" },
|
|
|
|
comment = "//",
|
|
|
|
patterns = {
|
|
|
|
{ pattern = "//.-\n", type = "comment" },
|
|
|
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
|
|
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
|
|
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
2020-06-05 21:37:51 +00:00
|
|
|
{ pattern = { "`", "`", '\\' }, type = "string" },
|
2019-12-28 11:16:32 +00:00
|
|
|
{ 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 = {
|
2020-05-10 08:51:45 +00:00
|
|
|
["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",
|
2020-05-10 08:56:28 +00:00
|
|
|
["get"] = "keyword",
|
2020-05-10 08:51:45 +00:00
|
|
|
["if"] = "keyword",
|
|
|
|
["import"] = "keyword",
|
|
|
|
["in"] = "keyword",
|
|
|
|
["instanceof"] = "keyword",
|
|
|
|
["let"] = "keyword",
|
|
|
|
["new"] = "keyword",
|
|
|
|
["return"] = "keyword",
|
2020-05-10 08:56:28 +00:00
|
|
|
["set"] = "keyword",
|
2020-06-05 21:37:51 +00:00
|
|
|
["static"] = "keyword",
|
2020-05-10 08:51:45 +00:00
|
|
|
["super"] = "keyword",
|
|
|
|
["switch"] = "keyword",
|
|
|
|
["throw"] = "keyword",
|
|
|
|
["try"] = "keyword",
|
|
|
|
["typeof"] = "keyword",
|
|
|
|
["var"] = "keyword",
|
|
|
|
["void"] = "keyword",
|
|
|
|
["while"] = "keyword",
|
|
|
|
["with"] = "keyword",
|
|
|
|
["yield"] = "keyword",
|
2020-06-05 21:37:51 +00:00
|
|
|
["true"] = "literal",
|
|
|
|
["false"] = "literal",
|
|
|
|
["null"] = "literal",
|
|
|
|
["undefined"] = "literal",
|
|
|
|
["arguments"] = "keyword2",
|
|
|
|
["Infinity"] = "keyword2",
|
|
|
|
["NaN"] = "keyword2",
|
|
|
|
["this"] = "keyword2",
|
2019-12-28 11:16:32 +00:00
|
|
|
},
|
|
|
|
}
|