Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix here string '$a=@"n'"'n"@'#2913

Merged
lzybkr merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:herestringiSazonov/PowerShell:herestringCopy head branch name to clipboard
Dec 23, 2016
Merged

Fix here string '$a=@"n'"'n"@'#2913
lzybkr merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:herestringiSazonov/PowerShell:herestringCopy head branch name to clipboard

Conversation

@iSazonov

Copy link
Copy Markdown
Collaborator

Close #2780

  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.

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.
@PowerShellTeam PowerShellTeam added the Review - Needed The PR is being reviewed label Dec 21, 2016

It "A here string should not throw on '@`"``n'`"'``n`"@'" {
# Issue #2780
{ ExecuteCommand "@`"`n'`"'`n`"@" } | Should Not Throw

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test does not trigger the bug or hit the new code.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@lzybkr lzybkr self-assigned this Dec 21, 2016
@lzybkr lzybkr merged commit 8daef18 into PowerShell:master Dec 23, 2016
@iSazonov iSazonov deleted the herestring branch January 5, 2017 17:43
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

single quote in here-string causes TerminatorExpectedAtEndOfString in V5.0

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.