export interface ParserOptions { keepHistory?: boolean | undefined; lexer?: Lexer | undefined; [key: string]: any; } export interface CompiledRules { Lexer?: Lexer | undefined; ParserStart: string; ParserRules: ParserRule[]; } export interface ParserRule { name: string; symbols: any[]; postprocess?: Postprocessor | undefined; } export declare type Postprocessor = (data: any[], reference?: number, wantedBy?: {}) => any; export interface Lexer { /** * Sets the internal buffer to data, and restores line/col/state info taken from save(). */ reset(data: string, state?: LexerState): void; /** * Returns e.g. {type, value, line, col, …}. Only the value attribute is required. */ next(): Token | undefined; /** * Returns an object describing the current line/col etc. This allows us * to preserve this information between feed() calls, and also to support Parser#rewind(). * The exact structure is lexer-specific; nearley doesn't care what's in it. */ save(): LexerState; /** * Returns a string with an error message describing the line/col of the offending token. * You might like to include a preview of the line in question. */ formatError(token: Token, message: string): string; } export declare type Token = string | { value: string; }; export interface LexerState { [x: string]: any; }