Regex literal syntax
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:
let re = /a.*c/mg
which is equivalent to:
let re = %re(`/a.*c/mg`)
and compiles to:
var re = /a.*c/mg;
Closes #6287
I think it might be worth adding an attribute to the expression not to incorrectly print escaped regexp as an unescaped one
I think it might be worth adding an attribute to the expression not to incorrectly print escaped regexp as an unescaped one
I`m not sure I follow. Can you give an example?
Tests passing! :partying_face:
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.
@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. 🙂 Would be great to get this merged!
Yes, sorry, I have some time off next week. Will get to this.
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 👍