diff --git a/README.md b/README.md index 7c87875..3f6eb5c 100644 --- a/README.md +++ b/README.md @@ -924,7 +924,6 @@ Notice that nearly every feature below has at least subtle differences from Java ✅ ✔ Unnamed captures and numbered calls allowed when using named capture
- ✔ Allows numbered subroutine refs to duplicate group names
diff --git a/src/index.js b/src/index.js index 768a7e8..b4aeb26 100644 --- a/src/index.js +++ b/src/index.js @@ -64,14 +64,14 @@ function toDetails(pattern, options) { bestEffortTarget: opts.target, }); const generated = generate(regexAst, opts); - pattern = possessive(recursion(generated.pattern)); - const atomized = atomic(pattern, {useEmulationGroups: !opts.avoidSubclass}); - const useEmulationGroups = atomized !== pattern && !opts.avoidSubclass; - pattern = atomized; + const pluginData = {useEmulationGroups: !opts.avoidSubclass}; const result = { - pattern, + pattern: atomic(possessive(recursion(generated.pattern, pluginData)), pluginData), flags: `${opts.hasIndices ? 'd' : ''}${opts.global ? 'g' : ''}${generated.flags}${generated.options.disable.v ? 'u' : 'v'}`, }; + // See + const emulationGroupMarker = '$E$'; + const useEmulationGroups = result.pattern.includes(emulationGroupMarker) && !opts.avoidSubclass; if (useEmulationGroups || regexAst._strategy) { result.subclass = { useEmulationGroups,