import type { Combinator } from '../types.ts'; /** * Positive lookahead. Succeeds (consuming nothing) when `combinator` matches at * this position; fails when it doesn't. The mirror of `not()`. * * // "a mixin reference, not a class selector": require the punctuation ahead, * // then let the real production consume it. * const mixinRef = sequence(peek(regex(/[.#]/)), mixinCall) * * WHY THIS EXISTS AS A PRIMITIVE (not `not(not(X))`): * * `not(not(X))` is behaviourally a positive lookahead, but `not()` reports * `firstSet: any()` — it cannot know what it forbids — so `not(not(X))` reports * `any()` too. An arm leading with it therefore POISONS its choice's first-char * dispatch (`analyzeGating` flags it as the `double-not` anti-pattern), and among * sibling arms that share a first char the hand-rolled gate miscompiles. * * `peek(X)` carries X's first-set instead, so a leading `peek()` GATES its arm: * `choice(sequence(peek(regex(/[.#]/)), …), …)` still emits O(1) dispatch. * * The first-set is exact only when X is NON-NULLABLE. A nullable `peek(X)` * succeeds on the empty string, so it constrains no first character at all — it * reports `any()`, the sound over-approximation. (Same rule the sequence * first-set uses; see `isPositiveLookahead` in `first-set.ts`.) */ export declare function peek(combinator: Combinator): Combinator; //# sourceMappingURL=peek.d.ts.map