aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--plugins/language_toml.lua32
2 files changed, 33 insertions, 0 deletions
diff --git a/README.md b/README.md
index 250fdfd..f24ad2e 100644
--- a/README.md
+++ b/README.md
@@ -86,6 +86,7 @@ Plugin | Description
[`language_teal`](plugins/language_teal.lua?raw=1) | Syntax for the [Teal](https://github.com/teal-language/tl) programming language, a typed dialect of Lua.
[`language_ts`](plugins/language_ts.lua?raw=1) | Syntax for the [TypeScript](https://www.typescriptlang.org/) programming language, a typed dialect of JavaScript.
[`language_tex`](plugins/language_tex.lua?raw=1) | Syntax for the [LaTeX](https://www.latex-project.org/) typesetting language
+[`language_toml`](plugins/language_toml.lua?raw=1) | Syntax for the [TOML](https://toml.io/en/) configuration language
[`language_tsx`](plugins/language_tsx.lua?raw=1) | Syntax for [TSX](https://www.typescriptlang.org/docs/handbook/jsx.html) language
[`language_v`](plugins/language_v.lua?raw=1) | Syntax for the [V](https://vlang.io/) programming language
[`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language
diff --git a/plugins/language_toml.lua b/plugins/language_toml.lua
new file mode 100644
index 0000000..9de31f9
--- /dev/null
+++ b/plugins/language_toml.lua
@@ -0,0 +1,32 @@
+-- lite-xl 1.16
+
+local syntax = require "core.syntax"
+
+syntax.add {
+ 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" },
+ },
+ symbols = {
+ ["true"] = "literal",
+ ["false"] = "literal",
+ },
+}