-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Is /[\k](?<a>)/ legal? #2037
Comments
This matches my reading of the spec; r259026 made @mathiasbynens would you consider aligning with JSC (and the current spec) if I add a test262 coverage? |
@schuay what do you think? |
For throwing the |
I think |
|
@waldemarhorwat Why? A lot of things are different in character classes. |
@michaelficarra If a pattern contains named capture group, we can apply stricter parsing rules (and make Implementation-wise (YARR), it is a tiny bit easier to throw than to allow it. |
We already do: |
Fixed in V8 (crbug.com/v8/10602). |
I think everyone now agrees this is illegal; closing. |
In JSC, V8, and XS,
/[\k](?<a>)/
is a legal regular expression. (Chakra and Spidermonkey do not implement named capturing groups and therefore reject it for that reason.)However, my reading of the spec says it should not be legal: ParsePattern says that the presence of a group name after the initial parse should cause a reparse with
+N
, which means that Annex B's SourceCharacterIdentityEscape should not allow\k
. (Assuming the obvious fix to #1081, which would thread the+N
through ClassAtomNoDash -> ClassEscape -> CharacterEscape -> IdentityEscape -> SourceCharacterIdentityEscape.)The text was updated successfully, but these errors were encountered: