/** * The safe regex subset behind SPEC §13.7/§13.8 "bounded pattern complexity" / "bounded regex". * * A length cap is not a complexity bound (`^(a+)+$` is 8 characters and exponential), and a * denylist of known-bad shapes is not one either (`^(a|aa)+$` has no nested quantifier and is * exponential all the same). This module instead ADMITS a demonstrably-safe subset and refuses * everything it cannot prove, at registration time (`contract-invalid` at the caller): * * - parse refusals: backreferences, lookarounds, and anything outside the subset grammar; * - a variable repetition (`*`, `+`, `{m,}`, `{m,n}` with n>m>0, `{m}` with m>1 over variable * content) REFUSES a body that is itself variable (nested repetition, `(a+)+`), nullable * (`(a?)*`), or ambiguous (an alternation anywhere inside with overlapping or multiply * nullable branches, `(a|aa)+`) — the three per-input-character ambiguity sources; * - in a sequence, two variable repetitions with intersecting character sets refuse unless a * HARD separator (non-nullable AND disjoint from the run) fences them (`a*a*`, `a*b?a*`, * `\d*0{3}0*` — the polynomial overlap class); edge repeat-sets propagate through grouping * AND through mandatory items the run can absorb (`a*(aa*)` refuses — grouping never * changes the proof); * - the AGGREGATE ambiguity across the whole pattern is budgeted: fixed ambiguous choices * multiply through a sequence (`(a|aa)(a|aa)…` is 2^k paths with no quantifier), so a * pattern whose path bound exceeds the budget refuses; * - `?` (0-or-1) is repetition-exempt where it cannot multiply per input character: `(…)?` * over quantified content stays admitted (one alternative in total). * * Character sets are computed conservatively (unknown escapes like `\p{…}` widen to ALL, so * uncertainty always refuses more, never less). Every admitted pattern backtracks at most a * constant number of alternatives per input position; every refused pattern names its reason. */ /** Assert `pattern` is inside the profile's safe subset. Throws a plain `Error` naming the * refusal reason (callers wrap it in their boundary's error type). `maxChars` is the §13.7 * length bound, checked first. */ export declare function assertSafePattern(pattern: string, maxChars: number): void; //# sourceMappingURL=safe-pattern.d.ts.map