forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pegjs.d.ts
84 lines (68 loc) · 1.75 KB
/
pegjs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Type definitions for PEG.js
// Project: http://pegjs.org/
// Definitions by: vvakame <https://github.com/vvakame>, Tobias Kahlert <https://github.com/SrTobi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace PEG {
function parse(input:string):any;
interface Location {
line: number;
column: number;
offset: number;
}
interface LocationRange {
start: Location,
end: Location
}
class SyntaxError {
line: number;
column: number;
offset: number;
location: LocationRange;
expected:any[];
found:any;
name:string;
message:string;
}
}
declare module "pegjs" {
type Location = PEG.Location;
type LocationRange = PEG.LocationRange;
interface ExpectedItem {
type: string;
value?: string;
description: string;
}
interface PegjsError extends Error {
name: string;
message: string;
location: LocationRange;
found?: any;
expected?: ExpectedItem[];
stack?: any;
}
type GrammarError = PegjsError;
var GrammarError: any;
interface ParserOptions {
startRule: string;
tracer: any;
}
interface Parser {
parse(input: string, options?:ParserOptions): any;
SyntaxError: any;
}
interface BuildOptions {
cache?: boolean;
allowedStartRules?: string[];
optimize?: string;
plugins?: any[];
}
interface OutputBuildOptions extends BuildOptions {
output?: string;
}
function buildParser(grammar: string, options?: BuildOptions): Parser;
function buildParser(grammar: string, options?: OutputBuildOptions): Parser | string;
namespace parser {
type SyntaxError = PegjsError;
var SyntaxError: any;
}
}