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 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