-
Notifications
You must be signed in to change notification settings - Fork 21
Should we support Unicode escapes in group names, RegExp style? #23
Comments
Is it worth complicating the spec and implementations to support a feature that, most likely, no-one will use?
+1 from me for leaving the spec as-is and removing existing support from V8. |
I agree with @schuay. The benefits of matching |
Dan pointed out that escape sequences in replacer strings would already be handled by regular string literal syntax. |
Actually, I think this already falls out of the current semantics of the specification. The syntax is based on IdentiferName, and taking the StringValue of that production. Both of these will explicitly allow Unicode escapes. An issue with the current spec, though, is that we use UnicodeEscapeSequence rather than RegExpUnicodeEscapeSequence. For example, It seems surprising and a little overly complicated to not follow the RegExp syntax for Unicode escapes when in a RegExp. So I think we should split out the grammar for identifiers here, unless we want to fully remove the feature. If we do this splitting out, we need to make sure to maintain the errors for bad identifiers. |
Update docs and tests for recent changes in the spec for unicode escapes in capture group names. tc39/proposal-regexp-named-groups#23 BUG=v8:5437 Review-Url: https://codereview.chromium.org/2788423003 Cr-Commit-Position: refs/heads/master@{#44474}
E.g., see these tests in V8: https://cs.chromium.org/chromium/src/v8/test/mjsunit/harmony/regexp-named-captures.js?q=regexp-named+package:%5Echromium$&l=86 . These should be supported by the standard, as it's analogous to identifiers and properties.
The text was updated successfully, but these errors were encountered: