diff options
author | Liqube <git@liqube.com> | 2020-05-17 22:45:25 +0200 |
---|---|---|
committer | Liqube <git@liqube.com> | 2020-05-17 22:45:25 +0200 |
commit | 2a4f16cf824eabb7ee3119abc32cfc88fbf622a3 (patch) | |
tree | 42e45241bf418e4b9494024a6186f9dcda04e04f /plugins | |
parent | f2e5821e22b5f813fae1b6d3087b3d75c82f438b (diff) | |
download | lite-xl-plugins-2a4f16cf824eabb7ee3119abc32cfc88fbf622a3.tar.gz lite-xl-plugins-2a4f16cf824eabb7ee3119abc32cfc88fbf622a3.zip |
added language syntax for windows batch files
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/language_batch.lua | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/plugins/language_batch.lua b/plugins/language_batch.lua new file mode 100644 index 0000000..958f576 --- /dev/null +++ b/plugins/language_batch.lua @@ -0,0 +1,81 @@ +local syntax = require "core.syntax" + +-- liqube sat may 16, 2020 +syntax.add { + files = { "%.bat$", "%.cmd$" }, + comment = "rem", + patterns = { + { pattern = "@echo off\n", type = "keyword" }, + { pattern = "@echo on\n", type = "keyword" }, + { pattern = "rem.-\n", type = "comment" }, -- rem comment line, rem, rem. + { pattern = "REM.-\n", type = "comment" }, + { pattern = "%:%:.-\n", type = "comment" }, -- :: comment line + { pattern = "%%%w+%%", type = "symbol" }, -- %variable% + { pattern = "%%%%?~?[%w:]+", type = "symbol" }, -- %1, %~dpn1, %~1:2, %%i, %%~i + { pattern = "[!=()%>&%^/\\]", type = "operator" }, -- operators + { pattern = "-?%.?%d+f?", type = "number" }, -- integer numbers + { pattern = { '"', '"', '\\' }, type = "string" }, -- "strings" + { pattern = "[%a_][%w_]*", type = "normal" }, + { pattern = ":eof", type = "keyword" }, -- todo: end processing here (lite cannot do that yet) + { pattern = "%s*:%w+", type = "symbol" }, -- :labels + }, + -- todo: caseless matching (lite cannot do that yet) + symbols = { + ["if"] = "keyword", + ["else"] = "keyword", + ["elsif"] = "keyword", + ["not"] = "keyword", + ["for"] = "keyword", + ["do"] = "keyword", + ["exist"] = "keyword", + ["in"] = "keyword", + ["equ"] = "keyword", -- == + ["neq"] = "keyword", -- != + ["lss"] = "keyword", -- < + ["leq"] = "keyword", -- <= + ["gtr"] = "keyword", -- > + ["geq"] = "keyword", -- >= + ["nul"] = "keyword", + ["con"] = "keyword", + ["prn"] = "keyword", + ["prn"] = "keyword", + ["lpt1"] = "keyword", + ["com1"] = "keyword", + ["com2"] = "keyword", + ["com3"] = "keyword", + ["com4"] = "keyword", + ["errorlevel"] = "keyword", + ["defined"] = "keyword", + ["cmdextversion"]= "keyword", + ["goto"] = "keyword", + ["call"] = "keyword", + ["verify"] = "keyword", + ["setlocal"] = "function", + ["endlocal"] = "function", + ["enabledelayedexpansion"] = "function", + ["set"] = "function", + ["echo"] = "function", + ["rd"] = "function", + ["xcopy"] = "function", + ["del"] = "function", + ["ren"] = "function", + ["rmdir"] = "function", + ["move"] = "function", + ["copy"] = "function", + ["find"] = "function", + ["exit"] = "function", + ["pause"] = "function", + ["choice"] = "function", + ["command"] = "function", + ["cmd"] = "function", + ["shift"] = "function", + ["attrib"] = "function", + ["type"] = "function", + ["sort"] = "function", + ["cd"] = "function", + ["chdir"] = "function", + ["md"] = "function", + ["mkdir"] = "function", + ["forfiles"] = "function", + }, +} |