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

Undefined value of parameter NamedCaptureGroups is Annex B for ClassAtomNoDash #3291

Open
lgalfaso opened this issue Mar 3, 2024 · 1 comment

Comments

@lgalfaso
Copy link

lgalfaso commented Mar 3, 2024

Description: Value of the parameter NamedCaptureGroups should be defined for the extended version of ClassAtomNoDash

B.1.2 Regular Expressions Patterns extends the regular expressions grammar. It extends the original ClassAtomNoDash

ClassAtomNoDash[UnicodeMode] ::
    SourceCharacter but not one of \ or ] or -
    \ ClassEscape[?UnicodeMode]

with ClassAtomNoDash

ClassAtomNoDash[UnicodeMode, NamedCaptureGroups] ::
    SourceCharacter but not one of \ or ] or -
    \ ClassEscape[?UnicodeMode, ?NamedCaptureGroups]
    \ [lookahead = c]

The extended version has one more parameter (NamedCaptureGroups). All other symbols that make use of ClassAtomNoDash do not define the parameter NamedCaptureGroups for ClassAtomNoDash (all uses of ClassAtomNoDash as a non-terminating symbol are outside Annex B).

If one were to follow the definitions of how the grammar parameters should be understood, then the extended definition of ClassAtomNoDash is

ClassAtomNoDash ::
    SourceCharacter but not one of \ or ] or -
    \ ClassEscape
    \ [lookahead = c]

ClassAtomNoDash_UnicodeMode ::
    SourceCharacter but not one of \ or ] or -
    \ ClassEscape_UnicodeMode
    \ [lookahead = c]

ClassAtomNoDash_NamedCaptureGroups ::
    SourceCharacter but not one of \ or ] or -
    \ ClassEscape_NamedCaptureGroups
    \ [lookahead = c]

ClassAtomNoDash_UnicodeMode_NamedCaptureGroups ::
    SourceCharacter but not one of \ or ] or -
    \ ClassEscape_UnicodeMode_NamedCaptureGroups
    \ [lookahead = c]

given that there are no references in the grammar to ClassAtomNoDash_NamedCaptureGroups nor to ClassAtomNoDash_UnicodeMode_NamedCaptureGroups, then the strictest interpretation of the grammar would be equivalent to the extended version of ClassAtomNoDash being defined as

ClassAtomNoDash[UnicodeMode] ::
    SourceCharacter but not one of \ or ] or -
    \ ClassEscape[?UnicodeMode, ~NamedCaptureGroups]
    \ [lookahead = c]

Is this the correct interpretation of the extended grammar?

@jmdyck
Copy link
Collaborator

jmdyck commented Mar 3, 2024

Yup, this is a known spec bug. See #1081 (comment) and #2037 (comment) (both from before N changed to NamedCaptureGroups).

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

No branches or pull requests

2 participants