import type { Combinator } from '../types.ts'; /** * Zero-width state ASSERTION: succeeds (consuming nothing) only when `predicate` * returns true for `ctx.state`. Fails otherwise. * * Intended for use inside sequence() to gate subsequent parsing on runtime * context set with withCtx(): * * const returnStmt = sequence( * gate(ctx => (ctx as { inFn: boolean }).inFn), * literal('return'), optional(expr) * ) * * Naming: this matches the `gate:` field on a gated CHOICE arm * (`choice({ gate, combinator }, other)`). Use the arm FIELD to SELECT a branch by * a cheap state predicate; use this COMBINATOR to ASSERT a state predicate * mid-sequence. Formerly named `guard()` — see the deprecated alias in `guard.ts`. * * Note: like all state predicates its first-set is `any`, so a `gate(...)` as the * LEADING term of a choice arm poisons that choice's first-char dispatch. Keep it * after a concrete leading terminal. */ export declare function gate(predicate: (state: unknown) => boolean): Combinator; //# sourceMappingURL=gate.d.ts.map