From 370d0c12b2ba7f4d7b5f79c7a283c6860d40f3bc Mon Sep 17 00:00:00 2001 From: msftrncs Date: Thu, 9 May 2019 01:00:47 -0500 Subject: [PATCH 1/5] fixes #143 moves double-quote double-quote escape from #doubleQuotedStringEscapes to #doubleQuotedString. Removes the single-quote single-quote escape from single-quote here-string pattern. --- PowerShellSyntax.tmLanguage | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index 11bab40..e435980 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -162,15 +162,6 @@ ^'@ name string.quoted.single.heredoc.powershell - patterns - - - match - '' - name - constant.character.escape.powershell - - include @@ -601,12 +592,6 @@ include #unicodeEscape - - match - "" - name - constant.character.escape.powershell - unicodeEscape @@ -1551,6 +1536,12 @@ include #doubleQuotedStringEscapes + + match + "" + name + constant.character.escape.powershell + include #interpolation From 0d4cbf82884efce0d4ed4cf5f7276ae2c83e3b00 Mon Sep 17 00:00:00 2001 From: msftrncs Date: Thu, 9 May 2019 01:06:35 -0500 Subject: [PATCH 2/5] applies issue #167 part 1 permits whitespace to follow here-string start token. --- PowerShellSyntax.tmLanguage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index e435980..4128682 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -134,7 +134,7 @@ begin - \@"(?=$) + \@"\s*$ end ^"@ name @@ -157,7 +157,7 @@ begin - \@'(?=$) + \@'\s*$ end ^'@ name From bb41692e56bce116b005e50c3f3244ff9a31fd30 Mon Sep 17 00:00:00 2001 From: msftrncs Date: Thu, 9 May 2019 01:07:28 -0500 Subject: [PATCH 3/5] tests for #143 and #167 part 1 --- spec/testfiles/syntax_test_TheBigTestFile.ps1 | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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 From f9308e37c4dbbc9224eb4b87eec74a2117006f32 Mon Sep 17 00:00:00 2001 From: msftrncs Date: Thu, 9 May 2019 01:11:37 -0500 Subject: [PATCH 4/5] fixes #141, adds support curly quotes indirectly applies #167 parts 2 and 3 --- PowerShellSyntax.tmLanguage | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index 4128682..869086a 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,9 @@ begin - \@"\s*$ + \@["\x{201C}-\x{201E}]\s*$ end - ^"@ + ^["\x{201C}-\x{201E}]@ name string.quoted.double.heredoc.powershell patterns @@ -157,9 +159,9 @@ begin - \@'\s*$ + \@['\x{2018}-\x{201B}]\s*$ end - ^'@ + ^['\x{2018}-\x{201B}]@ name string.quoted.single.heredoc.powershell @@ -584,7 +586,7 @@ match - `[`0abefnrtv"'$] + `[`0abefnrtv'"\x{2018}-\x{201E}$] name constant.character.escape.powershell @@ -1501,7 +1503,7 @@ doubleQuotedString begin - (?<!(?<!`)")" + ["\x{201C}-\x{201E}] beginCaptures 0 @@ -1511,7 +1513,9 @@ end - "(?!") + ["\x{201C}-\x{201E}] + applyEndPatternLast + endCaptures 0 @@ -1538,7 +1542,7 @@ match - "" + ["\x{201C}-\x{201E}]{2} name constant.character.escape.powershell From f5dfc7b8459c3173cf4c0cb91d1d3722e7bc733b Mon Sep 17 00:00:00 2001 From: msftrncs Date: Thu, 9 May 2019 01:12:38 -0500 Subject: [PATCH 5/5] applies issue #167 part 4, adds punctuation scope to start/end of here-string --- PowerShellSyntax.tmLanguage | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index 869086a..0278f69 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -136,9 +136,25 @@ begin - \@["\x{201C}-\x{201E}]\s*$ + (@["\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 @@ -159,9 +175,25 @@ begin - \@['\x{2018}-\x{201B}]\s*$ + (@['\x{2018}-\x{201B}])\s*$ + beginCaptures + + 1 + + name + punctuation.definition.string.begin.powershell + + end ^['\x{2018}-\x{201B}]@ + endCaptures + + 0 + + name + punctuation.definition.string.end.powershell + + name string.quoted.single.heredoc.powershell