aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_powershell.lua
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-09-27 14:57:03 +0100
committerGitHub <noreply@github.com>2020-09-27 14:57:03 +0100
commitf3863d7939e87543e5f0d7a7f3f72b10a6888dde (patch)
tree9de165356ed901c4e79b6a9f5db9a96786d1bc59 /plugins/language_powershell.lua
parent137d9dd282e46d3ecf22670537b853797bca7329 (diff)
parentad8cf63a6ee630a4d39fb63b67718a7bed4b060a (diff)
downloadlite-xl-plugins-f3863d7939e87543e5f0d7a7f3f72b10a6888dde.tar.gz
lite-xl-plugins-f3863d7939e87543e5f0d7a7f3f72b10a6888dde.zip
Merge pull request #89 from josephreynolds1/master
Add PowerShell language syntax plugin
Diffstat (limited to 'plugins/language_powershell.lua')
-rw-r--r--plugins/language_powershell.lua72
1 files changed, 72 insertions, 0 deletions
diff --git a/plugins/language_powershell.lua b/plugins/language_powershell.lua
new file mode 100644
index 0000000..01c00f4
--- /dev/null
+++ b/plugins/language_powershell.lua
@@ -0,0 +1,72 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = {"%.ps1$", "%.psm1$", "%.psd1$", "%.ps1xml$", "%.pssc$", "%.psrc$", "%.cdxml$"},
+ comment = "#",
+ patterns = {
+ {pattern = "#.*\n", type = "comment"},
+ {pattern = [[\.]], type = "normal"},
+ {pattern = {'"', '"'}, type = "string"},
+ {pattern = {"'", "'"}, type = "string"},
+ {pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number"},
+ {pattern = "[%+=/%*%^%%<>!~|&,:]+", type = "operator"},
+ {pattern = "%f[%S]%-[%w%-_]+", type = "function"},
+ {pattern = "[%u][%a]+[%-][%u][%a]+", type = "function"},
+ {pattern = "${.*}", type = "symbol"},
+ {pattern = "$[%a_@*][%w_]*", type = "keyword2"},
+ {pattern = "$[%$][%a]+", type = "keyword2"},
+ {pattern = "[%a_][%w_]*", type = "symbol"}
+ },
+ symbols = {
+ ["if"] = "keyword",
+ ["else"] = "keyword",
+ ["elseif"] = "keyword",
+ ["switch"] = "keyword",
+ ["default"] = "keyword",
+ ["function"] = "keyword",
+ ["filter"] = "keyword",
+ ["workflow"] = "keyword",
+ ["configuration"] = "keyword",
+ ["class"] = "keyword",
+ ["enum"] = "keyword",
+ ["Parameter"] = "keyword",
+ ["ValidateScript"] = "keyword",
+ ["CmdletBinding"] = "keyword",
+ ["try"] = "keyword",
+ ["catch"] = "keyword",
+ ["finally"] = "keyword",
+ ["throw"] = "keyword",
+ ["while"] = "keyword",
+ ["for"] = "keyword",
+ ["do"] = "keyword",
+ ["until"] = "keyword",
+ ["break"] = "keyword",
+ ["continue"] = "keyword",
+ ["foreach"] = "keyword",
+ ["in"] = "keyword",
+ ["return"] = "keyword",
+ ["where"] = "function",
+ ["select"] = "function",
+ ["filter"] = "keyword",
+ ["in"] = "keyword",
+ ["trap"] = "keyword",
+ ["param"] = "keyword",
+ ["data"] = "keyword",
+ ["dynamicparam"] = "keyword",
+ ["begin"] = "function",
+ ["process"] = "function",
+ ["end"] = "function",
+ ["exit"] = "function",
+ ["inlinescript"] = "function",
+ ["parallel"] = "function",
+ ["sequence"] = "function",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["TODO"] = "comment",
+ ["FIXME"] = "comment",
+ ["XXX"] = "comment",
+ ["TBD"] = "comment",
+ ["HACK"] = "comment",
+ ["NOTE"] = "comment"
+ }
+}