/** * Low-level regex char-class primitives, shared by every hand-rolled regex * analysis in the codebase — the interpreter's first-set walker * (`./first-set.ts`), `regex()`'s short-scan fast path, and codegen's scannable * lowering (`../compiler/scannable-run.ts`). Kept dependency-free (no combinator, * no codegen imports) so it lands in even the leanest interpreter bundle. * * Everything here parses a regex STRUCTURE to code-point ranges; nothing encodes * a specific byte meaning ("this is whitespace"). `\d`/`\w` lower to their ASCII * ranges (correct for the default, non-`u` engine); `\s` uses the fixed * `SPACE_RANGES` set (unaffected by the `u` flag). */ /** Single-char escapes whose code point is fixed regardless of context. */ export declare const CLASS_ESCAPES: Record; /** * `\s`'s code-point set per the spec's `WhiteSpace` + `LineTerminator` * productions — TAB/LF/VT/FF/CR, SPACE, NBSP, and the Unicode `Zs` space * separators. Fixed regardless of the `u` flag, so always safe to lower. */ export declare const SPACE_RANGES: Array<[number, number]>; /** * ASCII code-point ranges for the shorthand classes we lower. `\d`/`\w` are * ASCII-only in the default (non-`u`) engine; `\s` maps to `SPACE_RANGES`. */ export declare function shorthandRanges(ch: 'd' | 'w' | 's'): Array<[number, number]>; /** `\uXXXX` at `body[i]` → its code point and the index past it, or null. */ export declare function readUnicodeEscape(body: string, i: number): { cp: number; next: number; } | null; /** * A regex fragment that is a plain run of literal characters → its code points, * or null when the fragment contains any operator (so a caller can never mistake * `a*` for the two-char literal `a*`). An empty fragment returns null, because * every caller wants "at least one char to match". */ export declare function literalCodePoints(frag: string): number[] | null; /** * A single-character MATCHER fragment as a (possibly negated) range set: a * bracketed class `[…]`/`[^…]`, a `\d`/`\w`/`\s` shorthand, or one literal char. * Anything wider (a group, a multi-char literal, `.`) returns null. * * "Bracketed class" means the WHOLE fragment is ONE class. Testing only that it * opens with `[` and ends with `]` is a different, weaker question, and * `[ \t\n\r\f]*[\$(]` answers it while being a SEQUENCE — a whitespace run, then * one of `$(`. Read as a single class its members become the garbage union of * everything between the OUTER brackets, whitespace and `*` and `[` included, so * scss's `\+(?=[ \t\n\r\f]*[\$(])` matched a `+` before a space; the shape oracle * caught it at 203 positions of the scss corpus. Every caller here asks "is this * ONE char matcher", so a fragment that is not gets null — declining costs a * lowering or widens a first-set to `any()`, both of which only forgo a fast * path, whereas accepting yields a wrong member set, which is a wrong scan or a * wrong dispatch. */ export declare function parseClassOperand(body: string): { ranges: Array<[number, number]>; negated: boolean; } | null; /** * Parse a regex char-class body (the chars BETWEEN `[` and `]`, negation `^` * already stripped by the caller) to code-point ranges. `\d`/`\w`/`\s` expand to * their ranges; `\uXXXX` and the fixed single-char escapes resolve to their code * point; any other letter escape (`\D`, `\W`, `\S`, `\b`, …) returns null rather * than being mis-read as a literal letter, so callers fall back to a safe * over-approximation instead of a wrong set. */ export declare function parseClassRanges(body: string): Array<[number, number]> | null; //# sourceMappingURL=classes.d.ts.map