/** * This file is derived from https://github.com/jneen/parsimmon and * https://github.com/DefinitelyTyped/DefinitelyTyped. */ type Index = { /** zero-based character offset */ offset: number; /** one-based line offset */ line: number; /** one-based column offset */ column: number; }; type Mark = { start: Index; end: Index; value: T; }; type Node = Mark & { name: Name; }; type Result = Failure | Success; type Success = { status: true; value: T; }; type Failure = { status: false; expected: string[]; index: Index; }; type TypedRule = { [P in keyof TLanguageSpec]: (r: TypedLanguage) => Parser; }; type TypedLanguage = { [P in keyof TLanguageSpec]: Parser; }; type Parser = { parse(input: string): Result; or(otherParser: Parser): Parser; then(call: (result: T) => Parser): Parser; then(anotherParser: Parser): Parser; map(call: (result: T) => U): Parser; skip(otherParser: Parser): Parser; many(): Parser; mark(): Parser>; node(name: Name): Parser>; desc(description: string[] | string): Parser; sepBy(separator: Parser): Parser; }; declare function makeSuccess(index: any, value: any): { expected: never[]; furthest: number; index: any; status: boolean; value: any; }; declare function makeFailure(index: any, expected: any): { expected: any; furthest: any; index: number; status: boolean; value: null; }; declare function seq(...params: any[]): any; declare function seqMap(p1: Parser, cb: (a1: T) => U): Parser; declare function seqMap(p1: Parser, p2: Parser, cb: (a1: T, a2: U) => V): Parser; declare function seqMap(p1: Parser, p2: Parser, p3: Parser, cb: (a1: T, a2: U, a3: V) => W): Parser; declare function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser; declare function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser; declare function createLanguage(parsers: TypedRule): TypedLanguage; declare function alt(...params: any[]): any; declare function sepBy(parser: any, separator: any): Parser; declare function sepBy1(parser: any, separator: any): Parser; declare function string(str: string): Parser; declare function regexp(re: RegExp, group?: number): Parser; declare function succeed(value: any): any; declare function lazy(f: any): any; export declare const P: { alt: typeof alt; createLanguage: typeof createLanguage; index: any; lazy: typeof lazy; makeFailure: typeof makeFailure; makeSuccess: typeof makeSuccess; of: typeof succeed; optWhitespace: Parser; regexp: typeof regexp; sepBy: typeof sepBy; sepBy1: typeof sepBy1; seq: typeof seq; seqMap: typeof seqMap; string: typeof string; succeed: typeof succeed; whitespace: Parser; }; export {}; //# sourceMappingURL=parsimmon.d.ts.map