From 7301a879e6dab96aa6d8ecf82269dccb3c21f9bf Mon Sep 17 00:00:00 2001 From: "Mathias R. Jessen" Date: Sun, 17 Nov 2019 00:27:47 +0100 Subject: [PATCH 1/2] Add -any/-all operator syntax To reflect changes to binary comparison operators in https://github.com/PowerShell/PowerShell/pull/11068 --- PowerShellSyntax.tmLanguage | 2 +- examples/TheBigTestFile.ps1 | 2 ++ spec/testfiles/syntax_test_TheBigTestFile.ps1 | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index 60dd69d..f55eb64 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -328,7 +328,7 @@ match - (?<!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))(?!\p{L}) + (?<!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|any|all|replace))(?!\p{L}) name keyword.operator.comparison.powershell diff --git a/examples/TheBigTestFile.ps1 b/examples/TheBigTestFile.ps1 index 39b0d89..4a47175 100644 --- a/examples/TheBigTestFile.ps1 +++ b/examples/TheBigTestFile.ps1 @@ -392,6 +392,8 @@ $b -contains $c $x -notcontains $c $c -in $b $c -notin $x +$c -any { $true } +$c -all { $true } $a -match $b $a -notmatch $b $x -like $c diff --git a/spec/testfiles/syntax_test_TheBigTestFile.ps1 b/spec/testfiles/syntax_test_TheBigTestFile.ps1 index 89d416a..e3bcf52 100644 --- a/spec/testfiles/syntax_test_TheBigTestFile.ps1 +++ b/spec/testfiles/syntax_test_TheBigTestFile.ps1 @@ -1010,6 +1010,10 @@ $c -in $b # ^ keyword.operator.comparison.powershell $c -notin $x # ^ keyword.operator.comparison.powershell +$c -any { $true } +# ^ keyword.operator.comparison.powershell +$c -all { $true } +# ^ keyword.operator.comparison.powershell $a -match $b # ^ keyword.operator.comparison.powershell $a -notmatch $b From aaf81a8881f20eaea7dffd2e7749158bb14ac377 Mon Sep 17 00:00:00 2001 From: "Mathias R. Jessen" Date: Sun, 17 Nov 2019 15:37:25 +0100 Subject: [PATCH 2/2] Update PowerShellSyntax.tmLanguage Move `any|all` out of `[ic]` prefix group Co-Authored-By: Carl Morris --- PowerShellSyntax.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index f55eb64..2127ab0 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -328,7 +328,7 @@ match - (?<!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|any|all|replace))(?!\p{L}) + (?<!\w)-(?i:(?:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))|any|all)(?!\p{L}) name keyword.operator.comparison.powershell