Skip to content

Commit 7301a87

Browse files
committed
Add -any/-all operator syntax
To reflect changes to binary comparison operators in PowerShell/PowerShell#11068
1 parent 4a0a076 commit 7301a87

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

PowerShellSyntax.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@
328328
</dict>
329329
<dict>
330330
<key>match</key>
331-
<string>(?&lt;!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))(?!\p{L})</string>
331+
<string>(?&lt;!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|any|all|replace))(?!\p{L})</string>
332332
<key>name</key>
333333
<string>keyword.operator.comparison.powershell</string>
334334
</dict>

examples/TheBigTestFile.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ $b -contains $c
392392
$x -notcontains $c
393393
$c -in $b
394394
$c -notin $x
395+
$c -any { $true }
396+
$c -all { $true }
395397
$a -match $b
396398
$a -notmatch $b
397399
$x -like $c

spec/testfiles/syntax_test_TheBigTestFile.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,10 @@ $c -in $b
10101010
# ^ keyword.operator.comparison.powershell
10111011
$c -notin $x
10121012
# ^ keyword.operator.comparison.powershell
1013+
$c -any { $true }
1014+
# ^ keyword.operator.comparison.powershell
1015+
$c -all { $true }
1016+
# ^ keyword.operator.comparison.powershell
10131017
$a -match $b
10141018
# ^ keyword.operator.comparison.powershell
10151019
$a -notmatch $b

0 commit comments

Comments
 (0)