import { Progress, Scanner, ScannerFactory, ScannerOptions } from './scanner.js'; import { StateBuilder } from './build.js'; import { Event } from '../event.js'; import { Interval } from '../interval.js'; import { Logs } from '../vendor/generics/log.js'; import { IncrementalSink } from '../incremental.js'; /** * Event-native pushdown search. Drives state transitions against a * watermarked EventQueue: child lookahead scanners race to recognise the * next transition, the winner's operations (PUSH/POP) are applied, and * the input reader is reindexed according to the winner's bound * (FROM rewinds, AFTER advances past the matched interval). * * Branch scanners associated with each state observe the state's own * output window (via a retained watermark on the output queue) and emit * metadata-bearing Start events that are merged into the state's opening * Start event before it is evicted. */ export declare class Search implements Scanner { private initial; private root; private sink?; id: string; /** Buffer of inputs into this search. */ private input; /** Buffer of outputs from this search. Events emitted here may be * rewritten by branches before they evict past the frontmost watermark. */ private output; /** Generator producing input events for the current active state. */ private head; /** Events evicted from the output buffer; ready to be returned by `shift`. */ private evicted; lastclosed: number; /** Closed index of the current lookahead. */ private lookaheadClosed; private states; /** Buffer of lookahead results awaiting resolution. */ private buffer; private builder; private started; /** Toggled when the head's index is changed on state transition; * forces the outer shift() loop to re-enter rather than returning. */ private reset; logger: Logs; constructor(initial: string, root: StateBuilder, options?: ScannerOptions, sink?: IncrementalSink); get complete(): boolean; get lastreceived(): number; reindex(newIndex: number): void; private get state(); /** * Apply a lookahead-race result: push/pop states, advance input reader * according to the winner's FROM/AFTER bound, run branch scanners over * the popped state's output window to fold metadata into its Start. */ private transition; /** * Process branch scanners for a popped state: read the state's own * output window, feed each event to the state's branch scanner, and * merge any metadata the branch emits onto the state's Start event. * * This is the rewrite of the old inline branch-processing block. Key * changes from the original: do not require the first branch result * to be a Start (Race may emit Starts embedded later in its output), * and merge metadata from *every* Start the branch emits rather than * only the first. */ private processBranches; /** * Drain the `evicted` queue into a Progress for return; meanwhile feed * non-branch events into the interval builder for AST construction. */ private computeOutputProgress; private emit; shift(curEvent: Event): Progress; /** * The AST built so far. Forces any open states closed and consumes * their synthesised End events into the builder. */ get interval(): Interval; static factory(initial: string, root: StateBuilder, sink?: IncrementalSink): ScannerFactory; } //# sourceMappingURL=search.d.ts.map