summaryrefslogtreecommitdiff
path: root/prism_compile.c
diff options
context:
space:
mode:
authoreileencodes <[email protected]>2024-12-05 13:56:03 -0500
committergit <[email protected]>2024-12-11 23:06:32 +0000
commit9fe6fd86936ead769fe983feb5461ca4f192f16e ()
treecd774ba0aeb9040a37dd6a11336f58621e68cd26 /prism_compile.c
parentd53e4545f4754c789828cdf491df1eacf982d121 (diff)
[ruby/prism] Fix percent delimiter strings with crlfs
parse.y treats CRLF as a LF and basically "normalizes" them before parsing. That means a string like `%\nfoo\r\n` is actually treated as `%\nfoo\n` for 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\n` must 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\n` as we lex the string and treat those as `\n`, but only in the case the start was a `\n`. Fixes: #3230 [Bug #20938] https://.com/ruby/prism/commit/e573ceaad6 Co-authored-by: John Hawthorn <[email protected]> Co-authored-by: eileencodes <[email protected]> Co-authored-by: Kevin Newton <[email protected]>
0 files changed, 0 insertions, 0 deletions