Closed schungx closed 2 years ago
Thanks, I added tests as well, lgtm.
There is still some slight differences, for example, Rhai will throw syntax error on any non-recognized escapes (e.g. \w
), and only allows recognized ones. This parsing allows anything following \
.
Do you think we should make it consistent?
Do you think we should make it consistent?
In the future, definitely, the two implementations should be as close as possible.
I wouldn't consider this a high priority right now. Also escapes that aren't required for the tokenization have to be validated at later stages, in the parser or I'd even push it all the way to the HIR.
A double
""
inside a string is an escaped"
character.Similarly, a double back-tick
``
is an escaped`
character.This PR handles these double escapes.