Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prism::Translation::RubyParser - Separate lines inside squiggly heredocs not combined #2828

Closed
presidentbeef opened this issue May 21, 2024 · 0 comments · Fixed by #2830
Closed

Comments

@presidentbeef
Copy link
Contributor

..when there is interpolation:

> RubyParser.new.parse("<<~HERE\n\ \#{1}\n b\n c\nHERE")
 => s(:dstr, "", s(:evstr, s(:lit, 1)), s(:str, "\nb\nc\n"))
> Prism::Translation::RubyParser.parse("<<~HERE\n\ \#{1}\n b\n c\nHERE")
 => s(:dstr, "", s(:evstr, s(:lit, 1)), s(:str, "\n"), s(:str, "b\n"), s(:str, "c\n"))

Note without interpolation:

> Prism::Translation::RubyParser.parse("<<~HERE\n\ a\n b\n c\nHERE")
 => s(:str, "a\nb\nc\n")

And compare to regular heredoc:

> Prism::Translation::RubyParser.parse("<<-HERE\n\ \#{1}\n b\n c\nHERE")
 => s(:dstr, " ", s(:evstr, s(:lit, 1)), s(:str, "\n b\n c\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant