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

Fix parser translator simplifying strings when it shouldn't #3340

Merged

Conversation

Earlopain
Copy link
Contributor

For example this:

_buf << ':
'

Prism currently converts tSTRING_BEG => tSTRING_CONTENT => tSTRING_END into a simple tSTRING token.

But, the parser gem doesn't do that when the string content ends with a newline.

Note that this is only an issue for strings spanning only two lines. When there are more lines, there are two tSTRING_CONTENT tokens so it falls through.

For example this:
```rb
_buf << ':
'
```

Prism currently converts `tSTRING_BEG` => `tSTRING_CONTENT` => `tSTRING_END` into a simple `tSTRING` token.

But, the parser gem doesn't do that when the string content ends with a newline.

Note that this is only an issue for strings spanning only two lines.
When there are more lines, there are two `tSTRING_CONTENT` tokens so it falls through.
@kddnewton kddnewton merged commit f5ae6d2 into ruby:main Dec 22, 2024
54 of 55 checks passed
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