-
Notifications
You must be signed in to change notification settings - Fork 438
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
Regex literal syntax #6776
base: master
Are you sure you want to change the base?
Regex literal syntax #6776
Conversation
ad00e77
to
c42ce97
Compare
I think it might be worth adding an attribute to the expression not to incorrectly print escaped regexp as an unescaped one |
to be fixed later
necessary to pass syntax roundtrip test since printing has changed
c42ce97
to
69a3237
Compare
I`m not sure I follow. Can you give an example? |
Tests passing! 🥳 I'm sure the code quality could be improved, and we could add validation of the internal regex syntax either before or after merging this. |
@glennsl Could you add a CHANGELOG entry? @IwanKaramazow Good to go? |
@cknitt I'll do one last pass over the next few days to see if there aren't any edge cases. |
Ping @IwanKaramazow 🙂 |
Ah, yes, will do a review this weekend! |
This adds syntax for regex literals equivalent to the literal syntax in JavaScript. It is effectively just syntax sugar for the %re syntax extension, but opens up the additional possibility of checking the regex syntax during compilation.
The syntax looks like:
which is equivalent to:
and compiles to:
Closes #6287