-
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
/(?<foo>A)\k<foo>/
is a syntax error unless using Annex B
#2434
Comments
It's a syntax error on the first pass, I agree, but that means that it will re-parse with the Edit: oh, except that it has to parse successfully on the first pass in order for the second pass to happen, I see. I think that's a spec bug, yes. (I wish we didn't have two grammars. As far as I'm aware every major implementation uses the Annex B grammar; the non-Annex B one is basically irrelevant and therefore does not get maintained properly.) |
Yes, it skips the second pass if the first pass had a syntax error, and Maybe, should both the |
I think this is correct as specified. The first pass will parse |
@devsnek That's right in Annex B. But it's a syntax error in the spec core because the sequence |
hm... is that the "but not UnicodeIDContinue" in the spec? i must have a bug in engine262 |
Yes. Keep in mind that's only there for the non-Annex B grammar, i.e. the one which is not used in actual implementations. (The Annex B variant does not have that restriction.) |
That may be a candidate to patch this issue.
|
/(?<foo>A)\k<foo>/
(without u
flag) is a syntax error/(?<foo>A)\k<foo>/
is a syntax error unless using Annex B
This is also #1888, sort of. |
Description: Adding 1 and 1 is two, but it should be...
From mysticatea/regexpp#23.
This is about
/(?<foo>A)\k<foo>/
withoutu
flag and without Annex B.u
flag, parse the pattern withoutN
parameter, then if no syntax errors exist and named capturing groups exist, re-parse the pattern withN
parameter."\k
is a syntax error if noN
parameter and no Annex B.As a result, named capturing groups without
u
flag are always a syntax error.I think IdentityEscape requires
[~N] k
or something like that in order to allow named capturing groups with nou
flag.eshost Output:
(I'm not sure about the environment without Annex B)
The text was updated successfully, but these errors were encountered: