Skip to content

[TS] Support bounded ordered RegExp matching - #683

Draft
CaelmBleidd wants to merge 2 commits into
mainfrom
caelmbleidd/ts-ordered-regexp
Draft

CaelmBleidd wants to merge 2 commits into
mainfrom
caelmbleidd/ts-ordered-regexp

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

Changes

  • Extend the intrinsic matcher for flagless RegExp literals with ordered alternatives, optional groups, and backtracking across greedy character quantifiers. Keep the existing linear matcher for patterns it already supports.
  • Support intrinsic RegExp.exec on those literals with the same match-array semantics as String.match, including optional captures and UTF-16 offsets.
  • Bound the ordered matcher by pattern complexity and input length. Over-limit input, flags, lookaround, backreferences, and coercion retain explicit unsupported outcomes.

Verification

  • All 13 tests in RegExpRuntimeTest and OrderedRegExpRuntimeTest passed locally, including Node.js replay. detektMain and detektTest passed.
  • In a diagnostic sample of 14 classes selected from previous literal-related stops, admission alone gained 3.85 percentage points in mean class coverage versus the frozen engine. Exact ordered matching then changed it by −1.19 points versus admission with fresh call results.
  • Node.js executed 466 common inputs in the two admitted arms. Completion belonged to the predicted set for 465 fresh results and 466 exact results. Both arms had 463 correct singleton predictions. The sample measures completion, with 459 inputs from one class.

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

Successfully merging this pull request may close these issues.

1 participant