seattlerb/ruby_parser

Squiggly heredoc "<<~" unsupported

Closed this issue · 3 comments

Parsing the following works (with 3.8.2)

puts <<~eos
  Hello, World!
eos

But if you use parentheses, it fails

puts(<<~eos)
  Hello, World!
eos

Parsing the following fails in 3.8.2

# ./do_thing.rb
def do_thing
  <<~EOM
  Some content
  EOM
end

with the error

[2] pry(main)> RubyParser.new.parse File.read("./do_thing.rb")
Racc::ParseError: (string):2 :: parse error on value "<<" (tLSHFT)
from /Users/eoinkelly/.rbenv/versions/2.3.1/lib/ruby/2.3.0/racc/parser.rb:528:in `on_error'

This was fixed in #243 and has been released in the newest version.