Skip to content

Adds new PowerShell Core escapes e and u{x} (#60) #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion PowerShellSyntax.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,14 @@
<array>
<dict>
<key>match</key>
<string>`[0abnfrvt"'$`]</string>
<string>`[`0abefnrtv"'$]</string>
<key>name</key>
<string>constant.character.escape.powershell</string>
</dict>
<dict>
<key>include</key>
<string>#unicodeEscape</string>
</dict>
<dict>
<key>match</key>
<string>""</string>
Expand All @@ -674,6 +678,26 @@
</dict>
</array>
</dict>
<key>unicodeEscape</key>
<dict>
<key>comment</key>
<string>`u{xxxx} added in PowerShell 6.0</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>`u\{(?:(?:10)?([0-9a-fA-F]){1,4}|0?\g&lt;1&gt;{1,5})}</string>
<key>name</key>
<string>constant.character.escape.powershell</string>
</dict>
<dict>
<key>match</key>
<string>`u(?:\{[0-9a-fA-F]{,6}.)?</string>
<key>name</key>
<string>invalid.character.escape.powershell</string>
</dict>
</array>
</dict>
<key>function</key>
<dict>
<key>begin</key>
Expand Down
4 changes: 2 additions & 2 deletions spec/testfiles/syntax_test_TheBigTestFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down