Skip to content

Conversation

@Earlopain
Copy link
Collaborator

Two ast fixes for regex nodes:

Actually, the same line continuation logic should probably also be applied to string nodes. There's even a comment for that:

# This occurs when we have line continuations in the string. We
# need to come back and fix this, but for now this stops the
# code from breaking when we encounter it because of trying to
# transpose arrays of different lengths.
[builder.string_internal([node.unescaped, srange(node.content_loc)])]

The ast looks correct but no new tests pass so I can't confidently say nothing else breaks. I'll come back to this later once I hammered out a few more failures.

Turns out, the vast majority of work was already done with handling the same for heredocs

I'm confident this should also apply to actual string nodes (there's even a todo for it) but
no tests change if I apply it there too, so I can't say for sure if the logic would be correct.
The individual test files are a bit too large, maybe something else would break that currently passes.

Leaving it for later to look more closely into that.
In that specific case, no string node is emitted
@tenderlove tenderlove merged commit 4519d9f into ruby:main Jan 7, 2025
56 checks passed
@Earlopain Earlopain deleted the parser-translator-empty-regexp-ast branch January 7, 2025 20:05
Earlopain added a commit to Earlopain/prism that referenced this pull request Jan 8, 2025
This is a followup to ruby#3373, where the implementation
was extracted
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.

3 participants