Fix here string '$a=@"n'"'n"@'#2913
Merged
Merged
Fix here string '$a=@"n'"'n"@'#2913
$a=@"n'"'n"@'#2913Conversation
1. Fix tokenizer The tokenizer do multiple scans the script line to get tokens. Before the fix the tokenizer on the first pass examined that string as double-quoted (Expandable) string not as here string, figured the average double quotation mark as a closing and then starting with the single quotation mark continued processing the line as single-quoted string which had no closing single quotation mark. The fix stop the first scan pass after getting '=' (assume assignment-expression '$a=' for next pass). 2. Add test.
lzybkr
suggested changes
Dec 21, 2016
|
|
||
| It "A here string should not throw on '@`"``n'`"'``n`"@'" { | ||
| # Issue #2780 | ||
| { ExecuteCommand "@`"`n'`"'`n`"@" } | Should Not Throw |
Contributor
There was a problem hiding this comment.
This test does not trigger the bug or hit the new code.
lzybkr
approved these changes
Dec 23, 2016
rjmholt
pushed a commit
to rjmholt/PowerShell
that referenced
this pull request
Jan 9, 2017
The tokenizer did multiple scans the script line to get tokens. Before the fix the tokenizer on the first pass examined that string as double-quoted (Expandable) string not as here string, figured the average double quotation mark as a closing and then starting with the single quotation mark continued processing the line as single-quoted string which had no closing single quotation mark. The fix is to stop the first scan pass after getting '=' (assume assignment-expression '$a=' for next pass).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #2780
The tokenizer do multiple scans the script line to get tokens. Before
the fix the tokenizer on the first pass examined that string as
double-quoted (Expandable) string not as here string, figured the
average double quotation mark as a closing and then starting with the
single quotation mark continued processing the line as single-quoted
string which had no closing single quotation mark.
The fix stop the first scan pass after getting '=' (assume
assignment-expression '$a=' for next pass).