Skip to content
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

Make it an error to escape any character that doesn't need to be escaped #178

Open
slevithan opened this issue Apr 17, 2017 · 0 comments
Open

Comments

@slevithan
Copy link
Owner

Following ES6, make the token that blocks invalid metasequences (here) even stricter by also making it an error to escape punctuation, etc. in cases where the escaped character is not special on its own. In ES6 with flag u, the only characters interpreted as themselves when escaped are ^ $ \ . * ? ( ) [ ] { } | (and presumably a hyphen in character classes).

Need to ensure this accounts for characters that are special only with certain XRegExp flags, e.g. escaping whitespace with flag x. This is probably handled automatically by XRegExp applying tokens in reverse insertion order.

While at it, should probably also disallow \b within character classes since \b for the backspace control character is a super minor convenience and creates confusion given the difference in meaning of \b outside character classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant