-
-
Notifications
You must be signed in to change notification settings - Fork 617
Open
Labels
C-enhancementCategory - New feature or requestCategory - New feature or requestgood first issueExperience Level - Good for newcomersExperience Level - Good for newcomers
Description
Done in #6847 , but there is room for performance improvement.
We want to keep the code as simple as possible and process the current 2 loops in 1 loop for duplicates detection.
https://github.com/tc39/proposal-duplicate-named-capturing-groups
https://tc39.es/ecma262/#sec-mightbothparticipate
For now, /(?<a>.)(?<a>.)/
is invalid syntax, name a
is duplicated.
With this change, we can use the same name if they are splitted by |
and in the same Disjunction
like /(?<a>.)|(?<a>.)/
.
But it still not allowed in some cases like /(?<n>|(?<n>))/
, /(?<n>(?<n>)|)/
, /((?<n>)|(?<n>))(?<n>)/
, etc...
You need to track nesting level and |
to mange scope.
TODOs
- Update count capturing parens logic to allow duplicates in certain cases
fn parse_capturing_groups<'a>( - No need to change parser main logic
- Update README
- Update local tests
- Enable conformance tests
oxc/tasks/coverage/src/test262/mod.rs
Lines 103 to 104 in aa7718a
// ES2025 https://github.com/tc39/proposal-duplicate-named-capturing-groups "regexp-duplicate-named-groups",
shulaoda
Metadata
Metadata
Assignees
Labels
C-enhancementCategory - New feature or requestCategory - New feature or requestgood first issueExperience Level - Good for newcomersExperience Level - Good for newcomers