/** Initial state index for the state machine. */ export declare const INITIAL_STATE = 1; /** Fail state index indicating no valid transition. */ export declare const FAIL_STATE = 0; /** A match result: [start index, end index, captured tags]. */ export type Match = [start: number, end: number, tags: string[]]; /** Configuration for constructing a StateMachine. */ export interface StateMachineConfig { stateTable: number[][]; accepting: boolean[]; tags: string[][]; } /** * A StateMachine represents a deterministic finite automaton. * It can perform matches over a sequence of values, similar to a regular expression. */ export default class StateMachine { readonly stateTable: number[][]; readonly accepting: boolean[]; readonly tags: string[][]; constructor(dfa: StateMachineConfig); /** * Returns an iterable object that yields pattern matches over the input sequence. * Matches are of the form [startIndex, endIndex, tags]. */ match(input: readonly number[]): Iterable; /** * For each match over the input sequence, action functions matching * the tag definitions in the input pattern are called with the startIndex, * endIndex, and sub-match sequence. */ apply(input: readonly number[], actions: Record void>): void; }