aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_kdl.lua
diff options
context:
space:
mode:
authorTamnac <49466795+Tamnac@users.noreply.github.com>2024-09-08 18:33:53 -0700
committerGitHub <noreply@github.com>2024-09-08 21:33:53 -0400
commit2ed4d554750527d3fd09d6dbfe0e02ae086be543 (patch)
tree526795a06abaa0135d382f170351b481293f362b /plugins/language_kdl.lua
parentb5ad784fb2c167c52985bad66dcb63f8f6d61977 (diff)
downloadlite-xl-plugins-2ed4d554750527d3fd09d6dbfe0e02ae086be543.tar.gz
lite-xl-plugins-2ed4d554750527d3fd09d6dbfe0e02ae086be543.zip
Add language kdl (#477)
* Add language_kdl * [CI] Updated README.md and manifest.json. * Add language_kdl to manifest * [CI] Updated README.md and manifest.json. --------- Co-authored-by: Github Actions <>
Diffstat (limited to 'plugins/language_kdl.lua')
-rw-r--r--plugins/language_kdl.lua84
1 files changed, 84 insertions, 0 deletions
diff --git a/plugins/language_kdl.lua b/plugins/language_kdl.lua
new file mode 100644
index 0000000..a08a0bb
--- /dev/null
+++ b/plugins/language_kdl.lua
@@ -0,0 +1,84 @@
+-- mod-version:3
+local syntax = require "core.syntax"
+
+local identifier = "\"?[^%d%s\\/%(%){}<>;%[%]=,\"][^%s\\/%(%){}<>;%[%]=,\"]*\"?"
+
+syntax.add {
+ name = "KDL",
+ files = { "%.kdl" },
+ space_handling = false,
+ comment = "//",
+ block_comment = {"/*", "*/"},
+ patterns = {
+ {
+ pattern = "^%s*".. identifier .."%s*",
+ type = "keyword"
+ },--
+ { pattern = "%s+", type = "normal" },
+ {
+ pattern = "[{;]%s*()" .. identifier .. "%s*",
+ type = {"normal", "keyword"}
+ },--
+ { pattern = { "r#+\"", "\"#+" }, type = "string" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = "[%-+]?0x[%x_]+", type = "number" },
+ { pattern = "[%-+]?0b[01_]+", type = "number" },
+ { pattern = "[%-+]?0o[0-7_]+", type = "number" },
+ {
+ pattern = "[%-+]?[%d_]+%.[%d_]+e[%-+]?[%d_]+",
+ type = "number"
+ },
+ { pattern = "[%-+]?[%d_]+%.[%d_]+", type = "number" },
+ { pattern = "[%-+]?[%d_]+e[%-+]?[%d_]+", type = "number" },
+ { pattern = "[%-+]?[%d_]+", type = "number" },
+ { pattern = "/[%-/].-\n", type = "comment" },
+ { pattern = {"/%*", "%*/"}, type = "comment" },
+ { pattern = identifier, type = "keyword2" },
+ {
+ pattern = "%(()" .. identifier .. "()%)",
+ type = {"normal", "function", "normal"}
+ },
+ },
+ symbols = {
+ ["null"] = "literal",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["i8"] = "function",
+ ["i32"] = "function",
+ ["i16"] = "function",
+ ["i64"] = "function",
+ ["u8"] = "function",
+ ["u32"] = "function",
+ ["u16"] = "function",
+ ["u64"] = "function",
+ ["isize"] = "function",
+ ["usize"] = "function",
+ ["f32"] = "function",
+ ["f64"] = "function",
+ ["decimal64"] = "function",
+ ["decimal128"] = "function",
+ ["date-time"] = "function",
+ ["time"] = "function",
+ ["date"] = "function",
+ ["duration"] = "function",
+ ["decimal"] = "function",
+ ["currency"] = "function",
+ ["country-2"] = "function",
+ ["country-3"] = "function",
+ ["country-subdivision"] = "function",
+ ["email"] = "function",
+ ["idn-email"] = "function",
+ ["hostname"] = "function",
+ ["idn-hostname"] = "function",
+ ["ipv4"] = "function",
+ ["ipv6"] = "function",
+ ["url"] = "function",
+ ["url-reference"] = "function",
+ ["irl"] = "function",
+ ["irl-reference"] = "function",
+ ["url-template"] = "function",
+ ["uuid"] = "function",
+ ["regex"] = "function",
+ ["base64"] = "function",
+ },
+}