@quenk/wml 2.13.10 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.d.ts +8 -8
- package/lib/cli.js +1 -3
- package/lib/cli.js.map +1 -1
- package/lib/cli.ts +48 -60
- package/lib/compile/codegen.d.ts +4 -9
- package/lib/compile/codegen.js +164 -369
- package/lib/compile/codegen.js.map +1 -1
- package/lib/compile/codegen.ts +644 -952
- package/lib/compile/index.d.ts +2 -2
- package/lib/compile/index.js +4 -4
- package/lib/compile/index.js.map +1 -1
- package/lib/compile/index.ts +14 -17
- package/lib/compile/transform.d.ts +8 -6
- package/lib/compile/transform.js +46 -18
- package/lib/compile/transform.js.map +1 -1
- package/lib/compile/transform.ts +139 -116
- package/lib/{dom.d.ts → dom/index.d.ts} +8 -2
- package/lib/{dom.js → dom/index.js} +84 -66
- package/lib/dom/index.js.map +1 -0
- package/lib/dom/index.ts +425 -0
- package/lib/dom/monitor.d.ts +33 -0
- package/lib/dom/monitor.js +60 -0
- package/lib/dom/monitor.js.map +1 -0
- package/lib/dom/monitor.ts +75 -0
- package/lib/index.d.ts +10 -95
- package/lib/index.js +10 -10
- package/lib/index.js.map +1 -1
- package/lib/index.ts +57 -182
- package/lib/main.js +17 -17
- package/lib/main.js.map +1 -1
- package/lib/main.ts +38 -44
- package/lib/parse/ast.d.ts +12 -6
- package/lib/parse/ast.js +68 -58
- package/lib/parse/ast.js.map +1 -1
- package/lib/parse/ast.ts +400 -482
- package/lib/parse/generated.d.ts +3 -5
- package/lib/parse/generated.js +9504 -9264
- package/lib/parse/index.d.ts +2 -3
- package/lib/parse/index.js.map +1 -1
- package/lib/parse/index.ts +7 -9
- package/lib/parse/test.js +194 -192
- package/lib/parse/test.js.map +1 -1
- package/lib/parse/test.ts +294 -404
- package/lib/parse/wml.y +4 -0
- package/lib/tsconfig.json +19 -20
- package/lib/util.d.ts +10 -0
- package/lib/util.js +21 -0
- package/lib/util.js.map +1 -0
- package/lib/util.ts +39 -0
- package/lib/view/frame.d.ts +103 -0
- package/lib/view/frame.js +206 -0
- package/lib/view/frame.js.map +1 -0
- package/lib/view/frame.ts +249 -0
- package/lib/view/index.d.ts +58 -0
- package/lib/view/index.js +48 -0
- package/lib/view/index.js.map +1 -0
- package/lib/view/index.ts +97 -0
- package/package.json +4 -3
- package/lib/dom.js.map +0 -1
- package/lib/dom.ts +0 -475
package/lib/parse/ast.ts
CHANGED
|
@@ -6,20 +6,16 @@
|
|
|
6
6
|
* Location is jison's location tracking information.
|
|
7
7
|
*/
|
|
8
8
|
export interface Location {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
9
|
+
[key: string]: string | number;
|
|
10
|
+
}
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* AST is the interface of all the nodes
|
|
16
14
|
*/
|
|
17
15
|
export interface AST {
|
|
16
|
+
type: string;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
location: Location
|
|
22
|
-
|
|
18
|
+
location: Location;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
/**
|
|
@@ -30,48 +26,43 @@ export interface AST {
|
|
|
30
26
|
* as private here.
|
|
31
27
|
*/
|
|
32
28
|
export class Module {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
type = "module";
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
public imports: ImportStatement[],
|
|
33
|
+
public exports: Export[],
|
|
34
|
+
public location: Location,
|
|
35
|
+
) {}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* clone this node.
|
|
39
|
+
*/
|
|
40
|
+
clone() {
|
|
41
|
+
return new Module(
|
|
42
|
+
this.imports.slice(),
|
|
43
|
+
this.exports.slice(),
|
|
44
|
+
this.location,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
/**
|
|
54
50
|
* ImportStatement
|
|
55
51
|
*/
|
|
56
52
|
export class ImportStatement {
|
|
53
|
+
type = "import-statement";
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
public location: Location) { }
|
|
64
|
-
|
|
55
|
+
constructor(
|
|
56
|
+
public member: ImportMember,
|
|
57
|
+
public module: StringLiteral,
|
|
58
|
+
public location: Location,
|
|
59
|
+
) {}
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
/**
|
|
68
63
|
* ImportMember
|
|
69
64
|
*/
|
|
70
|
-
export type ImportMember
|
|
71
|
-
= AggregateMember
|
|
72
|
-
| AliasedMember
|
|
73
|
-
| CompositeMember
|
|
74
|
-
;
|
|
65
|
+
export type ImportMember = AggregateMember | AliasedMember | CompositeMember;
|
|
75
66
|
|
|
76
67
|
/**
|
|
77
68
|
* AliasedMember
|
|
@@ -79,25 +70,25 @@ export type ImportMember
|
|
|
79
70
|
* @property {Identifier} member - The identifier that is aliased.
|
|
80
71
|
*/
|
|
81
72
|
export class AliasedMember {
|
|
73
|
+
type = "aliased-member";
|
|
82
74
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
public location: Location) { }
|
|
89
|
-
|
|
75
|
+
constructor(
|
|
76
|
+
public member: Member,
|
|
77
|
+
public alias: Member,
|
|
78
|
+
public location: Location,
|
|
79
|
+
) {}
|
|
90
80
|
}
|
|
91
81
|
|
|
92
82
|
/**
|
|
93
83
|
* AggregateMember
|
|
94
84
|
*/
|
|
95
85
|
export class AggregateMember {
|
|
86
|
+
type = "qualified-member";
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
constructor(
|
|
89
|
+
public id: Member,
|
|
90
|
+
public location: Location,
|
|
91
|
+
) {}
|
|
101
92
|
}
|
|
102
93
|
|
|
103
94
|
/**
|
|
@@ -105,42 +96,36 @@ export class AggregateMember {
|
|
|
105
96
|
* @property {...Identifier|Aliased_Member} members
|
|
106
97
|
*/
|
|
107
98
|
export class CompositeMember {
|
|
99
|
+
type = "composite-member";
|
|
108
100
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
public location: Location) { }
|
|
114
|
-
|
|
101
|
+
constructor(
|
|
102
|
+
public members: (Member | AliasedMember)[],
|
|
103
|
+
public location: Location,
|
|
104
|
+
) {}
|
|
115
105
|
}
|
|
116
106
|
|
|
117
|
-
export type Member
|
|
118
|
-
= UnqualifiedIdentifier
|
|
119
|
-
| UnqualifiedConstructor
|
|
120
|
-
;
|
|
107
|
+
export type Member = UnqualifiedIdentifier | UnqualifiedConstructor;
|
|
121
108
|
|
|
122
|
-
export type Export
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
;
|
|
109
|
+
export type Export =
|
|
110
|
+
| AliasStatement
|
|
111
|
+
| ContextStatement
|
|
112
|
+
| LetStatement
|
|
113
|
+
| FunStatement
|
|
114
|
+
| ViewStatement
|
|
115
|
+
| Tag;
|
|
130
116
|
|
|
131
117
|
/**
|
|
132
118
|
* AliasStatement
|
|
133
119
|
*/
|
|
134
120
|
export class AliasStatement {
|
|
121
|
+
type = "alias-statement";
|
|
135
122
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
public location: Location) { }
|
|
143
|
-
|
|
123
|
+
constructor(
|
|
124
|
+
public id: UnqualifiedConstructor,
|
|
125
|
+
public typeParameters: TypeParameter[],
|
|
126
|
+
public members: Type[],
|
|
127
|
+
public location: Location,
|
|
128
|
+
) {}
|
|
144
129
|
}
|
|
145
130
|
|
|
146
131
|
export type ContextStatementMember = ConstructorType | MemberDeclaration;
|
|
@@ -149,648 +134,581 @@ export type ContextStatementMember = ConstructorType | MemberDeclaration;
|
|
|
149
134
|
* ContextStatement
|
|
150
135
|
*/
|
|
151
136
|
export class ContextStatement {
|
|
137
|
+
type = "context-statement";
|
|
152
138
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
public location: Location) { }
|
|
160
|
-
|
|
139
|
+
constructor(
|
|
140
|
+
public id: UnqualifiedConstructor,
|
|
141
|
+
public typeParameters: TypeParameter[],
|
|
142
|
+
public members: ContextStatementMember[],
|
|
143
|
+
public location: Location,
|
|
144
|
+
) {}
|
|
161
145
|
}
|
|
162
146
|
|
|
163
147
|
/**
|
|
164
148
|
* MemberDeclaration
|
|
165
149
|
*/
|
|
166
150
|
export class MemberDeclaration {
|
|
151
|
+
type = "member-declaration";
|
|
167
152
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
public location: Location) { }
|
|
175
|
-
|
|
153
|
+
constructor(
|
|
154
|
+
public path: UnqualifiedIdentifier[],
|
|
155
|
+
public kind: Type,
|
|
156
|
+
public optional: boolean,
|
|
157
|
+
public location: Location,
|
|
158
|
+
) {}
|
|
176
159
|
}
|
|
177
160
|
|
|
178
161
|
/**
|
|
179
162
|
* LetStatement
|
|
180
163
|
*/
|
|
181
164
|
export class LetStatement {
|
|
165
|
+
type = "let-statement";
|
|
182
166
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
public location: Location) { }
|
|
190
|
-
|
|
167
|
+
constructor(
|
|
168
|
+
public id: UnqualifiedIdentifier,
|
|
169
|
+
public cons: ConstructorType,
|
|
170
|
+
public expression: Expression,
|
|
171
|
+
public location: Location,
|
|
172
|
+
) {}
|
|
191
173
|
}
|
|
192
174
|
|
|
193
|
-
export type ContextTypeIndicator
|
|
194
|
-
= ConstructorType
|
|
195
|
-
| ContextFromStatement
|
|
196
|
-
;
|
|
175
|
+
export type ContextTypeIndicator = ConstructorType | ContextFromStatement;
|
|
197
176
|
|
|
198
177
|
/**
|
|
199
178
|
* ContextFromStatement
|
|
200
179
|
*/
|
|
201
180
|
export class ContextFromStatement {
|
|
181
|
+
type = "context-from-statement";
|
|
202
182
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
public location: Location) { }
|
|
209
|
-
|
|
183
|
+
constructor(
|
|
184
|
+
public cons: ConstructorType,
|
|
185
|
+
public module: StringLiteral,
|
|
186
|
+
public location: Location,
|
|
187
|
+
) {}
|
|
210
188
|
}
|
|
211
189
|
|
|
212
190
|
/**
|
|
213
191
|
* ViewStatement
|
|
214
192
|
*/
|
|
215
193
|
export class ViewStatement {
|
|
194
|
+
type = "view-statement";
|
|
216
195
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
public location: Location) { }
|
|
226
|
-
|
|
196
|
+
constructor(
|
|
197
|
+
public id: UnqualifiedConstructor,
|
|
198
|
+
public typeParameters: TypeParameter[],
|
|
199
|
+
public context: ContextTypeIndicator | undefined,
|
|
200
|
+
public directives: LetStatement[],
|
|
201
|
+
public root: Tag,
|
|
202
|
+
public location: Location,
|
|
203
|
+
) {}
|
|
227
204
|
}
|
|
228
205
|
|
|
229
206
|
export class FunStatement {
|
|
207
|
+
type = "fun-statement";
|
|
230
208
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
public location: Location) { }
|
|
239
|
-
|
|
209
|
+
constructor(
|
|
210
|
+
public id: UnqualifiedIdentifier,
|
|
211
|
+
public typeParameters: TypeParameter[],
|
|
212
|
+
public parameters: Parameter[],
|
|
213
|
+
public body: Child[],
|
|
214
|
+
public location: Location,
|
|
215
|
+
) {}
|
|
240
216
|
}
|
|
241
217
|
|
|
242
218
|
/**
|
|
243
219
|
* TypeParameter
|
|
244
220
|
*/
|
|
245
221
|
export class TypeParameter {
|
|
222
|
+
type = "type-parameter";
|
|
246
223
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
public location: Location) { }
|
|
253
|
-
|
|
224
|
+
constructor(
|
|
225
|
+
public id: UnqualifiedConstructor,
|
|
226
|
+
public constraint: Type,
|
|
227
|
+
public location: Location,
|
|
228
|
+
) {}
|
|
254
229
|
}
|
|
255
230
|
|
|
256
231
|
/**
|
|
257
232
|
* Type
|
|
258
233
|
*/
|
|
259
|
-
export type Type
|
|
260
|
-
= ConstructorType
|
|
261
|
-
| FunctionType
|
|
262
|
-
| RecordType
|
|
263
|
-
| ListType
|
|
264
|
-
;
|
|
234
|
+
export type Type = ConstructorType | FunctionType | RecordType | ListType;
|
|
265
235
|
|
|
266
236
|
/**
|
|
267
237
|
* ConstructorType
|
|
268
238
|
*/
|
|
269
239
|
export class ConstructorType {
|
|
240
|
+
type = "constructor-type";
|
|
270
241
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
public location: Location) { }
|
|
277
|
-
|
|
242
|
+
constructor(
|
|
243
|
+
public id: UnqualifiedIdentifier | Constructor,
|
|
244
|
+
public typeParameters: TypeParameter[],
|
|
245
|
+
public location: Location,
|
|
246
|
+
) {}
|
|
278
247
|
}
|
|
279
248
|
|
|
280
249
|
/**
|
|
281
250
|
* FunctionType
|
|
282
251
|
*/
|
|
283
252
|
export class FunctionType {
|
|
253
|
+
type = "function-type";
|
|
284
254
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
public location: Location) { }
|
|
291
|
-
|
|
255
|
+
constructor(
|
|
256
|
+
public parameters: Type[],
|
|
257
|
+
public returnType: Type,
|
|
258
|
+
public location: Location,
|
|
259
|
+
) {}
|
|
292
260
|
}
|
|
293
261
|
|
|
294
262
|
/**
|
|
295
263
|
* RecordType
|
|
296
264
|
*/
|
|
297
265
|
export class RecordType {
|
|
266
|
+
type = "record-type";
|
|
298
267
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
public location: Location) { }
|
|
304
|
-
|
|
268
|
+
constructor(
|
|
269
|
+
public members: MemberDeclaration[],
|
|
270
|
+
public location: Location,
|
|
271
|
+
) {}
|
|
305
272
|
}
|
|
306
273
|
|
|
307
274
|
/**
|
|
308
275
|
* ListType
|
|
309
276
|
*/
|
|
310
277
|
export class ListType {
|
|
278
|
+
type = "list-type";
|
|
311
279
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
public location: Location) { }
|
|
317
|
-
|
|
280
|
+
constructor(
|
|
281
|
+
public elementType: Type,
|
|
282
|
+
public location: Location,
|
|
283
|
+
) {}
|
|
318
284
|
}
|
|
319
285
|
|
|
320
286
|
/**
|
|
321
287
|
* TupleType
|
|
322
288
|
*/
|
|
323
289
|
export class TupleType {
|
|
290
|
+
type = "tuple-type";
|
|
324
291
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
public location: Location) { }
|
|
330
|
-
|
|
292
|
+
constructor(
|
|
293
|
+
public members: Type[],
|
|
294
|
+
public location: Location,
|
|
295
|
+
) {}
|
|
331
296
|
}
|
|
332
297
|
|
|
333
|
-
|
|
334
298
|
/**
|
|
335
299
|
* Parameter
|
|
336
300
|
*/
|
|
337
|
-
export type Parameter
|
|
338
|
-
= TypedParameter
|
|
339
|
-
| UntypedParameter
|
|
340
|
-
;
|
|
301
|
+
export type Parameter = TypedParameter | UntypedParameter;
|
|
341
302
|
|
|
342
303
|
/**
|
|
343
304
|
* TypeParameter
|
|
344
305
|
*/
|
|
345
306
|
export class TypedParameter {
|
|
307
|
+
type = "typed-parameter";
|
|
346
308
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
public location: Location) { }
|
|
353
|
-
|
|
309
|
+
constructor(
|
|
310
|
+
public id: UnqualifiedIdentifier,
|
|
311
|
+
public hint: Type,
|
|
312
|
+
public location: Location,
|
|
313
|
+
) {}
|
|
354
314
|
}
|
|
355
315
|
|
|
356
316
|
export class UntypedParameter {
|
|
317
|
+
type = "untyped-parameter";
|
|
357
318
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
public location: Location) { }
|
|
363
|
-
|
|
319
|
+
constructor(
|
|
320
|
+
public id: UnqualifiedIdentifier,
|
|
321
|
+
public location: Location,
|
|
322
|
+
) {}
|
|
364
323
|
}
|
|
365
324
|
|
|
366
|
-
export type Child
|
|
367
|
-
= Tag
|
|
368
|
-
| Interpolation
|
|
369
|
-
| Control
|
|
370
|
-
| Characters
|
|
371
|
-
| Identifier
|
|
372
|
-
;
|
|
325
|
+
export type Child = Tag | Interpolation | Control | Characters | Identifier;
|
|
373
326
|
|
|
374
|
-
export type Tag
|
|
375
|
-
= Node
|
|
376
|
-
| Widget
|
|
377
|
-
;
|
|
327
|
+
export type Tag = Node | Widget;
|
|
378
328
|
|
|
379
329
|
export class Node {
|
|
330
|
+
type = "node";
|
|
380
331
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
public close: Identifier) { }
|
|
388
|
-
|
|
332
|
+
constructor(
|
|
333
|
+
public open: Identifier,
|
|
334
|
+
public attributes: Attribute[],
|
|
335
|
+
public children: Child[],
|
|
336
|
+
public close: Identifier,
|
|
337
|
+
) {}
|
|
389
338
|
}
|
|
390
339
|
|
|
391
340
|
export class Widget {
|
|
341
|
+
type = "widget";
|
|
392
342
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
public close: Constructor) { }
|
|
401
|
-
|
|
343
|
+
constructor(
|
|
344
|
+
public open: Constructor,
|
|
345
|
+
public typeArgs: Type[],
|
|
346
|
+
public attributes: Attribute[],
|
|
347
|
+
public children: Child[],
|
|
348
|
+
public close: Constructor,
|
|
349
|
+
) {}
|
|
402
350
|
}
|
|
403
351
|
|
|
404
352
|
export class Attribute {
|
|
353
|
+
type = "attribute";
|
|
405
354
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
public location: Location) { }
|
|
413
|
-
|
|
355
|
+
constructor(
|
|
356
|
+
public namespace: UnqualifiedIdentifier,
|
|
357
|
+
public name: UnqualifiedIdentifier,
|
|
358
|
+
public value: AttributeValue,
|
|
359
|
+
public location: Location,
|
|
360
|
+
) {}
|
|
414
361
|
}
|
|
415
362
|
|
|
416
|
-
export type AttributeValue
|
|
417
|
-
= Interpolation
|
|
418
|
-
| Literal
|
|
419
|
-
;
|
|
363
|
+
export type AttributeValue = Interpolation | Literal;
|
|
420
364
|
|
|
421
365
|
export class Interpolation {
|
|
366
|
+
type = "interpolation";
|
|
422
367
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
public location: Location) { }
|
|
429
|
-
|
|
368
|
+
constructor(
|
|
369
|
+
public expression: Expression,
|
|
370
|
+
public filters: Expression[],
|
|
371
|
+
public location: Location,
|
|
372
|
+
) {}
|
|
430
373
|
}
|
|
431
374
|
|
|
432
|
-
export type Control
|
|
433
|
-
= ForStatement
|
|
434
|
-
| IfStatement
|
|
435
|
-
;
|
|
436
|
-
|
|
437
|
-
export type ForStatement
|
|
438
|
-
= ForInStatement
|
|
439
|
-
| ForOfStatement
|
|
440
|
-
| ForFromStatement
|
|
441
|
-
;
|
|
442
|
-
|
|
443
|
-
export class ForInStatement {
|
|
375
|
+
export type Control = ForStatement | IfStatement;
|
|
444
376
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
constructor(
|
|
448
|
-
public variables: Parameter[],
|
|
449
|
-
public expression: Expression,
|
|
450
|
-
public body: Child[],
|
|
451
|
-
public otherwise: Child[],
|
|
452
|
-
public location: Location) { }
|
|
377
|
+
export abstract class ForStatement {
|
|
378
|
+
abstract type: string;
|
|
453
379
|
|
|
380
|
+
constructor(
|
|
381
|
+
public body: Child[],
|
|
382
|
+
public otherwise: Child[],
|
|
383
|
+
public location: Location,
|
|
384
|
+
) {}
|
|
454
385
|
}
|
|
455
386
|
|
|
456
|
-
export class
|
|
457
|
-
|
|
458
|
-
type = 'for-of-statement';
|
|
459
|
-
|
|
460
|
-
constructor(
|
|
461
|
-
public variables: Parameter[],
|
|
462
|
-
public expression: Expression,
|
|
463
|
-
public body: Child[],
|
|
464
|
-
public otherwise: Child[],
|
|
465
|
-
public location: Location) { }
|
|
387
|
+
export class ForInStatement extends ForStatement {
|
|
388
|
+
type = "for-in-statement";
|
|
466
389
|
|
|
390
|
+
constructor(
|
|
391
|
+
public variables: Parameter[],
|
|
392
|
+
public expression: Expression,
|
|
393
|
+
public body: Child[],
|
|
394
|
+
public otherwise: Child[],
|
|
395
|
+
public location: Location,
|
|
396
|
+
) {
|
|
397
|
+
super(body, otherwise, location);
|
|
398
|
+
}
|
|
467
399
|
}
|
|
468
400
|
|
|
469
|
-
export class
|
|
401
|
+
export class ForOfStatement extends ForStatement {
|
|
402
|
+
type = "for-of-statement";
|
|
470
403
|
|
|
471
|
-
|
|
404
|
+
constructor(
|
|
405
|
+
public variables: Parameter[],
|
|
406
|
+
public expression: Expression,
|
|
407
|
+
public body: Child[],
|
|
408
|
+
public otherwise: Child[],
|
|
409
|
+
public location: Location,
|
|
410
|
+
) {
|
|
411
|
+
super(body, otherwise, location);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
472
414
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
public start: Expression,
|
|
476
|
-
public end: Expression,
|
|
477
|
-
public body: Child[],
|
|
478
|
-
public otherwise: Child[],
|
|
479
|
-
public location: Location) { }
|
|
415
|
+
export class ForFromStatement extends ForStatement {
|
|
416
|
+
type = "for-from-statement";
|
|
480
417
|
|
|
418
|
+
constructor(
|
|
419
|
+
public variable: UntypedParameter,
|
|
420
|
+
public start: Expression,
|
|
421
|
+
public end: Expression,
|
|
422
|
+
public body: Child[],
|
|
423
|
+
public otherwise: Child[],
|
|
424
|
+
public location: Location,
|
|
425
|
+
) {
|
|
426
|
+
super(body, otherwise, location);
|
|
427
|
+
}
|
|
481
428
|
}
|
|
482
429
|
|
|
483
430
|
export class IfStatement {
|
|
431
|
+
type = "if-statement";
|
|
484
432
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
public location: Location) { }
|
|
492
|
-
|
|
433
|
+
constructor(
|
|
434
|
+
public condition: Expression,
|
|
435
|
+
public then: Child[],
|
|
436
|
+
public elseClause: ElseIfClause | ElseClause | undefined,
|
|
437
|
+
public location: Location,
|
|
438
|
+
) {}
|
|
493
439
|
}
|
|
494
440
|
|
|
495
441
|
export class ElseClause {
|
|
442
|
+
type = "else-clause";
|
|
496
443
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
public location: Location) { }
|
|
502
|
-
|
|
444
|
+
constructor(
|
|
445
|
+
public children: Child[],
|
|
446
|
+
public location: Location,
|
|
447
|
+
) {}
|
|
503
448
|
}
|
|
504
449
|
|
|
505
450
|
export class ElseIfClause {
|
|
451
|
+
type = "else-if-clause";
|
|
506
452
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
public location: Location) { }
|
|
514
|
-
|
|
453
|
+
constructor(
|
|
454
|
+
public condition: Expression,
|
|
455
|
+
public then: Child[],
|
|
456
|
+
public elseClause: ElseClause | ElseIfClause | undefined,
|
|
457
|
+
public location: Location,
|
|
458
|
+
) {}
|
|
515
459
|
}
|
|
516
460
|
|
|
517
461
|
export class Characters {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
| ContextVariable
|
|
543
|
-
;
|
|
462
|
+
type = "characters";
|
|
463
|
+
|
|
464
|
+
constructor(
|
|
465
|
+
public value: string,
|
|
466
|
+
public location: Location,
|
|
467
|
+
) {}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export type Expression =
|
|
471
|
+
| IfThenExpression
|
|
472
|
+
| BinaryExpression
|
|
473
|
+
| UnaryExpression
|
|
474
|
+
| ViewConstruction
|
|
475
|
+
| FunApplication
|
|
476
|
+
| ConstructExpression
|
|
477
|
+
| CallExpression
|
|
478
|
+
| MemberExpression
|
|
479
|
+
| ReadExpression
|
|
480
|
+
| FunctionExpression
|
|
481
|
+
| Literal
|
|
482
|
+
| ContextProperty
|
|
483
|
+
| Constructor
|
|
484
|
+
| Identifier
|
|
485
|
+
| ContextVariable;
|
|
544
486
|
|
|
545
487
|
export class IfThenExpression {
|
|
488
|
+
type = "if-then-expression";
|
|
546
489
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
public location: Location) { }
|
|
554
|
-
|
|
490
|
+
constructor(
|
|
491
|
+
public condition: Expression,
|
|
492
|
+
public iftrue: Expression,
|
|
493
|
+
public iffalse: Expression,
|
|
494
|
+
public location: Location,
|
|
495
|
+
) {}
|
|
555
496
|
}
|
|
556
497
|
|
|
557
498
|
export class BinaryExpression {
|
|
499
|
+
type = "binary-expression";
|
|
558
500
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
public location: Location) { }
|
|
566
|
-
|
|
501
|
+
constructor(
|
|
502
|
+
public left: Expression,
|
|
503
|
+
public operator: string,
|
|
504
|
+
public right: Expression | Type,
|
|
505
|
+
public location: Location,
|
|
506
|
+
) {}
|
|
567
507
|
}
|
|
568
508
|
|
|
569
509
|
export class UnaryExpression {
|
|
510
|
+
type = "unary-expression";
|
|
570
511
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
public expression: Expression) { }
|
|
576
|
-
|
|
512
|
+
constructor(
|
|
513
|
+
public operator: string,
|
|
514
|
+
public expression: Expression,
|
|
515
|
+
) {}
|
|
577
516
|
}
|
|
578
517
|
|
|
579
518
|
export class ViewConstruction {
|
|
519
|
+
type = "view-construction";
|
|
580
520
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
public location: Location) { }
|
|
586
|
-
|
|
521
|
+
constructor(
|
|
522
|
+
public expression: Expression,
|
|
523
|
+
public location: Location,
|
|
524
|
+
) {}
|
|
587
525
|
}
|
|
588
526
|
|
|
589
527
|
export class FunApplication {
|
|
528
|
+
type = "fun-application";
|
|
590
529
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
public location: Location) { }
|
|
598
|
-
|
|
530
|
+
constructor(
|
|
531
|
+
public target: Expression,
|
|
532
|
+
public typeArgs: Type[],
|
|
533
|
+
public args: Expression[],
|
|
534
|
+
public location: Location,
|
|
535
|
+
) {}
|
|
599
536
|
}
|
|
600
537
|
|
|
601
538
|
export class ConstructExpression {
|
|
539
|
+
type = "construct-expression";
|
|
602
540
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
public location: Location) { }
|
|
610
|
-
|
|
541
|
+
constructor(
|
|
542
|
+
public cons: Constructor,
|
|
543
|
+
public typeArgs: Type[],
|
|
544
|
+
public args: Expression[],
|
|
545
|
+
public location: Location,
|
|
546
|
+
) {}
|
|
611
547
|
}
|
|
612
548
|
|
|
613
549
|
export class CallExpression {
|
|
550
|
+
type = "call-expression";
|
|
614
551
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
public location: Location) { }
|
|
622
|
-
|
|
552
|
+
constructor(
|
|
553
|
+
public target: Expression,
|
|
554
|
+
public typeArgs: Type[],
|
|
555
|
+
public args: Expression[],
|
|
556
|
+
public location: Location,
|
|
557
|
+
) {}
|
|
623
558
|
}
|
|
624
559
|
|
|
625
560
|
/**
|
|
626
561
|
* MemberExpression
|
|
627
562
|
*/
|
|
628
563
|
export class MemberExpression {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
564
|
+
constructor(
|
|
565
|
+
public head: Expression,
|
|
566
|
+
public tail: UnqualifiedIdentifier | UnqualifiedConstructor | StringLiteral,
|
|
567
|
+
public location: Location,
|
|
568
|
+
) {}
|
|
635
569
|
}
|
|
636
570
|
|
|
637
571
|
export class ReadExpression {
|
|
572
|
+
type = "read-expression";
|
|
638
573
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
public location: Location) { }
|
|
647
|
-
|
|
574
|
+
constructor(
|
|
575
|
+
public target: Expression,
|
|
576
|
+
public path: Expression,
|
|
577
|
+
public hint: Type,
|
|
578
|
+
public defaults: Expression,
|
|
579
|
+
public location: Location,
|
|
580
|
+
) {}
|
|
648
581
|
}
|
|
649
582
|
|
|
650
583
|
export class FunctionExpression {
|
|
584
|
+
type = "function-expression";
|
|
651
585
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
public location: Location) { }
|
|
658
|
-
|
|
586
|
+
constructor(
|
|
587
|
+
public parameters: Parameter[],
|
|
588
|
+
public body: Expression,
|
|
589
|
+
public location: Location,
|
|
590
|
+
) {}
|
|
659
591
|
}
|
|
660
592
|
|
|
661
|
-
export type Literal
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
;
|
|
593
|
+
export type Literal =
|
|
594
|
+
| Record
|
|
595
|
+
| List
|
|
596
|
+
| StringLiteral
|
|
597
|
+
| NumberLiteral
|
|
598
|
+
| BooleanLiteral;
|
|
668
599
|
|
|
669
600
|
export class List {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
601
|
+
type = "list";
|
|
602
|
+
constructor(
|
|
603
|
+
public members: Expression[],
|
|
604
|
+
public location: Location,
|
|
605
|
+
) {}
|
|
676
606
|
}
|
|
677
607
|
|
|
678
608
|
export class Record {
|
|
609
|
+
type = "record";
|
|
679
610
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
public location: Location) { }
|
|
685
|
-
|
|
611
|
+
constructor(
|
|
612
|
+
public properties: Property[],
|
|
613
|
+
public location: Location,
|
|
614
|
+
) {}
|
|
686
615
|
}
|
|
687
616
|
|
|
688
617
|
export class Property {
|
|
618
|
+
type = "property";
|
|
689
619
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
public location: Location) { }
|
|
696
|
-
|
|
620
|
+
constructor(
|
|
621
|
+
public key: UnqualifiedIdentifier | StringLiteral,
|
|
622
|
+
public value: Expression,
|
|
623
|
+
public location: Location,
|
|
624
|
+
) {}
|
|
697
625
|
}
|
|
698
626
|
|
|
699
627
|
export class StringLiteral {
|
|
628
|
+
type = "string";
|
|
700
629
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
public location: Location) { }
|
|
706
|
-
|
|
630
|
+
constructor(
|
|
631
|
+
public value: string,
|
|
632
|
+
public location: Location,
|
|
633
|
+
) {}
|
|
707
634
|
}
|
|
708
635
|
|
|
709
636
|
export class NumberLiteral {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
637
|
+
type = "number-literal";
|
|
638
|
+
constructor(
|
|
639
|
+
public value: string,
|
|
640
|
+
public location: Location,
|
|
641
|
+
) {}
|
|
714
642
|
}
|
|
715
643
|
|
|
716
644
|
export class BooleanLiteral {
|
|
645
|
+
type = "boolean-literal";
|
|
717
646
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
647
|
+
constructor(
|
|
648
|
+
public value: boolean,
|
|
649
|
+
public location: Location,
|
|
650
|
+
) {}
|
|
722
651
|
}
|
|
723
652
|
|
|
724
653
|
export class ContextProperty {
|
|
654
|
+
type = "context-property";
|
|
725
655
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
public location: Location) { }
|
|
731
|
-
|
|
656
|
+
constructor(
|
|
657
|
+
public member: UnqualifiedIdentifier | StringLiteral,
|
|
658
|
+
public location: Location,
|
|
659
|
+
) {}
|
|
732
660
|
}
|
|
733
661
|
|
|
734
662
|
export class ContextVariable {
|
|
663
|
+
type = "context-variable";
|
|
735
664
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
constructor(public location: Location) { }
|
|
739
|
-
|
|
665
|
+
constructor(public location: Location) {}
|
|
740
666
|
}
|
|
741
667
|
|
|
742
|
-
export type Constructor
|
|
743
|
-
= UnqualifiedConstructor
|
|
744
|
-
| QualifiedConstructor
|
|
745
|
-
;
|
|
668
|
+
export type Constructor = UnqualifiedConstructor | QualifiedConstructor;
|
|
746
669
|
|
|
747
670
|
export class UnqualifiedConstructor {
|
|
671
|
+
type = "unqualified-constructor";
|
|
748
672
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
public location: Location) { }
|
|
754
|
-
|
|
673
|
+
constructor(
|
|
674
|
+
public value: string,
|
|
675
|
+
public location: Location,
|
|
676
|
+
) {}
|
|
755
677
|
}
|
|
756
678
|
|
|
757
679
|
export class QualifiedConstructor {
|
|
680
|
+
type = "qualified-constructor";
|
|
758
681
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
public location: Location) { }
|
|
765
|
-
|
|
682
|
+
constructor(
|
|
683
|
+
public qualifier: string,
|
|
684
|
+
public member: string,
|
|
685
|
+
public location: Location,
|
|
686
|
+
) {}
|
|
766
687
|
}
|
|
767
688
|
|
|
768
689
|
/**
|
|
769
690
|
* Identifier
|
|
770
691
|
*/
|
|
771
|
-
export type Identifier
|
|
772
|
-
= UnqualifiedIdentifier
|
|
773
|
-
| QualifiedIdentifier
|
|
774
|
-
;
|
|
692
|
+
export type Identifier = UnqualifiedIdentifier | QualifiedIdentifier;
|
|
775
693
|
|
|
776
694
|
export class UnqualifiedIdentifier {
|
|
695
|
+
type = "unqualified-identifier";
|
|
777
696
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
697
|
+
constructor(
|
|
698
|
+
public value: string,
|
|
699
|
+
public location: Location,
|
|
700
|
+
) {}
|
|
782
701
|
}
|
|
783
702
|
|
|
784
703
|
/**
|
|
785
704
|
* QualifiedIdentifier
|
|
786
705
|
*/
|
|
787
706
|
export class QualifiedIdentifier {
|
|
707
|
+
type = "qualified-identifier";
|
|
788
708
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
public location: Location) { }
|
|
795
|
-
|
|
709
|
+
constructor(
|
|
710
|
+
public qualifier: string,
|
|
711
|
+
public member: string,
|
|
712
|
+
public location: Location,
|
|
713
|
+
) {}
|
|
796
714
|
}
|