Actions
Bug #21756
openRipper fails to parse pathological heredoc
Bug #21756:
Ripper fails to parse pathological heredoc
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0dev (2025-11-28T10:49:46Z master dcb9e17f46) +PRISM [x86_64-linux]
Description
$ RBENV_VERSION=ruby-dev ruby -rripper -ve "Ripper.lex(File.read('test.rb'), raise_errors: true)"
ruby 4.0.0dev (2025-11-28T10:49:46Z master dcb9e17f46) +PRISM [x86_64-linux]
/home/user/.rbenv/versions/ruby-dev/lib/ruby/4.0.0+0/ripper/lexer.rb:180:in 'Ripper::Lexer#parse': syntax error, unexpected literal content, expecting ' ' (SyntaxError)
from /home/user/.rbenv/versions/ruby-dev/lib/ruby/4.0.0+0/ripper/lexer.rb:155:in 'Ripper::Lexer#lex'
from /home/user/.rbenv/versions/ruby-dev/lib/ruby/4.0.0+0/ripper/lexer.rb:52:in 'Ripper.lex'
from -e:1:in '<main>'
Both prism and parse.y are able to interpret this code:
Updated by tompng (tomoya ishida) 8 months ago
Updated by Earlopain (Earlopain _) 8 months ago
ยท Edited
Ah, yeah. It's not expecting disjointed strings in arrays where interpolation is not allowed. That doesn't hold with line continuations and heredocs. I'm working on a fix, should not be so difficult.
Edit: Sorry, I totally missed the discrepancy in the output even in my original report. , vs + didn't register for me.
Updated by Earlopain (Earlopain _) 8 months ago
For the prism part of the issue https://github.com/ruby/prism/pull/3778
Actions