@@ -54,7 +54,7 @@ contexts:
54
54
scope : punctuation.section.group.end.powershell
55
55
pop : true
56
56
- include : main
57
- - match : \b(?:[A-Za-z0-9\-_\.]+) \.(?i:exe|com|cmd|bat)\b
57
+ - match : \b[\w.-]+ \.(?i:exe|com|cmd|bat)\b
58
58
scope : variable.function.powershell
59
59
- match : \b(?:(?i:begin|break|catch|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|var|where(?!-object)|while)|%|\?)(?!\w)
60
60
scope : keyword.control.powershell
@@ -67,46 +67,49 @@ contexts:
67
67
- match : \b(?i:hidden|static)\b
68
68
# This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.
69
69
scope : storage.modifier.powershell
70
- - match : \b((?i:class)|%|\?)(?:\s)+((?:\p{L}|\d|_|-|) +)\b
70
+ - match : \b((?i:class)|%|\?)(?:\s)+([\w-] +)\b
71
71
captures :
72
72
1 : storage.type.class.powershell
73
73
2 : meta.class.powershell entity.name.class.powershell
74
+ # Operators...
74
75
- match : \B(-)(?i:as)\b
75
76
scope : keyword.operator.cast.powershell
76
77
captures :
77
78
1 : punctuation.definition.keyword.powershell
78
- - match : \B(-)(?i:[ic]?(?:eq|ne|[gl][te]))(?!\p{L})
79
+ - match : \B(-)(?i:[ic]?(?:eq|ne|[gl][te]))\b
79
80
scope : keyword.operator.comparison.powershell
80
81
captures :
81
82
1 : punctuation.definition.keyword.powershell
82
- - match : \B(-)(?i:[ic]?(?:not)?(?:like|match|contains|in))(?!\p{L})
83
+ - match : \B(-)(?i:[ic]?(?:not)?(?:like|match|contains|in))\b
83
84
scope : keyword.operator.logical.powershell
84
85
captures :
85
86
1 : punctuation.definition.keyword.powershell
86
- - match : \B(-)(?i:join|split|replace)(?!\p{L})|!
87
+ - match : \B(-)(?i:join|split|replace)\b
87
88
scope : keyword.operator.string.powershell
88
89
captures :
89
90
1 : punctuation.definition.keyword.powershell
90
91
- match : \B(-)(?i:is(?:not)?)\b
91
92
scope : keyword.operator.logical.powershell
92
93
captures :
93
94
1 : punctuation.definition.keyword.powershell
94
- - match : \B(-)(?i:and|or|not|xor)(?!\p{L}) |!
95
+ - match : \B(-)(?i:and|or|not|xor)\b |!
95
96
scope : keyword.operator.logical.powershell
96
97
captures :
97
98
1 : punctuation.definition.keyword.powershell
98
- - match : \B(-)(?i:band|bor|bnot|bxor|sh[lr])(?!\p{L})
99
+ - match : \B(-)(?i:band|bor|bnot|bxor|sh[lr])\b
99
100
scope : keyword.operator.bitwise.powershell
100
101
captures :
101
102
1 : punctuation.definition.keyword.powershell
102
- - match : \B(-)(?i:f)(?!\p{L})
103
+ - match : \B(-)(?i:f)\b
103
104
scope : keyword.operator.string-format.powershell
104
105
captures :
105
106
1 : punctuation.definition.keyword.powershell
107
+ # Flags/Options/Parameters
106
108
- match : \B([-/])[\p{L}](?:[\w-]*\w)?
107
109
scope : variable.parameter.option.powershell
108
110
captures :
109
111
1 : punctuation.definition.parameter.powershell
112
+ # operators continue...
110
113
- match : ' [+/*%-]?='
111
114
scope : keyword.operator.assignment.powershell
112
115
- match : (?:\+\+|--)(?![ \t]*\d)
@@ -117,14 +120,14 @@ contexts:
117
120
scope : keyword.operator.arithmetic.powershell
118
121
- match : \|\||&&
119
122
scope : keyword.operator.logical.powershell
123
+ - match : \|
124
+ scope : keyword.operator.logical.pipe.powershell
120
125
- match : ;
121
126
scope : punctuation.terminator.statement.powershell
122
127
- match : \`
123
128
scope : punctuation.separator.continuation.line.powershell
124
129
- match : ' ,'
125
130
scope : punctuation.separator.sequence.powershell
126
- - match : \|
127
- scope : keyword.operator.logical.pipe.powershell
128
131
- match : ' &|\B\.(?= )'
129
132
scope : keyword.operator.other.powershell
130
133
- match : \.\.(?=\-?\d|\(|\$)
@@ -213,7 +216,7 @@ contexts:
213
216
pop : true
214
217
215
218
commands :
216
- - match : (?:(\p{L}|\d|_|-|\\|\:) *\\)?\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)\-.+?(?:\.(?i:exe|cmd|bat|ps1))?\b
219
+ - match : (?:[\w\\:-] *\\)?\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)\-.+?(?:\.(?i:exe|cmd|bat|ps1))?\b
217
220
# "Verb-Noun pattern:"
218
221
scope : support.function.powershell
219
222
- match : \b(?i:(?:foreach|where|sort|tee)-object)\b
@@ -391,16 +394,17 @@ contexts:
391
394
4 : keyword.other.unit.powershell
392
395
- match : |-
393
396
(?x:
394
- \b (
395
- {{dec_digits}}
397
+ (
398
+ \b {{dec_digits}}
396
399
(?:
397
400
(?:
398
- (?:(\.(?!\.)){{dec_digits}}? ){{dec_exponent}}?
401
+ (?:(\.(?!\.))\d* ){{dec_exponent}}? # No `_` after the `.`
399
402
|{{dec_exponent}}
400
403
)
401
404
({{float_suffix}})?
402
405
|({{float_suffix}})
403
406
)
407
+ |(\.)\d+
404
408
)
405
409
({{bytes_unit}})?
406
410
)\b
@@ -409,7 +413,8 @@ contexts:
409
413
2: punctuation.separator.decimal.powershell
410
414
3: storage.type.numeric.powershell
411
415
4: storage.type.numeric.powershell
412
- 5: keyword.other.unit.powershell
416
+ 5: punctuation.separator.decimal.powershell
417
+ 6: keyword.other.unit.powershell
413
418
- match : \b((?:0|[1-9]{{dec_digits}}?)({{integer_suffix}})?)({{bytes_unit}})?\b
414
419
captures :
415
420
1 : constant.numeric.integer.decimal.powershell
@@ -433,7 +438,7 @@ contexts:
433
438
- match : \]
434
439
scope : punctuation.section.bracket.end.powershell
435
440
pop : true
436
- - match : (?!\d+|\.)(?: \p{L}| \p{N}|\.) +
441
+ - match : (?!\d+|\.)[ \p{L}\p{N}.] +
437
442
scope : storage.type.powershell
438
443
- include : main
439
444
@@ -442,7 +447,7 @@ contexts:
442
447
scope : constant.language.powershell
443
448
captures :
444
449
1 : punctuation.definition.variable.powershell
445
- - match : ((\$)(?i:Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\.(?:\p{L}|\d|_) +)*\b)?\b
450
+ - match : ((\$)(?i:Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\.\w +)*\b)?\b
446
451
captures :
447
452
1 : support.constant.variable.powershell
448
453
2 : punctuation.definition.variable.powershell
@@ -461,39 +466,39 @@ contexts:
461
466
)\b
462
467
)
463
468
)
464
- ((?:\.(?:\p{L}|\d|_) +)*\b)?
469
+ ((?:\.\w +)*\b)?
465
470
)
466
471
captures:
467
472
1: variable.language.powershell
468
473
2: punctuation.definition.variable.powershell
469
474
3: variable.other.member.powershell
470
- - match : ((\$)(?i:ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))((?:\.(?:\p{L}|\d|_) +)*\b)?\b
475
+ - match : ((\$)(?i:ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))((?:\.\w +)*\b)?\b
471
476
comment : Style preference variables as language variables so that they stand out.
472
477
captures :
473
478
1 : variable.language.powershell
474
479
2 : punctuation.definition.variable.powershell
475
480
3 : variable.other.member.powershell
476
- - match : ((\$|@)(?i:(global|local|private|script|using|workflow):(?:\p{L}|\d|_) +))((?:\.(?:\p{L}|\d|_) +)*\b)?
481
+ - match : ((\$|@)(?i:(global|local|private|script|using|workflow):\w +))((?:\.\w +)*\b)?
477
482
captures :
478
483
1 : variable.other.readwrite.powershell
479
484
2 : punctuation.definition.variable.powershell
480
485
3 : storage.modifier.scope.powershell
481
486
4 : variable.other.member.powershell
482
- - match : ((\$)(\{)((?i:global|local|private|script|using|workflow)):([^}]*[^}`])(\}))((?:\.(?:\p{L}|\d|_) +)*\b)?
487
+ - match : ((\$)(\{)((?i:global|local|private|script|using|workflow)):([^}]*[^}`])(\}))((?:\.\w +)*\b)?
483
488
captures :
484
489
1 : variable.other.readwrite.powershell
485
490
2 : punctuation.definition.variable.powershell
486
491
3 : punctuation.section.braces.begin.powershell
487
492
4 : storage.modifier.scope.powershell
488
493
6 : punctuation.section.braces.end.powershell
489
494
7 : variable.other.member.powershell
490
- - match : ((?i:(\$|@)((?:\p{L}|\d|_) +:)?(?:\p{L}|\d|_) +))((?:\.(?:\p{L}|\d|_) +)*\b)?
495
+ - match : ((?i:(\$|@)(\w +:)?\w +))((?:\.\w +)*\b)?
491
496
captures :
492
497
1 : variable.other.readwrite.powershell
493
498
2 : punctuation.definition.variable.powershell
494
499
3 : support.variable.drive.powershell
495
500
4 : variable.other.member.powershell
496
- - match : ((?i:(\$)(\{)((?:\p{L}|\d|_) +:)?([^}]*[^}`])(\})))((?:\.(?:\p{L}|\d|_) +)*\b)?
501
+ - match : ((?i:(\$)(\{)(\w +:)?([^}]*[^}`])(\})))((?:\.\w +)*\b)?
497
502
captures :
498
503
1 : variable.other.readwrite.powershell
499
504
2 : punctuation.definition.variable.powershell
@@ -530,7 +535,7 @@ contexts:
530
535
scope : variable.language.powershell
531
536
captures :
532
537
1 : punctuation.definition.variable.powershell
533
- - match : (?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_) +))
538
+ - match : (?i:(\$|@)(global|local|private|script|using|workflow):(\w +))
534
539
captures :
535
540
1 : punctuation.definition.variable.powershell
536
541
2 : storage.modifier.scope.powershell
@@ -543,12 +548,12 @@ contexts:
543
548
3 : variable.other.readwrite.powershell
544
549
4 : keyword.other.powershell
545
550
5 : entity.name.function.invocation.powershell
546
- - match : (?i:(\$)((?:\p{L}|\d|_) +:)?(?:\p{L}|\d|_) +)
551
+ - match : (?i:(\$)(\w +:)?\w +)
547
552
scope : variable.other.readwrite.powershell
548
553
captures :
549
554
1 : punctuation.definition.variable.powershell
550
555
2 : support.variable.drive.powershell
551
- - match : (?i:(\$)(\{)((?:\p{L}|\d|_) +:)?([^}]*[^}`])(\}))
556
+ - match : (?i:(\$)(\{)(\w +:)?([^}]*[^}`])(\}))
552
557
captures :
553
558
1 : punctuation.definition.variable.powershell
554
559
2 : punctuation.section.braces.begin
0 commit comments