Skip to content

Commit 8683958

Browse files
committed
Consolidate variable lookahead
And make sure it doesn't make hashtables
1 parent f5cbac6 commit 8683958

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

PowerShell.sublime-syntax

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,11 @@ contexts:
480480
###[ VARIABLES ]###############################################################
481481

482482
variables:
483-
- match: (?=[$@](?:[{$^]|{{identifier_simple}}))
483+
- match: '{{var_lookahead}}'
484484
push: [members, expect-variable]
485485

486486
variables-without-members:
487-
- match: (?=[$@](?:[{$^]|{{identifier_simple}}))
487+
- match: '{{var_lookahead}}'
488488
push: [expect-variable]
489489

490490
expect-variable:
@@ -501,7 +501,7 @@ contexts:
501501
1: punctuation.definition.variable.powershell
502502
2: punctuation.section.interpolation.begin.powershell
503503
push: inside-variable-special-char
504-
- match: (\$|@)(?!\{)
504+
- match: (\$|@)
505505
captures:
506506
1: punctuation.definition.variable.powershell
507507
2: punctuation.section.interpolation.begin.powershell
@@ -1064,6 +1064,11 @@ variables:
10641064
identifier_simple: '[\p{L}\p{Nd}_?]+'
10651065
identifier_special: '[^}]*[^}`]'
10661066
identifier_function: '[\p{L}\p{Nd}_.-]+'
1067+
var_lookahead: |-
1068+
(?x: (?=
1069+
\$[$^{]
1070+
| [$@]{{identifier_simple}}
1071+
))
10671072
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables
10681073
var_constants: |-
10691074
\b(?xi:

0 commit comments

Comments
 (0)