Open leaysgur opened 3 months ago
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.
/(?<a>.)(?<a>.)/
a
With this change, we can use the same name if they are splitted by | and in the same Disjunction like /(?<a>.)|(?<a>.)/.
|
Disjunction
/(?<a>.)|(?<a>.)/
But it still not allowed in some cases like /(?<n>|(?<n>))/, /(?<n>(?<n>)|)/, /((?<n>)|(?<n>))(?<n>)/, etc...
/(?<n>|(?<n>))/
/(?<n>(?<n>)|)/
/((?<n>)|(?<n>))(?<n>)/
You need to track nesting level and | to mange scope.
I'd like to take a stab at this!
@preyneyv You may continue with https://github.com/oxc-project/oxc/pull/6847
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.
For now,
/(?<a>.)(?<a>.)/
is invalid syntax, namea
is duplicated.With this change, we can use the same name if they are splitted by
|
and in the sameDisjunction
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