import { PatternTypes, Scanner, ScannerFactory, ScannerOptions } from './scanner.js'; type OperationArguments = { PUSH: [string]; POP: [number]; }; /** * Operations applied to an AST during a search transition. */ export declare class Operation { readonly type: T; readonly args: OperationArguments[T]; constructor(type: T, args: OperationArguments[T]); } /** * One child scanner in the race that resolves a state's next transition. */ type Lookahead = { bound: 'FROM' | 'AFTER'; scannerFactory: ScannerFactory; }; /** * One lookahead + the operations to apply when it wins the race. */ export declare class Transition { lookahead: Lookahead; operations: Operation<'PUSH' | 'POP'>[]; constructor(lookahead: Lookahead, operations: Operation<'PUSH' | 'POP'>[]); } /** * Fluent builder used by grammar DSL code to accumulate lookaheads and * operations before compiling them to concrete Transitions. */ export declare class TransitionBuilder { private lookaheads; private operations; constructor(lookaheads?: Lookahead[], operations?: Operation<'PUSH' | 'POP'>[]); from(factory: ScannerFactory | PatternTypes): TransitionBuilder; after(factory: ScannerFactory | PatternTypes): TransitionBuilder; push(name: string): TransitionBuilder; terminate(num?: number): TransitionBuilder; goto(name: string): TransitionBuilder; build(): Transition[]; } /** * One branch scanner checked when a search state terminates. Branch * scanners read back over the state's output buffer to attach retroactive * metadata to the emitted Start event. */ export declare class Branch { scanner: Scanner; constructor(scanner: Scanner); } export declare class BranchBuilder { private factory; constructor(factory: ScannerFactory); build(options: ScannerOptions): Branch; } /** * A fully-built state in a Search: its lookahead race, its branch race, * its transition table, and the watermark reader used by branches to * replay the state's output. */ export declare class State { name: string; builder: StateBuilder; lookahead: Scanner; branches: Scanner; transitions: Map; reader: number; children: Map; constructor(name: string, builder: StateBuilder, lookahead: Scanner, branches: Scanner, transitions: Map, reader: number, children: Map); } /** * Builder for states. Holds the builders for this state's transitions, * branches, and nested states; exposes `build()` to instantiate them. * * The constructor inlines the "middle" of multi-lookahead transitions as * synthesised nested states — so `from('a').after('b').push('c')` compiles * to a parent state that pushes an intermediate state to match 'b' and * only then applies the push. */ export declare class StateBuilder { part: string; transitionBuilders: TransitionBuilder[]; branchBuilders: BranchBuilder[]; stateBuilders: StateBuilder[]; parent: StateBuilder; children: Map; constructor(part: string, transitionBuilders: TransitionBuilder[], branchBuilders: BranchBuilder[], stateBuilders: StateBuilder[]); build(reader: number, options?: ScannerOptions): State; get name(): string; } /** Any nested builder used to define a state. */ export type Builder = TransitionBuilder | BranchBuilder | StateBuilder; export {}; //# sourceMappingURL=build.d.ts.map