diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index 11bab40..0278f69 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -101,7 +101,7 @@ begin - (?<!')' + ['\x{2018}-\x{201B}] beginCaptures 0 @@ -111,7 +111,9 @@ end - '(?!') + ['\x{2018}-\x{201B}] + applyEndPatternLast + endCaptures 0 @@ -126,7 +128,7 @@ match - '' + ['\x{2018}-\x{201B}]{2} name constant.character.escape.powershell @@ -134,9 +136,25 @@ begin - \@"(?=$) + (@["\x{201C}-\x{201E}])\s*$ + beginCaptures + + 1 + + name + punctuation.definition.string.begin.powershell + + end - ^"@ + ^["\x{201C}-\x{201E}]@ + endCaptures + + 0 + + name + punctuation.definition.string.end.powershell + + name string.quoted.double.heredoc.powershell patterns @@ -157,20 +175,27 @@ begin - \@'(?=$) + (@['\x{2018}-\x{201B}])\s*$ + beginCaptures + + 1 + + name + punctuation.definition.string.begin.powershell + + end - ^'@ - name - string.quoted.single.heredoc.powershell - patterns - + ^['\x{2018}-\x{201B}]@ + endCaptures + + 0 - match - '' name - constant.character.escape.powershell + punctuation.definition.string.end.powershell - + + name + string.quoted.single.heredoc.powershell include @@ -593,7 +618,7 @@ match - `[`0abefnrtv"'$] + `[`0abefnrtv'"\x{2018}-\x{201E}$] name constant.character.escape.powershell @@ -601,12 +626,6 @@ include #unicodeEscape - - match - "" - name - constant.character.escape.powershell - unicodeEscape @@ -1516,7 +1535,7 @@ doubleQuotedString begin - (?<!(?<!`)")" + ["\x{201C}-\x{201E}] beginCaptures 0 @@ -1526,7 +1545,9 @@ end - "(?!") + ["\x{201C}-\x{201E}] + applyEndPatternLast + endCaptures 0 @@ -1551,6 +1572,12 @@ include #doubleQuotedStringEscapes + + match + ["\x{201C}-\x{201E}]{2} + name + constant.character.escape.powershell + include #interpolation diff --git a/spec/testfiles/syntax_test_TheBigTestFile.ps1 b/spec/testfiles/syntax_test_TheBigTestFile.ps1 index 83a1a43..a7a6287 100644 --- a/spec/testfiles/syntax_test_TheBigTestFile.ps1 +++ b/spec/testfiles/syntax_test_TheBigTestFile.ps1 @@ -379,14 +379,15 @@ $a3[1..2] "This 'string' is nice." # ^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.powershell -# Double quoted here-string -@" +# Double quoted here-string, white space at end of start token allowed +@" # <- string.quoted.double.heredoc.powershell # <- string.quoted.double.heredoc.powershell $This is a 'double quoted' # <- punctuation.definition.variable.powershell # ^ string.quoted.double.heredoc.powershell support.variable.automatic.powershell -Isn't it "nice"?? +Isn't it ""nice""?? +# ^^ not:constant.character.escape.powershell There is no @platting here! # ^ not:punctuation.definition.variable.powershell # ^ not:variable.other.readwrite.powershell @@ -394,6 +395,22 @@ There is no @platting here! # <- string.quoted.double.heredoc.powershell # <- string.quoted.double.heredoc.powershell +# Single quoted here-string, white space at end of start token allowed +@' +# <- string.quoted.single.heredoc.powershell + # <- string.quoted.single.heredoc.powershell +$This is a ''single quoted'' +# ^^ not:constant.character.escape.powershell +# <- not:punctuation.definition.variable.powershell +# ^ string.quoted.single.heredoc.powershell not:support.variable.automatic.powershell +Isn't it "nice"?? +There is no @platting here! +# ^ not:punctuation.definition.variable.powershell +# ^ not:variable.other.readwrite.powershell +'@ +# <- string.quoted.single.heredoc.powershell + # <- string.quoted.single.heredoc.powershell + # Numeric constants -3 # ^^ constant.numeric.integer.powershell