Improved Lua syntax (#201)

* improved Lua syntax

* added some missing cases with number literals
This commit is contained in:
liquidev 2021-05-20 19:02:40 +02:00 committed by GitHub
parent b15914d664
commit 78999cabe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 15 deletions

View File

@ -6,21 +6,28 @@ syntax.add {
headers = "^#!.*[ /]lua", headers = "^#!.*[ /]lua",
comment = "--", comment = "--",
patterns = { patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" }, { pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = { "%-%-%[%[", "%]%]"}, type = "comment" }, { pattern = { "%-%-%[%[", "%]%]"}, type = "comment" },
{ pattern = "%-%-.-\n", type = "comment" }, { pattern = "%-%-.-\n", type = "comment" },
{ pattern = "-?0x%x+", type = "number" }, { pattern = "0x%x+%.%x*[pP][-+]?%d+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" }, { pattern = "0x%x+%.%x*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" }, { pattern = "0x%.%x+[pP][-+]?%d+", type = "number" },
{ pattern = "<%a+>", type = "keyword2" }, { pattern = "0x%.%x+", type = "number" },
{ pattern = "%.%.%.?", type = "operator" }, { pattern = "0x%x+[pP][-+]?%d+", type = "number" },
{ pattern = "[<>~=]=", type = "operator" }, { pattern = "0x%x+", type = "number" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" }, { pattern = "%d%.%d*[eE][-+]?%d+", type = "number" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" }, { pattern = "%d%.%d*", type = "number" },
{ pattern = "[%a_][%w_]*", type = "symbol" }, { pattern = "%.?%d*[eE][-+]?%d+", type = "number" },
{ pattern = "::[%a_][%w_]*::", type = "function" }, { pattern = "%.?%d+", type = "number" },
{ pattern = "<%a+>", type = "keyword2" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>~=]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
{ pattern = "[%a_][%w_]*()%s*%f[(\"'{]", type = {"function", "normal"} },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "::[%a_][%w_]*::", type = "function" },
}, },
symbols = { symbols = {
["if"] = "keyword", ["if"] = "keyword",