UNPKG

1.51 kBTypeScriptView Raw
1import { MessageFormatElement } from './types';
2export interface IFilePosition {
3 offset: number;
4 line: number;
5 column: number;
6}
7export interface IFileRange {
8 start: IFilePosition;
9 end: IFilePosition;
10}
11export interface ILiteralExpectation {
12 type: "literal";
13 text: string;
14 ignoreCase: boolean;
15}
16export interface IClassParts extends Array<string | IClassParts> {
17}
18export interface IClassExpectation {
19 type: "class";
20 parts: IClassParts;
21 inverted: boolean;
22 ignoreCase: boolean;
23}
24export interface IAnyExpectation {
25 type: "any";
26}
27export interface IEndExpectation {
28 type: "end";
29}
30export interface IOtherExpectation {
31 type: "other";
32 description: string;
33}
34export declare type Expectation = ILiteralExpectation | IClassExpectation | IAnyExpectation | IEndExpectation | IOtherExpectation;
35export declare class SyntaxError extends Error {
36 static buildMessage(expected: Expectation[], found: string | null): string;
37 message: string;
38 expected: Expectation[];
39 found: string | null;
40 location: IFileRange;
41 name: string;
42 constructor(message: string, expected: Expectation[], found: string | null, location: IFileRange);
43}
44export interface IParseOptions {
45 filename?: string;
46 startRule?: string;
47 tracer?: any;
48 [key: string]: any;
49}
50export declare type ParseFunction = (input: string, options?: IParseOptions) => MessageFormatElement[];
51export declare const pegParse: ParseFunction;
52//# sourceMappingURL=parser.d.ts.map
\No newline at end of file