export = generatedparser; declare namespace generatedparser { /** * Provides information pointing to a location within a source. */ interface SourcePosition { offset: number; line: number; column: number; } /** * The `start` and `end` position's of an object within the source. */ interface SourceLocation { filename?: string; start: SourcePosition; end: SourcePosition; } /** * An object that can be used to make a generated parser trace it's progress. */ interface ITracer { trace( event: { type: string; rule: string; result?: string; location: SourceLocation; } ); } interface ISyntaxError { name: string; message: string; stack?: string | any; expected?: T; found?: string; location: SourceLocation; } interface SyntaxError { new( message: string, expected: T, found: string | null, location: SourceLocation ): ISyntaxError; readonly prototype: ISyntaxError; buildMessage( expected: T, found?: string ): string; } interface SyntaxExpectation { type: string; description?: string; text?: string; parts?: string[]; inverted?: boolean; ignoreCase?: boolean; expected?: SyntaxExpectation; } interface LiteralExpectation { type: "literal"; text: string; ignoreCase: boolean; } interface ClassExpectation { type: "class"; parts: string[]; inverted: boolean; ignoreCase: boolean; } interface AnyExpectation { type: "any"; } interface EndExpectation { type: "end"; } interface OtherExpectation { type: "other"; description: string; } interface NotExpectation { type: "not"; expected: SyntaxExpectation; } type SyntaxErrorConstructor = SyntaxError | SyntaxError | SyntaxError | SyntaxError | SyntaxError | SyntaxError | SyntaxError; /** * Default options that are shared by all generated parser's. */ interface IOptions { [ key: string ]: any; filename?: string; startRule?: string; tracer?: ITracer; } /** * API for the parser generated by PEG.js */ interface API { SyntaxError: SyntaxErrorConstructor; DefaultTracer?: ITracer; parse( input: string, options?: IOptions ): T; } }