@@ -125,88 +125,6 @@ contexts:
125125 captures :
126126 1 : punctuation.definition.parameter.powershell
127127
128- operators :
129- # Word operators
130- - match : \B(-)(?i:as){{kebab_break}}
131- scope : keyword.operator.cast.powershell
132- captures :
133- 1 : punctuation.definition.keyword.powershell
134- - match : \B(-)(?i:[ic]?(?:eq|ne|[gl][te])){{kebab_break}}
135- scope : keyword.operator.comparison.powershell
136- captures :
137- 1 : punctuation.definition.keyword.powershell
138- - match : \B(-)(?i:[ic]?(?:not)?(?:like|match|contains|in)){{kebab_break}}
139- scope : keyword.operator.logical.powershell
140- captures :
141- 1 : punctuation.definition.keyword.powershell
142- - match : \B(-)(?i:join|split|replace){{kebab_break}}
143- scope : keyword.operator.string.powershell
144- captures :
145- 1 : punctuation.definition.keyword.powershell
146- - match : \B(-)(?i:is(?:not)?){{kebab_break}}
147- scope : keyword.operator.logical.powershell
148- captures :
149- 1 : punctuation.definition.keyword.powershell
150- - match : \B(-)(?i:and|or|not|xor){{kebab_break}}|! # <-- note `!`
151- scope : keyword.operator.logical.powershell
152- captures :
153- 1 : punctuation.definition.keyword.powershell
154- - match : \B(-)(?i:band|bor|bnot|bxor|sh[lr]){{kebab_break}}
155- scope : keyword.operator.bitwise.powershell
156- captures :
157- 1 : punctuation.definition.keyword.powershell
158- - match : \B(-)(?i:f){{kebab_break}}
159- scope : keyword.operator.string-format.powershell
160- captures :
161- 1 : punctuation.definition.keyword.powershell
162- # Symbol operators
163- - match : ' [+/*%-]?='
164- scope : keyword.operator.assignment.powershell
165- - match : (?:\+\+|--)(?![ \t]*\d|[[:alpha:]])
166- scope : keyword.operator.assignment.powershell
167- - match : ' [+-](?=\.?\d)' # This is sort of heuristic
168- scope : keyword.operator.unary.powershell
169- # Be careful about matching arithmetic with tightly following words
170- - match : ' [/+](?![[:alpha:]])'
171- scope : keyword.operator.arithmetic.powershell
172- - match : -(?![[:alpha:]-])
173- scope : keyword.operator.arithmetic.powershell
174- - match : \*
175- scope : keyword.operator.arithmetic.powershell
176- - match : ' %(?!\s*\{)'
177- scope : keyword.operator.arithmetic.powershell
178- - match : \|\||&&
179- scope : keyword.operator.logical.powershell
180- - match : \|
181- scope : keyword.operator.logical.pipe.powershell
182- - match : ;
183- scope : punctuation.terminator.statement.powershell
184- - match : \`(?=\n|$)
185- scope : punctuation.separator.continuation.line.powershell
186- - match : ' ,'
187- scope : punctuation.separator.sequence.powershell
188- - match : ' &|\B\.(?= )'
189- scope : keyword.operator.other.powershell
190- - match : \.\.(?=\-?\d|\(|\$)
191- # This is very imprecise. Is there a syntax for 'must come after...'?
192- scope : keyword.operator.range.powershell
193-
194- redirection :
195- # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection
196- - match : ([2-6*])(>&)(1)
197- captures :
198- 1 : constant.numeric.decimal.file-descriptor.powershell
199- 2 : keyword.operator.redirection.powershell
200- 3 : constant.numeric.decimal.file-descriptor.powershell
201- - match : ([1-6*])(>>?)
202- captures :
203- 1 : constant.numeric.decimal.file-descriptor.powershell
204- 2 : keyword.operator.redirection.powershell
205- - match : ' >>?'
206- scope : keyword.operator.redirection.powershell
207- # - match: <+
208- # scope: invalid.illegal.powershell
209-
210128 using-directives :
211129 - match : \b(?i:(using))\s+(?i:(namespace|module))\s+(?i:((?:\w+(?:\.)?)+))
212130 captures :
@@ -365,6 +283,90 @@ contexts:
365283 scope : storage.type.powershell
366284 - include : types
367285
286+ # ##[ OPERATORS ]###############################################################
287+
288+ operators :
289+ # Word operators
290+ - match : \B(-)(?i:as){{kebab_break}}
291+ scope : keyword.operator.cast.powershell
292+ captures :
293+ 1 : punctuation.definition.keyword.powershell
294+ - match : \B(-)(?i:[ic]?(?:eq|ne|[gl][te])){{kebab_break}}
295+ scope : keyword.operator.comparison.powershell
296+ captures :
297+ 1 : punctuation.definition.keyword.powershell
298+ - match : \B(-)(?i:[ic]?(?:not)?(?:like|match|contains|in)){{kebab_break}}
299+ scope : keyword.operator.logical.powershell
300+ captures :
301+ 1 : punctuation.definition.keyword.powershell
302+ - match : \B(-)(?i:join|split|replace){{kebab_break}}
303+ scope : keyword.operator.string.powershell
304+ captures :
305+ 1 : punctuation.definition.keyword.powershell
306+ - match : \B(-)(?i:is(?:not)?){{kebab_break}}
307+ scope : keyword.operator.logical.powershell
308+ captures :
309+ 1 : punctuation.definition.keyword.powershell
310+ - match : \B(-)(?i:and|or|not|xor){{kebab_break}}|! # <-- note `!`
311+ scope : keyword.operator.logical.powershell
312+ captures :
313+ 1 : punctuation.definition.keyword.powershell
314+ - match : \B(-)(?i:band|bor|bnot|bxor|sh[lr]){{kebab_break}}
315+ scope : keyword.operator.bitwise.powershell
316+ captures :
317+ 1 : punctuation.definition.keyword.powershell
318+ - match : \B(-)(?i:f){{kebab_break}}
319+ scope : keyword.operator.string-format.powershell
320+ captures :
321+ 1 : punctuation.definition.keyword.powershell
322+ # Symbol operators
323+ - match : ' [+/*%-]?='
324+ scope : keyword.operator.assignment.powershell
325+ - match : (?:\+\+|--)(?![ \t]*\d|[[:alpha:]])
326+ scope : keyword.operator.assignment.powershell
327+ - match : ' [+-](?=\.?\d)' # This is sort of heuristic
328+ scope : keyword.operator.unary.powershell
329+ # Be careful about matching arithmetic with tightly following words
330+ - match : ' [/+](?![[:alpha:]])'
331+ scope : keyword.operator.arithmetic.powershell
332+ - match : -(?![[:alpha:]-])
333+ scope : keyword.operator.arithmetic.powershell
334+ - match : \*
335+ scope : keyword.operator.arithmetic.powershell
336+ - match : ' %(?!\s*\{)'
337+ scope : keyword.operator.arithmetic.powershell
338+ - match : \|\||&&
339+ scope : keyword.operator.logical.powershell
340+ - match : \|
341+ scope : keyword.operator.logical.pipe.powershell
342+ - match : ;
343+ scope : punctuation.terminator.statement.powershell
344+ - match : \`(?=\n|$)
345+ scope : punctuation.separator.continuation.line.powershell
346+ - match : ' ,'
347+ scope : punctuation.separator.sequence.powershell
348+ - match : ' &|\B\.(?= )'
349+ scope : keyword.operator.other.powershell
350+ - match : \.\.(?=\-?\d|\(|\$)
351+ # This is very imprecise. Is there a syntax for 'must come after...'?
352+ scope : keyword.operator.range.powershell
353+
354+ redirection :
355+ # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection
356+ - match : ([2-6*])(>&)(1)
357+ captures :
358+ 1 : constant.numeric.decimal.file-descriptor.powershell
359+ 2 : keyword.operator.redirection.powershell
360+ 3 : constant.numeric.decimal.file-descriptor.powershell
361+ - match : ([1-6*])(>>?)
362+ captures :
363+ 1 : constant.numeric.decimal.file-descriptor.powershell
364+ 2 : keyword.operator.redirection.powershell
365+ - match : ' >>?'
366+ scope : keyword.operator.redirection.powershell
367+ # - match: <+
368+ # scope: invalid.illegal.powershell
369+
368370# ##[ CLASSES ]#################################################################
369371
370372 classes :
0 commit comments