import type { Combinator, FirstSet, ParseContext, ParseError, RecoveryHelpers } from '../types.ts'; /** * Combine two recovery sentinels into one that matches when either does — used by * tolerant `sepBy` to resync to its own separator OR the enclosing delimiter. Cold * path only; a bare wrapper so we don't pull `choice()` (and its analysis) in. */ export declare function orSentinel(a: Combinator, b: Combinator | undefined): Combinator; /** * A lightweight zero-width sentinel that "matches" (succeeds, consuming nothing) * when the input code point at `pos` starts the given first set. Sync inference * builds one from a list's follow set so a nested list can resync to the enclosing * delimiter with no grammar annotation. Returns `null` when the first set is `any` * or `empty` (no usable inference). */ export declare function firstSetSentinel(fs: FirstSet): Combinator | null; /** * Cold-path recovery scan shared by tolerant `many()` / `sepBy()`. Scans forward * from `from` until `sync` matches (or EOF) — probing the sentinel as pure * lookahead — emits a {@link ParseError} spanning the skipped range, and pushes it * to `ctx._errors`. The sync token is NOT consumed; the caller's loop resumes from * `end`. Only ever reached after an element has failed, so entirely off the hot path. * * The caller owns the loop guard: `sepBy` progress is driven by its separator (a * zero-width error for a missing element is fine); `many` checks `matchesAt(sync)` * itself and breaks when sitting on the terminator, so a zero-width failure can * never spin. */ export declare function recoverScan(input: string, from: number, ctx: ParseContext, sync: Combinator, expected: string[]): { error: ParseError; end: number; }; /** * Does `sentinel` match at `pos` (pure lookahead)? Used by the tolerant list loops * to detect "we are sitting on the sync/terminator token" without consuming it or * capturing anything. */ export declare function matchesAt(sentinel: Combinator, input: string, pos: number, ctx: ParseContext): boolean; /** * Embed a recovered error as a `parseError` CST child at the recovery point, so the * error lives IN the tree (rides reused subtrees across incremental edits; a tree * walk finds every diagnostic) — not only in the flat `ctx._errors` side-channel. * No-op when CST capture is off (value/AST mode). Both the interpreter list loops * and the compiled recovery branches call this (the latter via `_ctx._rec.capture`), * so the embedded node is identical on both paths. */ export declare function captureError(ctx: ParseContext, error: ParseError): void; /** * The recovery-helper bundle handed to a tolerant parse via `ctx._rec`. A COMPILED * grammar can't import these, so the driver (`run`, `parseDoc`) injects them; the * interpreter list loops read the same bundle, guaranteeing byte-identical recovery * across paths. Shared here so every driver installs the exact same instance. */ export declare const REC: RecoveryHelpers; //# sourceMappingURL=scan.d.ts.map