parser icon indicating copy to clipboard operation
parser copied to clipboard

Quasi nested heredoc accepted by parser and rejected by ruby.

Open mbj opened this issue 5 years ago • 0 comments

On parser-2.7.1.5 the following is accepted:

<<~FOO
  #{<<~BAR}
FOO
BAR

This is accepted with AST:

(begin
  (dstr
    (str "")
    (begin
      (str "FOO\n"))
    (str "\n"))
  (const nil :BAR))

And IMO rightfully rejected by ruby-2.7.1:

y.rb:1: can't find string "FOO" anywhere before EOF

I think parser should subset what ruby accepts, but never accept a superset.

mbj avatar Sep 24 '20 23:09 mbj