Fix percent delimiter strings with crlfs #3304
Merged
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.
parse.y treats CRLF as a LF and basically "normalizes" them before parsing. That means a string like
%\nfoo\r\nis actually treated as%\nfoo\nfor the purposes of parsing. This happens on both the opening side of the percent string as well as on the closing side. So for example%\r\nfoo\nmust be treated as%\nfoo\n.To handle this in Prism, when we start a % string, we check if it starts with
\r\n, and then consider the terminator to actually be\n. Then we check if there are\r\nas we lex the string and treat those as\n, but only in the case the start was a\n.Fixes: #3230
[Bug #20938]