diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/language_batch.lua | 81 |
2 files changed, 82 insertions, 0 deletions
@@ -27,6 +27,7 @@ Plugin | Description [`inanimate`](plugins/inanimate.lua?raw=1) | Disables all transition animations [`indentguide`](plugins/indentguide.lua?raw=1) | Adds indent guides *([screenshot](https://user-images.githubusercontent.com/3920290/79640716-f9860000-818a-11ea-9c3b-26d10dd0e0c0.png))* [`language_angelscript`](plugins/language_angelscript.lua?raw=1) | Syntax for the [Angelscript](https://www.angelcode.com/angelscript/) programming language +[`language_batch`](plugins/language_batch.lua?raw=1) | Syntax for Windows [Batch Files](https://en.wikipedia.org/wiki/Batch_file) [`language_cpp`](plugins/language_cpp.lua?raw=1) | Syntax for the [C++](https://isocpp.org/) programming language [`language_csharp`](plugins/language_csharp.lua?raw=1) | Syntax for the [C#](http://csharp.net) programming language [`language_fe`](plugins/language_fe.lua?raw=1) | Syntax for the [fe](https://github.com/rxi/fe) programming language 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", + }, +} |