File: powershell.lang

package info (click to toggle)
highlight 4.10-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,556 kB
  • sloc: cpp: 27,579; makefile: 411; sh: 341; ansic: 264; php: 236; python: 217; ruby: 132; perl: 61; tcl: 1
file content (101 lines) | stat: -rw-r--r-- 4,276 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Description="Microsoft PowerShell"

Categories = {"source", "script", "shell"}

Identifiers=[[ [a-zA-Z_][\w\-]* ]]

Keywords={
  { Id=1,
    List={"add-content", "add-history", "add-member", "add-pssnapin",
        "clear-content", "clear-item", "clear-itemproperty", "clear-variable",
        "compare-object", "convertfrom-securestring",
        "convert-path", "convertto-html", "convertto-securestring", "copy-item",
        "copy-itemproperty", "export-alias", "export-clixml", "export-console",
        "export-csv", "foreach-object", "format-custom",
        "format-list", "format-table", "format-wide", "get-acl", "get-alias",
        "get-authenticodesignature", "get-childitem", "get-command", "get-content",
        "get-credential", "get-culture", "get-date",
        "get-eventlog", "get-executionpolicy", "get-help", "get-history",
        "get-host", "get-item", "get-itemproperty", "get-location", "get-member",
        "get-pfxcertificate", "get-process", "get-psdrive",
        "get-psprovider", "get-pssnapin", "get-service", "get-tracesource",
        "get-uiculture", "get-unique", "get-variable", "get-wmiobject", "group-object",
        "import-alias", "import-clixml", "import-csv",
        "invoke-expression", "invoke-history", "invoke-item", "join-path",
        "measure-command", "measure-object", "move-item", "move-itemproperty",
        "new-alias", "new-item", "new-itemproperty", "new-object", "write-host",
        "new-psdrive", "new-service", "new-timespan", "new-variable", "out-default",
        "out-file", "out-host", "out-null", "out-printer", "out-string", "pop-location",
        "push-location", "read-host",
        "remove-item", "remove-itemproperty", "remove-psdrive", "remove-pssnapin",
        "remove-variable", "rename-item", "rename-itemproperty", "resolve-path",
        "restart-service", "resume-service", "select-object",
        "select-string", "set-acl", "set-alias", "set-authenticodesignature",
        "set-content", "set-date", "set-executionpolicy", "set-item",
        "set-itemproperty", "set-location", "set-psdebug", "set-service",
        "set-tracesource", "set-variable", "sort-object", "split-path",
        "start-service", "start-sleep", "start-transcript", "stop-process",
        "stop-service", "stop-transcript", "suspend-service", "tee-object",
        "test-path", "trace-command", "update-formatdata", "update-typedata",
        "where-object", "write-debug",
        "write-error", "write-host", "write-output", "write-progress",
        "write-verbose", "write-warning", "switch", "function", "if", "throw", "else",
        "while", "break", "in", "return", "try", "catch", "for"},
  },
  { Id=2,
    List={"ac", "asnp", "clc", "cli", "clp", "clv", "cpi", "cpp", "cvpa",
        "diff", "epal", "epcsv", "fc", "fl", "foreach", "%", "ft", "fw", "gal", "gc",
        "gci", "gcm", "gdr", "ghy", "gi", "gl", "gm", "gp",
        "gps", "group", "gsv", "gsnp", "gu", "gv", "gwmi", "iex", "ihy", "ii",
        "ipal", "ipcsv", "mi", "mp", "nal", "ndr", "ni", "nv", "oh", "rdr", "ri", "rni",
        "rnp", "rp", "rsnp", "rv", "rvpa", "sal", "sasv",
        "sc", "select", "si", "sl", "sleep", "sort", "sp", "spps", "spsv", "sv",
        "tee", "where", "write", "cat", "cd", "clear", "cp", "h", "history",
        "kill", "lp", "ls", "mount", "mv", "popd", "ps", "pushd",
        "pwd", "r", "rm", "rmdir", "echo", "cls", "chdir", "copy", "del", "dir",
        "erase", "move", "rd", "ren", "set", "type"},
  },
  { Id=3,
    Regex=[[Win32_\w+]],
  },
  { Id=4,
    Regex=[[\$\w+]],
  },
}

Strings={
  Delimiter=[["|']],
  Escape=[[ `\d{3}|`x\d{2}|^[ntvbrfa`\?'"] ]],
    Interpolation=[[ \$\w+|\$\(.+?\) ]],
}

IgnoreCase=true

--Comments={
--  { Block=false,
--    Delimiter= { [[#]] },
--  },
--}

-- https://gitlab.com/saalen/highlight/-/issues/210
Comments={
  { Block=false,
    Delimiter= { [[(?<!\<)#(?!>)]] }
  },
  { Block=true,
    Delimiter= { [[<#]],[[#>]] },
  }
}

Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\~|\?|\||\.]]

EnableIndentation=false

-- fix recognition of $
function OnStateChange(oldState, newState, token)

  if  (string.sub(token,1,1) =="$") and oldState==HL_STRING and newState==HL_KEYWORD then
    return HL_INTERPOLATION
  end

end