Skip to content

Prism.lex_compat creates wrong on_sp token when used with heredoc and unclosed embexpr #3911

@tompng

Description

@tompng
Prism.lex_compat("<<A+B\n\#{C").value
# => [[[1, 0], :on_heredoc_beg, "<<A", BEG], [[1, 3], :on_sp, "+B\n\#{C", BEG]]

Found in IRB's truffleruby ci failure. Actual ruby code:
https://github.com/ruby/irb/blob/342f57b2d0a39c519a53e6d5a3938f6235119c9c/test/irb/test_ruby_lex.rb#L17-L21

+<<A-
#{*<<B/
#{⑤&<<C|⑥

This failing test is not important in IRB anymore and I think it will be removed soon (in ruby/irb#1160).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions