-
Notifications
You must be signed in to change notification settings - Fork 449
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
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 |
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! |
@IwanKaramazow Ping again. 🙂 |
Yes, sorry, I have some time off next week. Will get to this. |
69a3237
to
f4823dc
Compare
to be fixed later
necessary to pass syntax roundtrip test since printing has changed
f4823dc
to
1051f47
Compare
Rebased and added changelog |
@glennsl As @IwanKaramazow does not seem to be available for review: Good to go from your point of view? Then I'll merge and we can always refine things in follow-up PRs if necessary. |
Yea, sorry about this. The work looks good in general 👍 |
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