Skip to content

Conversation

@Earlopain
Copy link
Collaborator

Turns out, it was already almost correct. If you disregard \c and \M style escapes, only a single character is allowed to be escaped in a regex so most tests passed already.

There was also a mistake where the wrong value was constructed for the ast, this is now fixed. One test fails because of this, but I'm fairly sure it is because of a parser bug. For /\“/, the backslash is supposed to be removed because it is a multibyte character. But tbh, I don't entirely understand all the rules.

Fixes more than half of the remaining ast differences for rubocop tests

Turns out, it was already almost correct. If you disregard \c and \M style escapes, only a single character is allowed to be escaped in a regex so most tests passed already.

There was also a mistake where the wrong value was constructed for the ast, this is now fixed.
One test fails because of this, but I'm fairly sure it is because of a parser bug. For `/\“/`, the backslash is supposed to be removed because it is a multibyte character. But tbh,
I don't entirely understand all the rules.

Fixes more than half of the remaining ast differences for rubocop tests
@kddnewton kddnewton merged commit 2fbec1c into ruby:main Jan 14, 2025
57 checks passed
@Earlopain Earlopain deleted the parser-translator-better-regexp-handling branch January 16, 2025 10:18
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