forked from SublimeText/PowerShell
/
PowershellSyntax.Json-tmLanguage
334 lines (263 loc) · 12.5 KB
/
PowershellSyntax.Json-tmLanguage
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
{
"name": "Powershell v2",
"scopeName": "source.powershell",
"fileTypes": ["ps1", "psm1"],
"foldingStartMarker": "\\{\\s*$",
"foldingStopMarker": "^\\s*\\}",
"patterns": [
{ "begin": "<#",
"beginCaptures": {
"0": { "name": "punctuation.start.definition.comment.block.powershell" }
},
"end": "#>",
"endCaptures": {
"0": { "name": "punctuation.end.definition.comment.block.powershell" }
},
"patterns": [
{ "include": "#commentEmbeddedDocs" }
],
"name": "comment.block.powershell"
},
{ "begin": "#",
"end": "$",
"patterns":[
{ "include": "#commentEmbeddedDocs" }
],
"name": "comment.line.powershell"
},
{ "include": "#variable" },
{ "include": "#scriptblock" },
{ "begin": "(?<!\")\"" ,
"end": "\"(?!\")",
"patterns": [
{ "include": "#variable" },
{ "include": "#doubleQuotedStringEscapes" },
{ "include": "#interpolation" },
{ "match": "`\\s*$",
"name": "keyword.other.powershell"
}
],
"name": "string.quoted.double.powershell"
},
{ "begin": "(?<!')'" ,
"end": "'(?!')",
"patterns": [
{ "match": "''",
"name": "constant.character.escape.powershell"
}
],
"name": "string.quoted.single.powershell"
},
{ "begin": "@\"$",
"end": "^\"@$",
"patterns": [
{ "include": "#interpolation" }
],
"name": "string.quoted.double.region.powershell"
},
{ "begin": "@\\(",
"end": "\\)",
"captures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" }
],
"name": "meta.group.array-expression.powershell"
},
{ "begin": "\\$\\(",
"end": "\\)",
"captures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" }
],
"name": "meta.group.complex.subexpression.powershell"
},
{ "begin": "^@'$",
"end": "^'@$",
"patterns": [
{ "include": "variable" }
],
"name": "string.quoted.double.region.powershell"
},
{ "include": "#numericConstant" },
{
"match": "-([lg][te]|eq|ne)",
"name": "keyword.operator.logical.powershell"
},
{ "include": "#PSDefaults" },
{ "match": "(?i:[a-z][a-z0-9]+-[a-z][a-z0-9]+)",
"name": "support.function.powershell"
},
{ "match": "\\||`",
"name": "keyword.other.powershell"
},
{ "match": "\\b(?i:if|else|elseif|switch|while|default|for|do|until|break|continue|foreach|return|filter|in|trap|throw|param|begin|process|end|function|global|local|private|script|contained)\\b",
"name": "keyword.control.powershell"
},
{ "match": "-(?i:(?:[ic]?eq|ne|[gl][te]|(?:not)?(?:like|match|contains)|replace)|is(?:not)?|as|and|or|band|bor|not|f)\\b",
"name": "keyword.operator.comparison.powershell"
},
{ "match": "-(?i:and|or|not|!)\\b",
"name": "keyword.operator.logical.powershell"
},
{ "match": "-(?i:f|band|bor|-bnot)\\b",
"name": "keyword.operator.bitwise.powershell"
},
{ "match": "-f\\b",
"name": "keyword.operator.string-format.powershell"
},
{ "match": "[+%*/-]?=|[+/*%-]",
"name": "keyword.operator.assignment.powershell"
},
{ "match": "2>&1|>>|>|<<|<|>|>\\||2>|2>>|1>>",
"name": "keyword.operator.redirection.powershell"
},
{ "match": "\\|{2}|&{2}|;",
"name": "keyword.other.statement-separator.powershell"
},
{ "match": "&|(?<!\\w)\\.(?= )|`|,",
"name": "keyword.operator.other.powershell"
}
],
"repository": {
"commentEmbeddedDocs": {
"patterns": [
{ "match": "(?i:\\s*(\\.)(SYNOPSIS|DESCRIPTION|EXAMPLE|INPUTS|OUTPUTS|NOTES|LINK|COMPONENT|FUNCTIONALITY))",
"name": "comment.documentation.embedded.powershell",
"captures": {
"1": { "name": "constant.string.documentation.powershell" },
"2": { "name": "keyword.operator.documentation.powershell"}
}
},
{
"match": "(?i:\\s*(\\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\\s+([a-z0-9-_]+))",
"name": "comment.documentation.embedded.powershell",
"captures": {
"1": { "name": "constant.string.documentation.powershell" },
"2": { "name": "keyword.operator.documentation.powershell"},
"3": { "name": "keyword.operator.documentation.powershell"}
}
}
]
},
"doubleQuotedStringEscapes": {
"patterns": [
{ "match": "`[0abnfrvt\"'$`]",
"name": "constant.character.escape.powershell"
},
{ "match": "\"\"",
"name": "constant.character.escape.powershell"
}
]
},
"interpolation": {
"begin": "(\\$)\\(",
"end": "\\)",
"contentName": "interpolated.complex.source.powershell",
"beginCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"endCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" },
{ "include": "#interpolation" },
{ "include": "#interpolatedStringContent" }
]
},
"interpolatedStringContent": {
"begin": "\\(",
"end": "\\)",
"contentName": "interpolated.simple.source.powershell",
"beginCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"endCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" },
{ "include": "#interpolation" },
{ "include": "#interpolatedStringContent" }
]
},
"variable": {
"patterns": [
{ "match": "(\\$)(args|null|true|false|_|\\?|^)",
"name": "support.variable.powershell",
"captures": {
"1": { "name": "keyword.other.powershell" },
"2": { "name": "constant.numeric.powershell"}
}
},
{ "match": "(?i:(\\$)(?:(private|script|global):)?([a-z0-9_]+))",
"captures": {
"1": { "name": "keyword.other.variable.powershell" },
"2": { "name": "storage.modifier.scope.powershell" },
"3": { "name": "variable.other.readwrite.powershell" }
}
},
{ "match": "(?i:(\\$)(\\{(?:(private|script|global):)?.+\\}))",
"captures": {
"1": { "name": "keyword.other.variable.powershell" },
"2": { "name": "variable.other.readwrite.powershell" },
"3": { "name": "storage.modifier.scope.powershell" }
}
}
]
},
"numericConstant": {
"patterns": [
{ "match": "(?i:\\d+(E)(\\+|\\-)\\d+(d)?(mb|kb|gb)?)",
"name": "constant.numeric.scientific.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "keyword.operator.math.powershell" },
"3": { "name": "support.constant.powershell" },
"4": { "name": "keyword.other.powershell" }
}
},
{ "match": "(?i:(0x)[a-f0-9]+(mb|kb|gb)?)",
"name": "constant.numeric.hexadecimal.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "keyword.other.powershell" }
}
},
{ "match": "\\d*(?<!\\.)(\\.)\\d+(d)?(mb|kb|gb)?",
"name": "constant.numeric.double.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "support.constant.powershell" },
"3": { "name": "keyword.other.powershell" }
}
},
{ "match": "(?<!\\w)\\d+(d)?(mb|kb|gb)?(?!\\w)",
"name": "constant.numeric.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "keyword.other.powershell" }
}
}
]
},
"scriptblock": {
"name": "meta.scriptblock.powershell",
"begin": "\\{",
"end": "\\}",
"patterns": [
{ "include": "$self" }
]
},
"PSDefaults": {
"match": "Disconnect-(WSMan)|Exit-(PSSession)|Copy-(Item|ItemProperty)|Resolve-(Path)|Group-(Object)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|Variable|WmiObject|WSManInstance)|Unregister-(Event|PSSessionConfiguration)|Tee-(Object)|Pop-(Location)|Set-(Acl|Alias|AuthenticodeSignature|Content|Date|ExecutionPolicy|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance|WSManInstance|WSManQuickConfig)|Format-(Custom|List|Table|Wide)|Invoke-(Command|Expression|History|Item|WmiMethod|WSManAction)|Export-(Alias|Clixml|Console|Counter|Csv|FormatData|ModuleMember|PSSession)|Update-(FormatData|List|TypeData)|Sort-(Object)|Measure-(Command|Object)|ForEach-(Object)|Connect-(WSMan)|Suspend-(Service)|ConvertFrom-(Csv|SecureString|StringData)|Where-(Object)|Rename-(Item|ItemProperty)|Convert-(Path)|Select-(Object|String|Xml)|Import-(Alias|Clixml|Counter|Csv|LocalizedData|Module|PSSession)|Stop-(Computer|Job|Process|Service|Transcript)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionOption|Service|TimeSpan|Variable|WebServiceProxy|WSManInstance|WSManSessionOption)|Resume-(Service)|Show-(EventLog)|Out-(Default|File|GridView|Host|Null|Printer|String)|Undo-(Transaction)|Trace-(Command)|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Push-(Location)|Split-(Path)|Disable-(ComputerRestore|PSBreakpoint|PSSessionConfiguration|WSManCredSSP)|Reset-(ComputerMachinePassword)|Restore-(Computer)|ConvertTo-(Csv|Html|SecureString|Xml)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration|WSManCredSSP)|Join-(Path)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Compare-(Object)|Get-(Acl|Alias|AuthenticodeSignature|ChildItem|Command|ComputerRestorePoint|Content|Counter|Credential|Culture|Date|Event|EventLog|EventSubscriber|ExecutionPolicy|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|PfxCertificate|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|UICulture|Unique|Variable|WinEvent|WmiObject|WSManCredSSP|WSManInstance)|Receive-(Job)|Move-(Item|ItemProperty)|Add-(Computer|Content|History|Member|PSSnapin|Type)|Wait-(Event|Job|Process)|Send-(MailMessage)|Read-(Host)|Complete-(Transaction)|Checkpoint-(Computer)|Debug-(Process)|Use-(Transaction)|Restart-(Computer|Service)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|WSMan)|Start-(Job|Process|Service|Sleep|Transaction|Transcript)|Limit-(EventLog)|Enter-(PSSession)",
"name": "support.function.builtin.powershell",
"comment": "Default commandlets in Powershell v2"
}
},
"uuid": "f8f5ffb0-503e-11df-9879-0800200c9a66"
}