aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaspartcho <93390411+Gaspartcho@users.noreply.github.com>2024-07-19 20:33:03 +0000
committerGitHub <noreply@github.com>2024-07-19 22:33:03 +0200
commit87b0f9f59b55032d69fcb87daf83691dfec59c06 (patch)
treeda5a6ec2583058513c704a021e01513ea63d2b28
parent95e276d022b6d66c470575dcddcc4ccbbc5e09fb (diff)
downloadlite-xl-plugins-87b0f9f59b55032d69fcb87daf83691dfec59c06.tar.gz
lite-xl-plugins-87b0f9f59b55032d69fcb87daf83691dfec59c06.zip
update language_toml (#458)
-rw-r--r--manifest.json2
-rw-r--r--plugins/language_toml.lua43
2 files changed, 26 insertions, 19 deletions
diff --git a/manifest.json b/manifest.json
index fc2b444..540695b 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1600,7 +1600,7 @@
"tags": [
"language"
],
- "version": "0.1"
+ "version": "0.2"
},
{
"description": "Syntax for the [TypeScript](https://www.typescriptlang.org/) programming language, a typed dialect of JavaScript.",
diff --git a/plugins/language_toml.lua b/plugins/language_toml.lua
index 02e5b58..eb3a2d7 100644
--- a/plugins/language_toml.lua
+++ b/plugins/language_toml.lua
@@ -6,28 +6,35 @@ syntax.add {
name = "TOML",
files = { "%.toml$" },
comment = '#',
+
patterns = {
- { pattern = "#.-\n", type = "comment" },
- { pattern = { '"""', '"""', '\\' }, type = "string" },
- { pattern = { '"', '"', '\\' }, type = "string" },
- { pattern = { "'''", "'''" }, type = "string" },
- { pattern = { "'", "'" }, type = "string" },
- { pattern = "[A-Za-z0-9_%.%-]+%s*%f[=]", type = "function" },
- { pattern = "%[[A-Za-z0-9_%.%- ]+%]", type = "keyword" },
- { pattern = "%[%[[A-Za-z0-9_%.%- ]+%]%]", type = "keyword" },
- { pattern = "[%-+]?[0-9_]+%.[0-9_]+[eE][%-+]?[0-9_]+", type = "number" },
- { pattern = "[%-+]?[0-9_]+%.[0-9_]+", type = "number" },
- { pattern = "[%-+]?[0-9_]+[eE][%-+]?[0-9_]+", type = "number" },
- { pattern = "[%-+]?[0-9_]+", type = "number" },
- { pattern = "[%-+]?0x[0-9a-fA-F_]+", type = "number" },
- { pattern = "[%-+]?0o[0-7_]+", type = "number" },
- { pattern = "[%-+]?0b[01_]+", type = "number" },
- { pattern = "[%-+]?nan", type = "number" },
- { pattern = "[%-+]?inf", type = "number" },
- { pattern = "[a-z]+", type = "symbol" },
+ { pattern = "#.*", type = "comment" },
+
+ { pattern = { '"""', '"""', '\\' }, type = "string" },
+ { pattern = { "'''", "'''" }, type = "string" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'" }, type = "string" },
+
+ { pattern = "[%w_%.%-]+%s*%f[=]", type = "function" },
+
+ { pattern = {"^%s*%[", "%]"}, type = "keyword" },
+
+ { pattern = "0x[%x_]+", type = "number" },
+ { pattern = "0o[0-7_]+", type = "number" },
+ { pattern = "0b[01_]+", type = "number" },
+ { pattern = "%d[%d_]*%.?[%d_]*[eE][%-+]?[%d_]+", type = "number" },
+ { pattern = "%d[%d_]*%.?[$d_]*", type = "number" },
+ { pattern = "%f[-+%w_][-+]%f[%w%.]", type = "number" },
+
+ { pattern = "[%+%-:TZ]", type = "operator" },
+ { pattern = "%a+", type = "symbol" },
},
+
symbols = {
["true"] = "literal",
["false"] = "literal",
+
+ ["nan"] = "number",
+ ["inf"] = "number"
},
}