From 8765e136bc923a2de0ff08ca4f5595ac6741465e Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 7 Jul 2021 18:43:00 -0400 Subject: Added language yaml --- plugins/language_yaml.lua | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 plugins/language_yaml.lua (limited to 'plugins') diff --git a/plugins/language_yaml.lua b/plugins/language_yaml.lua new file mode 100644 index 0000000..40e19b6 --- /dev/null +++ b/plugins/language_yaml.lua @@ -0,0 +1,57 @@ +-- mod-version:1 -- lite-xl 1.16 +local syntax = require "core.syntax" + +syntax.add { + files = { "%.yml$", "%.yaml$" }, + comment = "#", + patterns = { + { pattern = { "#", "\n"}, type = "comment" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = "%-?%.inf", type = "number" }, + { pattern = "%.NaN", type = "number" }, + { + pattern = "%&()%g+", + type = { "keyword", "literal" } + }, + { pattern = "!%g+", type = "keyword" }, + { pattern = "<<", type = "literal" }, + { + pattern = "[%s]%*()[%w%d_]+", + type = { "keyword", "keyword2" } + }, + { + pattern = "%*()[%w%d_]+", + type = { "keyword", "literal" } + }, + { + pattern = "[%[%{]()%s*[%w%d]+%g+%s*():%s", + type = { "operator", "keyword2", "operator" } + }, + { + pattern = "[%s][%w%d]+%g+%s*():%s", + type = { "keyword2", "operator" } + }, + { + pattern = "[%w%d]+%g+%s*():%s", + type = { "literal", "operator" } + }, + { pattern = "0%d+", type = "number" }, + { pattern = "0x%x+", type = "number" }, + { pattern = "[%+%-]?%d+[,%.eE:%+%d]*%d+", type = "number" }, + { pattern = "[%*%|%!>%%]", type = "keyword" }, + { pattern = "[%-:%?%*%{%}%[%]]", type = "operator" }, + -- Everything else for keywords to work + { + pattern = "[%d%a_][%g_]*()[%]%},]", + type = { "string", "operator" } + }, + { pattern = "[%d%a_][%g_]*", type = "string" }, + }, + symbols = { + ["true"] = "number", + ["false"] = "number", + ["y"] = "number", + ["n"] = "number" + } +} -- cgit v1.2.3