ruby / prism

Prism Ruby parser
https://ruby.github.io/prism/
MIT License
792 stars 134 forks source link

Lex difference for heredoc with zero indentation and line continuation #2842

Open Earlopain opened 1 month ago

Earlopain commented 1 month ago

I know heredocs with line continuation still make some trouble, so not sure if this is the same thing:

<<~TEXT
foo\
bar
TEXT

ripper

[[[1, 0], :on_heredoc_beg, "<<~TEXT", BEG],
 [[1, 12], :on_nl, "\n", BEG],
 [[2, 0], :on_tstring_content, "foo\\\n", BEG],
 [[3, 0], :on_tstring_content, "bar\n", BEG],
 [[4, 0], :on_heredoc_end, "TEXT", BEG]]

compat

[[[1, 0], :on_heredoc_beg, "<<~TEXT", BEG],
 [[1, 12], :on_nl, "\n", BEG],
 [[2, 0], :on_tstring_content, "foo\\\nbar\n", BEG],
 [[4, 0], :on_heredoc_end, "TEXT", END]]