-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathexpression-parser.d.ts
91 lines (90 loc) · 2.6 KB
/
expression-parser.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
85
86
87
88
89
90
91
declare interface ParseOptions {
filename?: string;
startRule?: "Start";
tracer?: any;
[key: string]: any;
}
declare type ParseFunction = <Options extends ParseOptions>(
input: string,
options?: Options
) => Options extends { startRule: infer StartRule }
? StartRule extends "Start"
? Start
: Start
: Start;
// These types were autogenerated by ts-pegjs
declare type Start = Program;
declare type Identifier = IdentifierName;
declare type IdentifierName = { type: "Identifier"; name: string };
declare type Literal =
| NullLiteral
| BooleanLiteral
| NumericLiteral
| StringLiteral;
declare type NullLiteral = { type: "NullLiteral"; value: null };
declare type BooleanLiteral =
| { type: "BooleanLiteral"; value: true }
| { type: "BooleanLiteral"; value: false };
declare type NumericLiteral = DecimalLiteral;
declare type DecimalLiteral = { type: "NumericLiteral"; value: number };
declare type StringLiteral = { type: "StringLiteral"; value: string };
declare type PrimaryExpression =
| Identifier
| Literal
| ArrayExpression
| ObjectExpression
| Expression;
declare type ArrayExpression = {
type: "ArrayExpression";
elements: ElementList;
};
declare type ElementList = PrimaryExpression[];
declare type ObjectExpression =
| { type: "ObjectExpression"; properties: [] }
| { type: "ObjectExpression"; properties: PropertyNameAndValueList };
declare type PropertyNameAndValueList = PrimaryExpression[];
declare type PropertyAssignment = {
type: "PropertyAssignment";
key: PropertyName;
value: Expression;
kind: "init";
};
declare type PropertyName = IdentifierName | StringLiteral | NumericLiteral;
declare type MemberExpression =
| {
type: "MemberExpression";
property: StringLiteral;
computed: true;
object: MemberExpression | Identifier | StringLiteral;
}
| {
type: "MemberExpression";
property: Identifier;
computed: false;
object: MemberExpression | Identifier | StringLiteral;
};
declare type CallExpression = {
type: "CallExpression";
arguments: Arguments;
callee: MemberExpression | Identifier;
};
declare type Arguments = PrimaryExpression[];
declare type Expression = CallExpression | MemberExpression;
declare type ExpressionStatement = {
type: "ExpressionStatement";
expression: Expression;
};
declare type Program = { type: "Program"; body: ExpressionStatement };
declare type ExpressionNode =
| Program
| ExpressionStatement
| ArrayExpression
| BooleanLiteral
| CallExpression
| Identifier
| MemberExpression
| NumericLiteral
| ObjectExpression
| PropertyAssignment
| NullLiteral
| StringLiteral;