From b92a21e6018c4dd5b859ce34a11d4a723fd1bc60 Mon Sep 17 00:00:00 2001 From: msftrncs Date: Tue, 7 May 2019 23:43:36 -0500 Subject: [PATCH 1/2] Add `e and `u{x} escapes --- PowerShellSyntax.tmLanguage | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index 43adbba..d1c1b87 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -662,10 +662,14 @@ match - `[0abnfrvt"'$`] + `[`0abefnrtv"'$] name constant.character.escape.powershell + + include + #unicodeEscape + match "" @@ -674,6 +678,26 @@ + unicodeEscape + + comment + `u{xxxx} added in PowerShell 6.0 + patterns + + + match + `u\{(?:(?:10)?([0-9a-fA-F]){1,4}|0?\g<1>{1,5})} + name + constant.character.escape.powershell + + + match + `u(?:\{[0-9a-fA-F]{,6}.)? + name + invalid.character.escape.powershell + + + function begin From 4affb3a662743d2b7637dd56627bff6d73d00279 Mon Sep 17 00:00:00 2001 From: msftrncs Date: Tue, 7 May 2019 23:49:36 -0500 Subject: [PATCH 2/2] add simple `e and `u{x}` tests --- spec/testfiles/syntax_test_TheBigTestFile.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/testfiles/syntax_test_TheBigTestFile.ps1 b/spec/testfiles/syntax_test_TheBigTestFile.ps1 index 340e685..e5d4a77 100644 --- a/spec/testfiles/syntax_test_TheBigTestFile.ps1 +++ b/spec/testfiles/syntax_test_TheBigTestFile.ps1 @@ -1198,9 +1198,9 @@ get-thing | Out-WithYou > $null # destroy # ^ punctuation.definition.variable.powershell # ^ constant.language.powershell # ^ punctuation.definition.comment.powershell -"Escaped chars: `", `n, `$, `b, `t, `"" +"Escaped chars: `", `n, `$, `b, `t, `e, `u{10ffff}, `"" # <- string.quoted.double.powershell -# ^^ ^^ ^^ ^^ ^^ ^^ string.quoted.double.powershell constant.character.escape.powershell +# ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^^ ^^ string.quoted.double.powershell constant.character.escape.powershell 'But here they''re not escape chars: `", `n, `$, `b, `"' # ^^ constant.character.escape.powershell # ^^ ^^ ^^ ^^ ^^ not:constant.character.escape.powershell