Skip to content

Conversation

@Earlopain
Copy link
Collaborator

The lexer did not jump to the heredoc_end, causing the heredoc end delimiter to be parsed twice.

Normally the heredocs get flushed when a newline is encountered. But because the newline is part of the string delimiter, that codepath is not taken.

Fixes [Bug #21758]

Actually also depends on #3771. While the issue was only about syntax-invalid code, this would also hit the assertion. Quite fortunate (for me) that this was not a problem anymore (;

The lexer did not jump to the `heredoc_end`, causing the heredoc end delimiter
to be parsed twice.

Normally the heredocs get flushed when a newline is encountered. But because
the newline is part of the string delimiter, that codepath is not taken.

Fixes [Bug #21758]
B

# \r\n
%Q
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to just work without special handling, see snapshot for confirmation

@Earlopain
Copy link
Collaborator Author

Earlopain commented Dec 4, 2025

parse.y failure seems unrelated. I saw the same while I was syncing my fork. Might be fixed by ruby/ruby#15393, that is not in ruby-dev yet.

Copy link
Collaborator

@kddnewton kddnewton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I really didn't want to look into this one...

@kddnewton kddnewton merged commit c4c0c81 into ruby:main Dec 4, 2025
62 of 64 checks passed
@Earlopain
Copy link
Collaborator Author

Gee, I wonder why 😅. Does seem like a bit of a waste of time to fix but I got to poke around in an area which I didn't really pay much attention to before. Your heredoc documentation was pretty helpful

@Earlopain Earlopain deleted the %Q-newline-heredoc branch December 4, 2025 15:32
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 this pull request may close these issues.

2 participants