aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2021-08-16 19:20:31 -0230
committerGitHub <noreply@github.com>2021-08-16 19:20:31 -0230
commita42a0d57b08a9080ed9fd8fa84f1269e3847980f (patch)
tree53ac997ed123d8a80aa0f5d1bf0b25c88260a3c7
parent38c70503fd7019834c6c30278e235622c451f000 (diff)
parent3dd0d666ef9ae5a35661bfe1a5eef5d73981f75f (diff)
downloadlite-xl-plugins-a42a0d57b08a9080ed9fd8fa84f1269e3847980f.tar.gz
lite-xl-plugins-a42a0d57b08a9080ed9fd8fa84f1269e3847980f.zip
Merge pull request #48 from liquidev/language-toml
Added TOML syntax
-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",
+ },
+}