@ohm-js/wasm 0.1.0 → 0.2.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/README.md +27 -0
- package/dist/cli.js +51 -0
- package/dist/index.js +2189 -0
- package/package.json +15 -8
- package/.mise.toml +0 -2
- package/AGENT.md +0 -25
- package/Makefile +0 -23
- package/TODO.md +0 -28
- package/runtime/ohmRuntime.ts +0 -252
- package/scripts/bundlewasm.ts +0 -49
- package/scripts/modparse.ts +0 -397
- package/src/cli.js +0 -36
- package/src/index.js +0 -1195
- package/test/data/_book-review.liquid +0 -257
- package/test/data/_es5.js +0 -1057
- package/test/data/_es5.wasm +0 -0
- package/test/data/_html5shiv-3.7.3.js +0 -326
- package/test/data/_liquid-html.ohm +0 -605
- package/test/go/README.md +0 -67
- package/test/go/cst.go +0 -164
- package/test/go/go.mod +0 -5
- package/test/go/go.sum +0 -2
- package/test/go/matcher.go +0 -370
- package/test/go/testmain.go +0 -161
- package/test/test-es5.js +0 -104
- package/test/test-liquid-html.js +0 -27
- package/test/test-wasm.js +0 -764
package/test/data/_es5.js
DELETED
|
@@ -1,1057 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Exports a function which is a factory for ES5 parsers.
|
|
3
|
-
Based on https://github.com/ohmjs/sle17 with minor modifications.
|
|
4
|
-
*/
|
|
5
|
-
const fac = async ns => {
|
|
6
|
-
// Combinators for instantiating the various PExp subclasses.
|
|
7
|
-
const _ = value => new ns.Terminal(value);
|
|
8
|
-
const app = ruleName => new ns.RuleApplication(ruleName);
|
|
9
|
-
const seq = (...exps) => new ns.Sequence(exps);
|
|
10
|
-
const choice = (...exps) => new ns.Choice(exps);
|
|
11
|
-
const rep = exp => new ns.Repetition(exp);
|
|
12
|
-
const not = exp => new ns.Not(exp);
|
|
13
|
-
const lookahead = exp => not(not(exp));
|
|
14
|
-
const range = (start, end) => new ns.Range(start, end);
|
|
15
|
-
|
|
16
|
-
const lexIgnored = exp => exp;
|
|
17
|
-
|
|
18
|
-
return new ns.Matcher({
|
|
19
|
-
start: app('program'),
|
|
20
|
-
// any: range('\u0000', '\uFFFF'),
|
|
21
|
-
any: ns.any,
|
|
22
|
-
// end: not(app('any')),
|
|
23
|
-
end: ns.end,
|
|
24
|
-
program: seq(lookahead(rep(app('directive'))), rep(app('sourceElement')), app('spaces')),
|
|
25
|
-
sourceCharacter: app('any'),
|
|
26
|
-
space: choice(app('whitespace'), app('lineTerminator'), app('comment')),
|
|
27
|
-
spaces: rep(app('space')),
|
|
28
|
-
whitespace: choice(
|
|
29
|
-
_('\t'),
|
|
30
|
-
_('\x0B'),
|
|
31
|
-
_('\x0C'),
|
|
32
|
-
_(' '),
|
|
33
|
-
_('\u00A0'),
|
|
34
|
-
_('\uFEFF'),
|
|
35
|
-
app('unicodeSpaceSeparator'),
|
|
36
|
-
),
|
|
37
|
-
lineTerminator: choice(_('\n'), _('\r'), _('\u2028'), _('\u2029')),
|
|
38
|
-
lineTerminatorSequence: choice(
|
|
39
|
-
_('\n'),
|
|
40
|
-
seq(_('\r'), not(_('\n'))),
|
|
41
|
-
_('\u2028'),
|
|
42
|
-
_('\u2029'),
|
|
43
|
-
_('\r\n'),
|
|
44
|
-
),
|
|
45
|
-
comment: choice(app('multiLineComment'), app('singleLineComment')),
|
|
46
|
-
multiLineComment: seq(_('/*'), rep(seq(not(_('*/')), app('sourceCharacter'))), _('*/')),
|
|
47
|
-
singleLineComment: seq(
|
|
48
|
-
_('//'),
|
|
49
|
-
rep(seq(not(app('lineTerminator')), app('sourceCharacter'))),
|
|
50
|
-
),
|
|
51
|
-
identifier: seq(not(app('reservedWord')), app('identifierName')),
|
|
52
|
-
identifierName: seq(app('identifierStart'), rep(app('identifierPart'))),
|
|
53
|
-
identifierStart: choice(
|
|
54
|
-
app('letter'),
|
|
55
|
-
_('$'),
|
|
56
|
-
_('_'),
|
|
57
|
-
seq(_('\\'), app('unicodeEscapeSequence')),
|
|
58
|
-
),
|
|
59
|
-
identifierPart: choice(
|
|
60
|
-
app('identifierStart'),
|
|
61
|
-
app('unicodeCombiningMark'),
|
|
62
|
-
app('unicodeDigit'),
|
|
63
|
-
app('unicodeConnectorPunctuation'),
|
|
64
|
-
_('\u200C'),
|
|
65
|
-
_('\u200D'),
|
|
66
|
-
),
|
|
67
|
-
letter: choice(
|
|
68
|
-
range('a', 'z'),
|
|
69
|
-
range('A', 'Z'),
|
|
70
|
-
range('À', 'ÿ'),
|
|
71
|
-
app('unicodeCategoryNl'),
|
|
72
|
-
),
|
|
73
|
-
unicodeCategoryNl: choice(
|
|
74
|
-
range('\u2160', '\u2182'),
|
|
75
|
-
_('\u3007'),
|
|
76
|
-
range('\u3021', '\u3029'),
|
|
77
|
-
),
|
|
78
|
-
unicodeDigit: choice(
|
|
79
|
-
range('\u0030', '\u0039'),
|
|
80
|
-
range('\u0660', '\u0669'),
|
|
81
|
-
range('\u06F0', '\u06F9'),
|
|
82
|
-
range('\u0966', '\u096F'),
|
|
83
|
-
range('\u09E6', '\u09EF'),
|
|
84
|
-
range('\u0A66', '\u0A6F'),
|
|
85
|
-
range('\u0AE6', '\u0AEF'),
|
|
86
|
-
range('\u0B66', '\u0B6F'),
|
|
87
|
-
range('\u0BE7', '\u0BEF'),
|
|
88
|
-
range('\u0C66', '\u0C6F'),
|
|
89
|
-
range('\u0CE6', '\u0CEF'),
|
|
90
|
-
range('\u0D66', '\u0D6F'),
|
|
91
|
-
range('\u0E50', '\u0E59'),
|
|
92
|
-
range('\u0ED0', '\u0ED9'),
|
|
93
|
-
range('\u0F20', '\u0F29'),
|
|
94
|
-
range('\uFF10', '\uFF19'),
|
|
95
|
-
),
|
|
96
|
-
unicodeCombiningMark: choice(
|
|
97
|
-
range('\u0300', '\u0345'),
|
|
98
|
-
range('\u0360', '\u0361'),
|
|
99
|
-
range('\u0483', '\u0486'),
|
|
100
|
-
range('\u0591', '\u05A1'),
|
|
101
|
-
range('\u05A3', '\u05B9'),
|
|
102
|
-
range('\u05BB', '\u05BD'),
|
|
103
|
-
range('\u05BF', '\u05BF'),
|
|
104
|
-
range('\u05C1', '\u05C2'),
|
|
105
|
-
range('\u05C4', '\u05C4'),
|
|
106
|
-
range('\u064B', '\u0652'),
|
|
107
|
-
range('\u0670', '\u0670'),
|
|
108
|
-
range('\u06D6', '\u06DC'),
|
|
109
|
-
range('\u06DF', '\u06E4'),
|
|
110
|
-
range('\u06E7', '\u06E8'),
|
|
111
|
-
range('\u06EA', '\u06ED'),
|
|
112
|
-
range('\u0901', '\u0902'),
|
|
113
|
-
range('\u093C', '\u093C'),
|
|
114
|
-
range('\u0941', '\u0948'),
|
|
115
|
-
range('\u094D', '\u094D'),
|
|
116
|
-
range('\u0951', '\u0954'),
|
|
117
|
-
range('\u0962', '\u0963'),
|
|
118
|
-
range('\u0981', '\u0981'),
|
|
119
|
-
range('\u09BC', '\u09BC'),
|
|
120
|
-
range('\u09C1', '\u09C4'),
|
|
121
|
-
range('\u09CD', '\u09CD'),
|
|
122
|
-
range('\u09E2', '\u09E3'),
|
|
123
|
-
range('\u0A02', '\u0A02'),
|
|
124
|
-
range('\u0A3C', '\u0A3C'),
|
|
125
|
-
range('\u0A41', '\u0A42'),
|
|
126
|
-
range('\u0A47', '\u0A48'),
|
|
127
|
-
range('\u0A4B', '\u0A4D'),
|
|
128
|
-
range('\u0A70', '\u0A71'),
|
|
129
|
-
range('\u0A81', '\u0A82'),
|
|
130
|
-
range('\u0ABC', '\u0ABC'),
|
|
131
|
-
range('\u0AC1', '\u0AC5'),
|
|
132
|
-
range('\u0AC7', '\u0AC8'),
|
|
133
|
-
range('\u0ACD', '\u0ACD'),
|
|
134
|
-
range('\u0B01', '\u0B01'),
|
|
135
|
-
range('\u0B3C', '\u0B3C'),
|
|
136
|
-
range('\u0B3F', '\u0B3F'),
|
|
137
|
-
range('\u0B41', '\u0B43'),
|
|
138
|
-
range('\u0B4D', '\u0B4D'),
|
|
139
|
-
range('\u0B56', '\u0B56'),
|
|
140
|
-
range('\u0B82', '\u0B82'),
|
|
141
|
-
range('\u0BC0', '\u0BC0'),
|
|
142
|
-
range('\u0BCD', '\u0BCD'),
|
|
143
|
-
range('\u0C3E', '\u0C40'),
|
|
144
|
-
range('\u0C46', '\u0C48'),
|
|
145
|
-
range('\u0C4A', '\u0C4D'),
|
|
146
|
-
range('\u0C55', '\u0C56'),
|
|
147
|
-
range('\u0CBF', '\u0CBF'),
|
|
148
|
-
range('\u0CC6', '\u0CC6'),
|
|
149
|
-
range('\u0CCC', '\u0CCD'),
|
|
150
|
-
range('\u0D41', '\u0D43'),
|
|
151
|
-
range('\u0D4D', '\u0D4D'),
|
|
152
|
-
range('\u0E31', '\u0E31'),
|
|
153
|
-
range('\u0E34', '\u0E3A'),
|
|
154
|
-
range('\u0E47', '\u0E4E'),
|
|
155
|
-
range('\u0EB1', '\u0EB1'),
|
|
156
|
-
range('\u0EB4', '\u0EB9'),
|
|
157
|
-
range('\u0EBB', '\u0EBC'),
|
|
158
|
-
range('\u0EC8', '\u0ECD'),
|
|
159
|
-
range('\u0F18', '\u0F19'),
|
|
160
|
-
range('\u0F35', '\u0F35'),
|
|
161
|
-
range('\u0F37', '\u0F37'),
|
|
162
|
-
range('\u0F39', '\u0F39'),
|
|
163
|
-
range('\u0F71', '\u0F7E'),
|
|
164
|
-
range('\u0F80', '\u0F84'),
|
|
165
|
-
range('\u0F86', '\u0F87'),
|
|
166
|
-
range('\u0F90', '\u0F95'),
|
|
167
|
-
range('\u0F97', '\u0F97'),
|
|
168
|
-
range('\u0F99', '\u0FAD'),
|
|
169
|
-
range('\u0FB1', '\u0FB7'),
|
|
170
|
-
range('\u0FB9', '\u0FB9'),
|
|
171
|
-
range('\u20D0', '\u20DC'),
|
|
172
|
-
range('\u20E1', '\u20E1'),
|
|
173
|
-
range('\u302A', '\u302F'),
|
|
174
|
-
range('\u3099', '\u309A'),
|
|
175
|
-
range('\uFB1E', '\uFB1E'),
|
|
176
|
-
range('\uFE20', '\uFE23'),
|
|
177
|
-
),
|
|
178
|
-
unicodeConnectorPunctuation: choice(
|
|
179
|
-
_('\u005F'),
|
|
180
|
-
range('\u203F', '\u2040'),
|
|
181
|
-
_('\u30FB'),
|
|
182
|
-
range('\uFE33', '\uFE34'),
|
|
183
|
-
range('\uFE4D', '\uFE4F'),
|
|
184
|
-
_('\uFF3F'),
|
|
185
|
-
_('\uFF65'),
|
|
186
|
-
),
|
|
187
|
-
unicodeSpaceSeparator: choice(range('\u2000', '\u200B'), _('\u3000')),
|
|
188
|
-
reservedWord: choice(
|
|
189
|
-
app('keyword'),
|
|
190
|
-
app('futureReservedWord'),
|
|
191
|
-
app('nullLiteral'),
|
|
192
|
-
app('booleanLiteral'),
|
|
193
|
-
),
|
|
194
|
-
keyword: choice(
|
|
195
|
-
app('break'),
|
|
196
|
-
app('do'),
|
|
197
|
-
app('instanceof'),
|
|
198
|
-
app('typeof'),
|
|
199
|
-
app('case'),
|
|
200
|
-
app('else'),
|
|
201
|
-
app('new'),
|
|
202
|
-
app('var'),
|
|
203
|
-
app('catch'),
|
|
204
|
-
app('finally'),
|
|
205
|
-
app('return'),
|
|
206
|
-
app('void'),
|
|
207
|
-
app('continue'),
|
|
208
|
-
app('for'),
|
|
209
|
-
app('switch'),
|
|
210
|
-
app('while'),
|
|
211
|
-
app('debugger'),
|
|
212
|
-
app('function'),
|
|
213
|
-
app('this'),
|
|
214
|
-
app('with'),
|
|
215
|
-
app('default'),
|
|
216
|
-
app('if'),
|
|
217
|
-
app('throw'),
|
|
218
|
-
app('delete'),
|
|
219
|
-
app('in'),
|
|
220
|
-
app('try'),
|
|
221
|
-
),
|
|
222
|
-
futureReservedWordLax: choice(
|
|
223
|
-
app('class'),
|
|
224
|
-
app('enum'),
|
|
225
|
-
app('extends'),
|
|
226
|
-
app('super'),
|
|
227
|
-
app('const'),
|
|
228
|
-
app('export'),
|
|
229
|
-
app('import'),
|
|
230
|
-
),
|
|
231
|
-
futureReservedWordStrict: choice(
|
|
232
|
-
app('futureReservedWordLax'),
|
|
233
|
-
app('implements'),
|
|
234
|
-
app('let'),
|
|
235
|
-
app('private'),
|
|
236
|
-
app('public'),
|
|
237
|
-
app('interface'),
|
|
238
|
-
app('package'),
|
|
239
|
-
app('protected'),
|
|
240
|
-
app('static'),
|
|
241
|
-
app('yield'),
|
|
242
|
-
),
|
|
243
|
-
futureReservedWord: app('futureReservedWordStrict'),
|
|
244
|
-
literal: choice(
|
|
245
|
-
app('nullLiteral'),
|
|
246
|
-
app('booleanLiteral'),
|
|
247
|
-
app('numericLiteral'),
|
|
248
|
-
app('stringLiteral'),
|
|
249
|
-
app('regularExpressionLiteral'),
|
|
250
|
-
),
|
|
251
|
-
nullLiteral: seq(_('null'), not(app('identifierPart'))),
|
|
252
|
-
booleanLiteral: seq(choice(_('true'), _('false')), not(app('identifierPart'))),
|
|
253
|
-
numericLiteral: choice(
|
|
254
|
-
app('octalIntegerLiteral'),
|
|
255
|
-
app('hexIntegerLiteral'),
|
|
256
|
-
app('decimalLiteral'),
|
|
257
|
-
),
|
|
258
|
-
decimalLiteral: choice(
|
|
259
|
-
seq(app('decimalIntegerLiteral'), _('.'), rep(app('decimalDigit')), app('exponentPart')),
|
|
260
|
-
seq(_('.'), seq(app('decimalDigit'), rep(app('decimalDigit'))), app('exponentPart')),
|
|
261
|
-
seq(app('decimalIntegerLiteral'), app('exponentPart')),
|
|
262
|
-
),
|
|
263
|
-
decimalIntegerLiteral: choice(seq(app('nonZeroDigit'), rep(app('decimalDigit'))), _('0')),
|
|
264
|
-
decimalDigit: range('0', '9'),
|
|
265
|
-
nonZeroDigit: range('1', '9'),
|
|
266
|
-
exponentPart: choice(seq(app('exponentIndicator'), app('signedInteger')), seq()),
|
|
267
|
-
exponentIndicator: choice(_('e'), _('E')),
|
|
268
|
-
signedInteger: choice(
|
|
269
|
-
seq(_('+'), rep(app('decimalDigit'))),
|
|
270
|
-
seq(_('-'), rep(app('decimalDigit'))),
|
|
271
|
-
seq(app('decimalDigit'), rep(app('decimalDigit'))),
|
|
272
|
-
),
|
|
273
|
-
hexIntegerLiteral: choice(
|
|
274
|
-
seq(_('0x'), seq(app('hexDigit'), rep(app('hexDigit')))),
|
|
275
|
-
seq(_('0X'), seq(app('hexDigit'), rep(app('hexDigit')))),
|
|
276
|
-
),
|
|
277
|
-
hexDigit: choice(range('0', '9'), range('a', 'f'), range('A', 'F')),
|
|
278
|
-
octalIntegerLiteral: seq(_('0'), seq(app('octalDigit'), rep(app('octalDigit')))),
|
|
279
|
-
octalDigit: range('0', '7'),
|
|
280
|
-
stringLiteral: choice(
|
|
281
|
-
seq(_('"'), rep(app('doubleStringCharacter')), _('"')),
|
|
282
|
-
seq(_("'"), rep(app('singleStringCharacter')), _("'")),
|
|
283
|
-
),
|
|
284
|
-
doubleStringCharacter: choice(
|
|
285
|
-
seq(not(choice(_('"'), _('\\'), app('lineTerminator'))), app('sourceCharacter')),
|
|
286
|
-
seq(_('\\'), app('escapeSequence')),
|
|
287
|
-
app('lineContinuation'),
|
|
288
|
-
),
|
|
289
|
-
singleStringCharacter: choice(
|
|
290
|
-
seq(not(choice(_("'"), _('\\'), app('lineTerminator'))), app('sourceCharacter')),
|
|
291
|
-
seq(_('\\'), app('escapeSequence')),
|
|
292
|
-
app('lineContinuation'),
|
|
293
|
-
),
|
|
294
|
-
lineContinuation: seq(_('\\'), app('lineTerminatorSequence')),
|
|
295
|
-
escapeSequence: choice(
|
|
296
|
-
app('unicodeEscapeSequence'),
|
|
297
|
-
app('hexEscapeSequence'),
|
|
298
|
-
app('octalEscapeSequence'),
|
|
299
|
-
app('characterEscapeSequence'),
|
|
300
|
-
),
|
|
301
|
-
characterEscapeSequence: choice(app('singleEscapeCharacter'), app('nonEscapeCharacter')),
|
|
302
|
-
singleEscapeCharacter: choice(
|
|
303
|
-
_("'"),
|
|
304
|
-
_('"'),
|
|
305
|
-
_('\\'),
|
|
306
|
-
_('b'),
|
|
307
|
-
_('f'),
|
|
308
|
-
_('n'),
|
|
309
|
-
_('r'),
|
|
310
|
-
_('t'),
|
|
311
|
-
_('v'),
|
|
312
|
-
),
|
|
313
|
-
nonEscapeCharacter: seq(
|
|
314
|
-
not(choice(app('escapeCharacter'), app('lineTerminator'))),
|
|
315
|
-
app('sourceCharacter'),
|
|
316
|
-
),
|
|
317
|
-
escapeCharacter: choice(app('singleEscapeCharacter'), app('decimalDigit'), _('x'), _('u')),
|
|
318
|
-
octalEscapeSequence: choice(
|
|
319
|
-
seq(app('zeroToThree'), app('octalDigit'), app('octalDigit')),
|
|
320
|
-
seq(app('fourToSeven'), app('octalDigit')),
|
|
321
|
-
seq(app('zeroToThree'), app('octalDigit'), not(app('decimalDigit'))),
|
|
322
|
-
seq(app('octalDigit'), not(app('decimalDigit'))),
|
|
323
|
-
),
|
|
324
|
-
hexEscapeSequence: seq(_('x'), app('hexDigit'), app('hexDigit')),
|
|
325
|
-
unicodeEscapeSequence: seq(
|
|
326
|
-
_('u'),
|
|
327
|
-
app('hexDigit'),
|
|
328
|
-
app('hexDigit'),
|
|
329
|
-
app('hexDigit'),
|
|
330
|
-
app('hexDigit'),
|
|
331
|
-
),
|
|
332
|
-
zeroToThree: range('0', '3'),
|
|
333
|
-
fourToSeven: range('4', '7'),
|
|
334
|
-
regularExpressionLiteral: seq(
|
|
335
|
-
_('/'),
|
|
336
|
-
app('regularExpressionBody'),
|
|
337
|
-
_('/'),
|
|
338
|
-
app('regularExpressionFlags'),
|
|
339
|
-
),
|
|
340
|
-
regularExpressionBody: seq(
|
|
341
|
-
app('regularExpressionFirstChar'),
|
|
342
|
-
rep(app('regularExpressionChar')),
|
|
343
|
-
),
|
|
344
|
-
regularExpressionFirstChar: choice(
|
|
345
|
-
seq(not(choice(_('*'), _('\\'), _('/'), _('['))), app('regularExpressionNonTerminator')),
|
|
346
|
-
app('regularExpressionBackslashSequence'),
|
|
347
|
-
app('regularExpressionClass'),
|
|
348
|
-
),
|
|
349
|
-
regularExpressionChar: choice(
|
|
350
|
-
seq(not(choice(_('\\'), _('/'), _('['))), app('regularExpressionNonTerminator')),
|
|
351
|
-
app('regularExpressionBackslashSequence'),
|
|
352
|
-
app('regularExpressionClass'),
|
|
353
|
-
),
|
|
354
|
-
regularExpressionBackslashSequence: seq(_('\\'), app('regularExpressionNonTerminator')),
|
|
355
|
-
regularExpressionNonTerminator: seq(not(app('lineTerminator')), app('sourceCharacter')),
|
|
356
|
-
regularExpressionClass: seq(_('['), rep(app('regularExpressionClassChar')), _(']')),
|
|
357
|
-
regularExpressionClassChar: choice(
|
|
358
|
-
seq(not(choice(_(']'), _('\\'))), app('regularExpressionNonTerminator')),
|
|
359
|
-
app('regularExpressionBackslashSequence'),
|
|
360
|
-
),
|
|
361
|
-
regularExpressionFlags: rep(app('identifierPart')),
|
|
362
|
-
multiLineCommentNoNL: seq(
|
|
363
|
-
_('/*'),
|
|
364
|
-
rep(seq(not(choice(_('*/'), app('lineTerminator'))), app('sourceCharacter'))),
|
|
365
|
-
_('*/'),
|
|
366
|
-
),
|
|
367
|
-
spacesNoNL: rep(
|
|
368
|
-
choice(app('whitespace'), app('singleLineComment'), app('multiLineCommentNoNL')),
|
|
369
|
-
),
|
|
370
|
-
sc: choice(
|
|
371
|
-
seq(rep(app('space')), choice(_(';'), app('end'))),
|
|
372
|
-
seq(
|
|
373
|
-
app('spacesNoNL'),
|
|
374
|
-
choice(
|
|
375
|
-
app('lineTerminator'),
|
|
376
|
-
seq(not(app('multiLineCommentNoNL')), app('multiLineComment')),
|
|
377
|
-
lookahead(_('}')),
|
|
378
|
-
),
|
|
379
|
-
),
|
|
380
|
-
),
|
|
381
|
-
break: seq(_('break'), not(app('identifierPart'))),
|
|
382
|
-
do: seq(_('do'), not(app('identifierPart'))),
|
|
383
|
-
instanceof: seq(_('instanceof'), not(app('identifierPart'))),
|
|
384
|
-
typeof: seq(_('typeof'), not(app('identifierPart'))),
|
|
385
|
-
case: seq(_('case'), not(app('identifierPart'))),
|
|
386
|
-
else: seq(_('else'), not(app('identifierPart'))),
|
|
387
|
-
new: seq(_('new'), not(app('identifierPart'))),
|
|
388
|
-
var: seq(_('var'), not(app('identifierPart'))),
|
|
389
|
-
catch: seq(_('catch'), not(app('identifierPart'))),
|
|
390
|
-
finally: seq(_('finally'), not(app('identifierPart'))),
|
|
391
|
-
return: seq(_('return'), not(app('identifierPart'))),
|
|
392
|
-
void: seq(_('void'), not(app('identifierPart'))),
|
|
393
|
-
continue: seq(_('continue'), not(app('identifierPart'))),
|
|
394
|
-
for: seq(_('for'), not(app('identifierPart'))),
|
|
395
|
-
switch: seq(_('switch'), not(app('identifierPart'))),
|
|
396
|
-
while: seq(_('while'), not(app('identifierPart'))),
|
|
397
|
-
debugger: seq(_('debugger'), not(app('identifierPart'))),
|
|
398
|
-
function: seq(_('function'), not(app('identifierPart'))),
|
|
399
|
-
this: seq(_('this'), not(app('identifierPart'))),
|
|
400
|
-
with: seq(_('with'), not(app('identifierPart'))),
|
|
401
|
-
default: seq(_('default'), not(app('identifierPart'))),
|
|
402
|
-
if: seq(_('if'), not(app('identifierPart'))),
|
|
403
|
-
throw: seq(_('throw'), not(app('identifierPart'))),
|
|
404
|
-
delete: seq(_('delete'), not(app('identifierPart'))),
|
|
405
|
-
in: seq(_('in'), not(app('identifierPart'))),
|
|
406
|
-
try: seq(_('try'), not(app('identifierPart'))),
|
|
407
|
-
get: seq(_('get'), not(app('identifierPart'))),
|
|
408
|
-
set: seq(_('set'), not(app('identifierPart'))),
|
|
409
|
-
class: seq(_('class'), not(app('identifierPart'))),
|
|
410
|
-
enum: seq(_('enum'), not(app('identifierPart'))),
|
|
411
|
-
extends: seq(_('extends'), not(app('identifierPart'))),
|
|
412
|
-
super: seq(_('super'), not(app('identifierPart'))),
|
|
413
|
-
const: seq(_('const'), not(app('identifierPart'))),
|
|
414
|
-
export: seq(_('export'), not(app('identifierPart'))),
|
|
415
|
-
import: seq(_('import'), not(app('identifierPart'))),
|
|
416
|
-
implements: seq(_('implements'), not(app('identifierPart'))),
|
|
417
|
-
let: seq(_('let'), not(app('identifierPart'))),
|
|
418
|
-
private: seq(_('private'), not(app('identifierPart'))),
|
|
419
|
-
public: seq(_('public'), not(app('identifierPart'))),
|
|
420
|
-
interface: seq(_('interface'), not(app('identifierPart'))),
|
|
421
|
-
package: seq(_('package'), not(app('identifierPart'))),
|
|
422
|
-
protected: seq(_('protected'), not(app('identifierPart'))),
|
|
423
|
-
static: seq(_('static'), not(app('identifierPart'))),
|
|
424
|
-
yield: seq(_('yield'), not(app('identifierPart'))),
|
|
425
|
-
primaryExpression: choice(
|
|
426
|
-
seq(app('spaces'), app('this')),
|
|
427
|
-
seq(app('spaces'), app('identifier')),
|
|
428
|
-
seq(app('spaces'), app('literal')),
|
|
429
|
-
app('arrayLiteral'),
|
|
430
|
-
app('objectLiteral'),
|
|
431
|
-
seq(app('spaces'), _('('), app('expression'), app('spaces'), _(')')),
|
|
432
|
-
),
|
|
433
|
-
arrayLiteral: choice(
|
|
434
|
-
seq(
|
|
435
|
-
app('spaces'),
|
|
436
|
-
_('['),
|
|
437
|
-
app('assignmentExpressionOrElision'),
|
|
438
|
-
rep(seq(app('spaces'), _(','), app('assignmentExpressionOrElision'))),
|
|
439
|
-
app('spaces'),
|
|
440
|
-
_(']'),
|
|
441
|
-
),
|
|
442
|
-
seq(app('spaces'), _('['), app('spaces'), _(']')),
|
|
443
|
-
),
|
|
444
|
-
assignmentExpressionOrElision: choice(app('assignmentExpression'), seq()),
|
|
445
|
-
objectLiteral: choice(
|
|
446
|
-
seq(
|
|
447
|
-
app('spaces'),
|
|
448
|
-
_('{'),
|
|
449
|
-
app('propertyAssignment'),
|
|
450
|
-
rep(seq(app('spaces'), _(','), app('propertyAssignment'))),
|
|
451
|
-
app('spaces'),
|
|
452
|
-
_('}'),
|
|
453
|
-
),
|
|
454
|
-
seq(app('spaces'), _('{'), app('spaces'), _('}')),
|
|
455
|
-
seq(
|
|
456
|
-
app('spaces'),
|
|
457
|
-
_('{'),
|
|
458
|
-
app('propertyAssignment'),
|
|
459
|
-
rep(seq(app('spaces'), _(','), app('propertyAssignment'))),
|
|
460
|
-
app('spaces'),
|
|
461
|
-
_(','),
|
|
462
|
-
app('spaces'),
|
|
463
|
-
_('}'),
|
|
464
|
-
),
|
|
465
|
-
),
|
|
466
|
-
propertyAssignment: choice(
|
|
467
|
-
seq(
|
|
468
|
-
app('spaces'),
|
|
469
|
-
app('get'),
|
|
470
|
-
app('propertyName'),
|
|
471
|
-
app('spaces'),
|
|
472
|
-
_('('),
|
|
473
|
-
app('spaces'),
|
|
474
|
-
_(')'),
|
|
475
|
-
app('spaces'),
|
|
476
|
-
_('{'),
|
|
477
|
-
app('functionBody'),
|
|
478
|
-
app('spaces'),
|
|
479
|
-
_('}'),
|
|
480
|
-
),
|
|
481
|
-
seq(
|
|
482
|
-
app('spaces'),
|
|
483
|
-
app('set'),
|
|
484
|
-
app('propertyName'),
|
|
485
|
-
app('spaces'),
|
|
486
|
-
_('('),
|
|
487
|
-
app('formalParameter'),
|
|
488
|
-
app('spaces'),
|
|
489
|
-
_(')'),
|
|
490
|
-
app('spaces'),
|
|
491
|
-
_('{'),
|
|
492
|
-
app('functionBody'),
|
|
493
|
-
app('spaces'),
|
|
494
|
-
_('}'),
|
|
495
|
-
),
|
|
496
|
-
seq(app('propertyName'), app('spaces'), _(':'), app('assignmentExpression')),
|
|
497
|
-
),
|
|
498
|
-
propertyName: choice(
|
|
499
|
-
seq(app('spaces'), app('identifierName')),
|
|
500
|
-
seq(app('spaces'), app('stringLiteral')),
|
|
501
|
-
seq(app('spaces'), app('numericLiteral')),
|
|
502
|
-
),
|
|
503
|
-
memberExpression: seq(app('memberExpressionHead'), rep(app('memberExpressionTail'))),
|
|
504
|
-
memberExpressionHead: choice(
|
|
505
|
-
seq(app('spaces'), app('new'), app('memberExpression'), app('arguments')),
|
|
506
|
-
app('primaryExpression'),
|
|
507
|
-
app('functionExpression'),
|
|
508
|
-
),
|
|
509
|
-
memberExpressionTail: choice(
|
|
510
|
-
seq(app('spaces'), _('['), app('expression'), app('spaces'), _(']')),
|
|
511
|
-
seq(app('spaces'), _('.'), app('spaces'), app('identifierName')),
|
|
512
|
-
),
|
|
513
|
-
newExpression: choice(
|
|
514
|
-
app('memberExpression'),
|
|
515
|
-
seq(app('spaces'), app('new'), app('newExpression')),
|
|
516
|
-
),
|
|
517
|
-
callExpression: seq(app('memberExpression'), rep(app('callExpressionTail'))),
|
|
518
|
-
callExpressionTail: choice(
|
|
519
|
-
app('arguments'),
|
|
520
|
-
seq(app('spaces'), _('['), app('expression'), app('spaces'), _(']')),
|
|
521
|
-
seq(app('spaces'), _('.'), app('spaces'), app('identifierName')),
|
|
522
|
-
),
|
|
523
|
-
arguments: choice(
|
|
524
|
-
seq(
|
|
525
|
-
app('spaces'),
|
|
526
|
-
_('('),
|
|
527
|
-
app('assignmentExpression'),
|
|
528
|
-
rep(seq(app('spaces'), _(','), app('assignmentExpression'))),
|
|
529
|
-
app('spaces'),
|
|
530
|
-
_(')'),
|
|
531
|
-
),
|
|
532
|
-
seq(app('spaces'), _('('), app('spaces'), _(')')),
|
|
533
|
-
),
|
|
534
|
-
leftHandSideExpression: choice(app('callExpression'), app('newExpression')),
|
|
535
|
-
postfixExpression: choice(
|
|
536
|
-
seq(app('leftHandSideExpression'), lexIgnored(seq(app('spacesNoNL'), _('++')))),
|
|
537
|
-
seq(app('leftHandSideExpression'), lexIgnored(seq(app('spacesNoNL'), _('--')))),
|
|
538
|
-
app('leftHandSideExpression'),
|
|
539
|
-
),
|
|
540
|
-
unaryExpression: choice(
|
|
541
|
-
seq(app('spaces'), app('delete'), app('unaryExpression')),
|
|
542
|
-
seq(app('spaces'), app('void'), app('unaryExpression')),
|
|
543
|
-
seq(app('spaces'), app('typeof'), app('unaryExpression')),
|
|
544
|
-
seq(app('spaces'), _('++'), app('unaryExpression')),
|
|
545
|
-
seq(app('spaces'), _('--'), app('unaryExpression')),
|
|
546
|
-
seq(app('spaces'), _('+'), app('unaryExpression')),
|
|
547
|
-
seq(app('spaces'), _('-'), app('unaryExpression')),
|
|
548
|
-
seq(app('spaces'), _('~'), app('unaryExpression')),
|
|
549
|
-
seq(app('spaces'), _('!'), app('unaryExpression')),
|
|
550
|
-
app('postfixExpression'),
|
|
551
|
-
),
|
|
552
|
-
multiplicativeExpression: choice(
|
|
553
|
-
seq(app('unaryExpression'), app('spaces'), _('*'), app('multiplicativeExpression')),
|
|
554
|
-
seq(app('unaryExpression'), app('spaces'), _('/'), app('multiplicativeExpression')),
|
|
555
|
-
seq(app('unaryExpression'), app('spaces'), _('%'), app('multiplicativeExpression')),
|
|
556
|
-
app('unaryExpression'),
|
|
557
|
-
),
|
|
558
|
-
additiveExpression: choice(
|
|
559
|
-
seq(app('multiplicativeExpression'), app('spaces'), _('+'), app('additiveExpression')),
|
|
560
|
-
seq(app('multiplicativeExpression'), app('spaces'), _('-'), app('additiveExpression')),
|
|
561
|
-
app('multiplicativeExpression'),
|
|
562
|
-
),
|
|
563
|
-
shiftExpression: choice(
|
|
564
|
-
seq(app('additiveExpression'), app('spaces'), _('<<'), app('shiftExpression')),
|
|
565
|
-
seq(app('additiveExpression'), app('spaces'), _('>>>'), app('shiftExpression')),
|
|
566
|
-
seq(app('additiveExpression'), app('spaces'), _('>>'), app('shiftExpression')),
|
|
567
|
-
app('additiveExpression'),
|
|
568
|
-
),
|
|
569
|
-
relationalExpression: choice(
|
|
570
|
-
seq(app('shiftExpression'), app('spaces'), _('<'), app('relationalExpression')),
|
|
571
|
-
seq(app('shiftExpression'), app('spaces'), _('>'), app('relationalExpression')),
|
|
572
|
-
seq(app('shiftExpression'), app('spaces'), _('<='), app('relationalExpression')),
|
|
573
|
-
seq(app('shiftExpression'), app('spaces'), _('>='), app('relationalExpression')),
|
|
574
|
-
seq(
|
|
575
|
-
app('shiftExpression'),
|
|
576
|
-
app('spaces'),
|
|
577
|
-
app('instanceof'),
|
|
578
|
-
app('relationalExpression'),
|
|
579
|
-
),
|
|
580
|
-
seq(app('shiftExpression'), app('spaces'), app('in'), app('relationalExpression')),
|
|
581
|
-
app('shiftExpression'),
|
|
582
|
-
),
|
|
583
|
-
relationalExpressionNoIn: choice(
|
|
584
|
-
seq(app('shiftExpression'), app('spaces'), _('<'), app('relationalExpressionNoIn')),
|
|
585
|
-
seq(app('shiftExpression'), app('spaces'), _('>'), app('relationalExpressionNoIn')),
|
|
586
|
-
seq(app('shiftExpression'), app('spaces'), _('<='), app('relationalExpressionNoIn')),
|
|
587
|
-
seq(app('shiftExpression'), app('spaces'), _('>='), app('relationalExpressionNoIn')),
|
|
588
|
-
seq(
|
|
589
|
-
app('shiftExpression'),
|
|
590
|
-
app('spaces'),
|
|
591
|
-
app('instanceof'),
|
|
592
|
-
app('relationalExpressionNoIn'),
|
|
593
|
-
),
|
|
594
|
-
app('shiftExpression'),
|
|
595
|
-
),
|
|
596
|
-
equalityExpression: choice(
|
|
597
|
-
seq(app('relationalExpression'), app('spaces'), _('=='), app('equalityExpression')),
|
|
598
|
-
seq(app('relationalExpression'), app('spaces'), _('!='), app('equalityExpression')),
|
|
599
|
-
seq(app('relationalExpression'), app('spaces'), _('==='), app('equalityExpression')),
|
|
600
|
-
seq(app('relationalExpression'), app('spaces'), _('!=='), app('equalityExpression')),
|
|
601
|
-
app('relationalExpression'),
|
|
602
|
-
),
|
|
603
|
-
equalityExpressionNoIn: choice(
|
|
604
|
-
seq(
|
|
605
|
-
app('relationalExpressionNoIn'),
|
|
606
|
-
app('spaces'),
|
|
607
|
-
_('=='),
|
|
608
|
-
app('equalityExpressionNoIn'),
|
|
609
|
-
),
|
|
610
|
-
seq(
|
|
611
|
-
app('relationalExpressionNoIn'),
|
|
612
|
-
app('spaces'),
|
|
613
|
-
_('!='),
|
|
614
|
-
app('equalityExpressionNoIn'),
|
|
615
|
-
),
|
|
616
|
-
seq(
|
|
617
|
-
app('relationalExpressionNoIn'),
|
|
618
|
-
app('spaces'),
|
|
619
|
-
_('==='),
|
|
620
|
-
app('equalityExpressionNoIn'),
|
|
621
|
-
),
|
|
622
|
-
seq(
|
|
623
|
-
app('relationalExpressionNoIn'),
|
|
624
|
-
app('spaces'),
|
|
625
|
-
_('!=='),
|
|
626
|
-
app('equalityExpressionNoIn'),
|
|
627
|
-
),
|
|
628
|
-
app('relationalExpressionNoIn'),
|
|
629
|
-
),
|
|
630
|
-
bitwiseANDExpression: choice(
|
|
631
|
-
seq(app('equalityExpression'), app('spaces'), _('&'), app('bitwiseANDExpression')),
|
|
632
|
-
app('equalityExpression'),
|
|
633
|
-
),
|
|
634
|
-
bitwiseANDExpressionNoIn: choice(
|
|
635
|
-
seq(
|
|
636
|
-
app('equalityExpressionNoIn'),
|
|
637
|
-
app('spaces'),
|
|
638
|
-
_('&'),
|
|
639
|
-
app('bitwiseANDExpressionNoIn'),
|
|
640
|
-
),
|
|
641
|
-
app('equalityExpressionNoIn'),
|
|
642
|
-
),
|
|
643
|
-
bitwiseXORExpression: choice(
|
|
644
|
-
seq(app('bitwiseANDExpression'), app('spaces'), _('^'), app('bitwiseXORExpression')),
|
|
645
|
-
app('bitwiseANDExpression'),
|
|
646
|
-
),
|
|
647
|
-
bitwiseXORExpressionNoIn: choice(
|
|
648
|
-
seq(
|
|
649
|
-
app('bitwiseANDExpressionNoIn'),
|
|
650
|
-
app('spaces'),
|
|
651
|
-
_('^'),
|
|
652
|
-
app('bitwiseXORExpressionNoIn'),
|
|
653
|
-
),
|
|
654
|
-
app('bitwiseANDExpressionNoIn'),
|
|
655
|
-
),
|
|
656
|
-
bitwiseORExpression: choice(
|
|
657
|
-
seq(app('bitwiseXORExpression'), app('spaces'), _('|'), app('bitwiseORExpression')),
|
|
658
|
-
app('bitwiseXORExpression'),
|
|
659
|
-
),
|
|
660
|
-
bitwiseORExpressionNoIn: choice(
|
|
661
|
-
seq(
|
|
662
|
-
app('bitwiseXORExpressionNoIn'),
|
|
663
|
-
app('spaces'),
|
|
664
|
-
_('|'),
|
|
665
|
-
app('bitwiseORExpressionNoIn'),
|
|
666
|
-
),
|
|
667
|
-
app('bitwiseXORExpressionNoIn'),
|
|
668
|
-
),
|
|
669
|
-
logicalANDExpression: choice(
|
|
670
|
-
seq(app('bitwiseORExpression'), app('spaces'), _('&&'), app('logicalANDExpression')),
|
|
671
|
-
app('bitwiseORExpression'),
|
|
672
|
-
),
|
|
673
|
-
logicalANDExpressionNoIn: choice(
|
|
674
|
-
seq(
|
|
675
|
-
app('bitwiseORExpressionNoIn'),
|
|
676
|
-
app('spaces'),
|
|
677
|
-
_('&&'),
|
|
678
|
-
app('logicalANDExpressionNoIn'),
|
|
679
|
-
),
|
|
680
|
-
app('bitwiseORExpressionNoIn'),
|
|
681
|
-
),
|
|
682
|
-
logicalORExpression: choice(
|
|
683
|
-
seq(app('logicalANDExpression'), app('spaces'), _('||'), app('logicalORExpression')),
|
|
684
|
-
app('logicalANDExpression'),
|
|
685
|
-
),
|
|
686
|
-
logicalORExpressionNoIn: choice(
|
|
687
|
-
seq(
|
|
688
|
-
app('logicalANDExpressionNoIn'),
|
|
689
|
-
app('spaces'),
|
|
690
|
-
_('||'),
|
|
691
|
-
app('logicalORExpressionNoIn'),
|
|
692
|
-
),
|
|
693
|
-
app('logicalANDExpressionNoIn'),
|
|
694
|
-
),
|
|
695
|
-
conditionalExpression: choice(
|
|
696
|
-
seq(
|
|
697
|
-
app('logicalORExpression'),
|
|
698
|
-
app('spaces'),
|
|
699
|
-
_('?'),
|
|
700
|
-
app('assignmentExpression'),
|
|
701
|
-
app('spaces'),
|
|
702
|
-
_(':'),
|
|
703
|
-
app('assignmentExpression'),
|
|
704
|
-
),
|
|
705
|
-
app('logicalORExpression'),
|
|
706
|
-
),
|
|
707
|
-
conditionalExpressionNoIn: choice(
|
|
708
|
-
seq(
|
|
709
|
-
app('logicalORExpressionNoIn'),
|
|
710
|
-
app('spaces'),
|
|
711
|
-
_('?'),
|
|
712
|
-
app('assignmentExpression'),
|
|
713
|
-
app('spaces'),
|
|
714
|
-
_(':'),
|
|
715
|
-
app('assignmentExpressionNoIn'),
|
|
716
|
-
),
|
|
717
|
-
app('logicalORExpressionNoIn'),
|
|
718
|
-
),
|
|
719
|
-
assignmentExpression: choice(
|
|
720
|
-
seq(
|
|
721
|
-
app('leftHandSideExpression'),
|
|
722
|
-
app('spaces'),
|
|
723
|
-
app('assignmentOperator'),
|
|
724
|
-
app('assignmentExpression'),
|
|
725
|
-
),
|
|
726
|
-
app('conditionalExpression'),
|
|
727
|
-
),
|
|
728
|
-
assignmentExpressionNoIn: choice(
|
|
729
|
-
seq(
|
|
730
|
-
app('leftHandSideExpression'),
|
|
731
|
-
app('spaces'),
|
|
732
|
-
app('assignmentOperator'),
|
|
733
|
-
app('assignmentExpressionNoIn'),
|
|
734
|
-
),
|
|
735
|
-
app('conditionalExpressionNoIn'),
|
|
736
|
-
),
|
|
737
|
-
expression: seq(
|
|
738
|
-
app('assignmentExpression'),
|
|
739
|
-
rep(seq(app('spaces'), _(','), app('assignmentExpression'))),
|
|
740
|
-
),
|
|
741
|
-
expressionNoIn: seq(
|
|
742
|
-
app('assignmentExpressionNoIn'),
|
|
743
|
-
rep(seq(app('spaces'), _(','), app('assignmentExpressionNoIn'))),
|
|
744
|
-
),
|
|
745
|
-
assignmentOperator: choice(
|
|
746
|
-
_('='),
|
|
747
|
-
_('>>>='),
|
|
748
|
-
_('<<='),
|
|
749
|
-
_('>>='),
|
|
750
|
-
_('*='),
|
|
751
|
-
_('/='),
|
|
752
|
-
_('%='),
|
|
753
|
-
_('+='),
|
|
754
|
-
_('-='),
|
|
755
|
-
_('&='),
|
|
756
|
-
_('^='),
|
|
757
|
-
_('|='),
|
|
758
|
-
),
|
|
759
|
-
statement: choice(
|
|
760
|
-
app('block'),
|
|
761
|
-
app('variableStatement'),
|
|
762
|
-
app('emptyStatement'),
|
|
763
|
-
app('expressionStatement'),
|
|
764
|
-
app('ifStatement'),
|
|
765
|
-
app('iterationStatement'),
|
|
766
|
-
app('continueStatement'),
|
|
767
|
-
app('breakStatement'),
|
|
768
|
-
app('returnStatement'),
|
|
769
|
-
app('withStatement'),
|
|
770
|
-
app('labelledStatement'),
|
|
771
|
-
app('switchStatement'),
|
|
772
|
-
app('throwStatement'),
|
|
773
|
-
app('tryStatement'),
|
|
774
|
-
app('debuggerStatement'),
|
|
775
|
-
),
|
|
776
|
-
block: seq(app('spaces'), _('{'), app('statementList'), app('spaces'), _('}')),
|
|
777
|
-
statementList: rep(app('statement')),
|
|
778
|
-
variableStatement: seq(
|
|
779
|
-
app('spaces'),
|
|
780
|
-
app('var'),
|
|
781
|
-
app('variableDeclarationList'),
|
|
782
|
-
lexIgnored(app('sc')),
|
|
783
|
-
),
|
|
784
|
-
variableDeclarationList: seq(
|
|
785
|
-
app('variableDeclaration'),
|
|
786
|
-
rep(seq(app('spaces'), _(','), app('variableDeclaration'))),
|
|
787
|
-
),
|
|
788
|
-
variableDeclarationListNoIn: seq(
|
|
789
|
-
app('variableDeclarationNoIn'),
|
|
790
|
-
rep(seq(app('spaces'), _(','), app('variableDeclarationNoIn'))),
|
|
791
|
-
),
|
|
792
|
-
variableDeclaration: seq(
|
|
793
|
-
app('spaces'),
|
|
794
|
-
app('identifier'),
|
|
795
|
-
choice(app('initialiser'), seq()),
|
|
796
|
-
),
|
|
797
|
-
variableDeclarationNoIn: seq(
|
|
798
|
-
app('spaces'),
|
|
799
|
-
app('identifier'),
|
|
800
|
-
choice(app('initialiserNoIn'), seq()),
|
|
801
|
-
),
|
|
802
|
-
initialiser: seq(app('spaces'), _('='), app('assignmentExpression')),
|
|
803
|
-
initialiserNoIn: seq(app('spaces'), _('='), app('assignmentExpressionNoIn')),
|
|
804
|
-
emptyStatement: seq(app('spaces'), _(';')),
|
|
805
|
-
expressionStatement: seq(
|
|
806
|
-
not(seq(app('spaces'), choice(_('{'), app('function')))),
|
|
807
|
-
app('expression'),
|
|
808
|
-
lexIgnored(app('sc')),
|
|
809
|
-
),
|
|
810
|
-
ifStatement: seq(
|
|
811
|
-
app('spaces'),
|
|
812
|
-
app('if'),
|
|
813
|
-
app('spaces'),
|
|
814
|
-
_('('),
|
|
815
|
-
app('expression'),
|
|
816
|
-
app('spaces'),
|
|
817
|
-
_(')'),
|
|
818
|
-
app('statement'),
|
|
819
|
-
choice(seq(app('spaces'), app('else'), app('statement')), seq()),
|
|
820
|
-
),
|
|
821
|
-
iterationStatement: choice(
|
|
822
|
-
seq(
|
|
823
|
-
app('spaces'),
|
|
824
|
-
app('do'),
|
|
825
|
-
app('statement'),
|
|
826
|
-
app('spaces'),
|
|
827
|
-
app('while'),
|
|
828
|
-
app('spaces'),
|
|
829
|
-
_('('),
|
|
830
|
-
app('expression'),
|
|
831
|
-
app('spaces'),
|
|
832
|
-
_(')'),
|
|
833
|
-
lexIgnored(app('sc')),
|
|
834
|
-
),
|
|
835
|
-
seq(
|
|
836
|
-
app('spaces'),
|
|
837
|
-
app('while'),
|
|
838
|
-
app('spaces'),
|
|
839
|
-
_('('),
|
|
840
|
-
app('expression'),
|
|
841
|
-
app('spaces'),
|
|
842
|
-
_(')'),
|
|
843
|
-
app('statement'),
|
|
844
|
-
),
|
|
845
|
-
seq(
|
|
846
|
-
app('spaces'),
|
|
847
|
-
app('for'),
|
|
848
|
-
app('spaces'),
|
|
849
|
-
_('('),
|
|
850
|
-
choice(app('expressionNoIn'), seq()),
|
|
851
|
-
app('spaces'),
|
|
852
|
-
_(';'),
|
|
853
|
-
choice(app('expression'), seq()),
|
|
854
|
-
app('spaces'),
|
|
855
|
-
_(';'),
|
|
856
|
-
choice(app('expression'), seq()),
|
|
857
|
-
app('spaces'),
|
|
858
|
-
_(')'),
|
|
859
|
-
app('statement'),
|
|
860
|
-
),
|
|
861
|
-
seq(
|
|
862
|
-
app('spaces'),
|
|
863
|
-
app('for'),
|
|
864
|
-
app('spaces'),
|
|
865
|
-
_('('),
|
|
866
|
-
app('spaces'),
|
|
867
|
-
app('var'),
|
|
868
|
-
app('variableDeclarationListNoIn'),
|
|
869
|
-
app('spaces'),
|
|
870
|
-
_(';'),
|
|
871
|
-
choice(app('expression'), seq()),
|
|
872
|
-
app('spaces'),
|
|
873
|
-
_(';'),
|
|
874
|
-
choice(app('expression'), seq()),
|
|
875
|
-
app('spaces'),
|
|
876
|
-
_(')'),
|
|
877
|
-
app('statement'),
|
|
878
|
-
),
|
|
879
|
-
seq(
|
|
880
|
-
app('spaces'),
|
|
881
|
-
app('for'),
|
|
882
|
-
app('spaces'),
|
|
883
|
-
_('('),
|
|
884
|
-
app('leftHandSideExpression'),
|
|
885
|
-
app('spaces'),
|
|
886
|
-
app('in'),
|
|
887
|
-
app('expression'),
|
|
888
|
-
app('spaces'),
|
|
889
|
-
_(')'),
|
|
890
|
-
app('statement'),
|
|
891
|
-
),
|
|
892
|
-
seq(
|
|
893
|
-
app('spaces'),
|
|
894
|
-
app('for'),
|
|
895
|
-
app('spaces'),
|
|
896
|
-
_('('),
|
|
897
|
-
app('spaces'),
|
|
898
|
-
app('var'),
|
|
899
|
-
app('variableDeclarationNoIn'),
|
|
900
|
-
app('spaces'),
|
|
901
|
-
app('in'),
|
|
902
|
-
app('expression'),
|
|
903
|
-
app('spaces'),
|
|
904
|
-
_(')'),
|
|
905
|
-
app('statement'),
|
|
906
|
-
),
|
|
907
|
-
),
|
|
908
|
-
continueStatement: seq(
|
|
909
|
-
app('spaces'),
|
|
910
|
-
app('continue'),
|
|
911
|
-
lexIgnored(seq(choice(seq(app('spacesNoNL'), app('identifier')), seq()), app('sc'))),
|
|
912
|
-
),
|
|
913
|
-
breakStatement: seq(
|
|
914
|
-
app('spaces'),
|
|
915
|
-
app('break'),
|
|
916
|
-
lexIgnored(seq(choice(seq(app('spacesNoNL'), app('identifier')), seq()), app('sc'))),
|
|
917
|
-
),
|
|
918
|
-
returnStatement: seq(
|
|
919
|
-
app('spaces'),
|
|
920
|
-
app('return'),
|
|
921
|
-
choice(
|
|
922
|
-
seq(lexIgnored(seq(app('spacesNoNL'), not(app('space')))), app('expression')),
|
|
923
|
-
seq(),
|
|
924
|
-
),
|
|
925
|
-
lexIgnored(app('sc')),
|
|
926
|
-
),
|
|
927
|
-
withStatement: seq(
|
|
928
|
-
app('spaces'),
|
|
929
|
-
app('with'),
|
|
930
|
-
app('spaces'),
|
|
931
|
-
_('('),
|
|
932
|
-
app('expression'),
|
|
933
|
-
app('spaces'),
|
|
934
|
-
_(')'),
|
|
935
|
-
app('statement'),
|
|
936
|
-
),
|
|
937
|
-
switchStatement: seq(
|
|
938
|
-
app('spaces'),
|
|
939
|
-
app('switch'),
|
|
940
|
-
app('spaces'),
|
|
941
|
-
_('('),
|
|
942
|
-
app('expression'),
|
|
943
|
-
app('spaces'),
|
|
944
|
-
_(')'),
|
|
945
|
-
app('caseBlock'),
|
|
946
|
-
),
|
|
947
|
-
caseBlock: choice(
|
|
948
|
-
seq(
|
|
949
|
-
app('spaces'),
|
|
950
|
-
_('{'),
|
|
951
|
-
rep(app('caseClause')),
|
|
952
|
-
app('defaultClause'),
|
|
953
|
-
rep(app('caseClause')),
|
|
954
|
-
app('spaces'),
|
|
955
|
-
_('}'),
|
|
956
|
-
),
|
|
957
|
-
seq(app('spaces'), _('{'), rep(app('caseClause')), app('spaces'), _('}')),
|
|
958
|
-
),
|
|
959
|
-
caseClause: seq(
|
|
960
|
-
app('spaces'),
|
|
961
|
-
app('case'),
|
|
962
|
-
app('expression'),
|
|
963
|
-
app('spaces'),
|
|
964
|
-
_(':'),
|
|
965
|
-
rep(app('statement')),
|
|
966
|
-
),
|
|
967
|
-
defaultClause: seq(
|
|
968
|
-
app('spaces'),
|
|
969
|
-
app('default'),
|
|
970
|
-
app('spaces'),
|
|
971
|
-
_(':'),
|
|
972
|
-
rep(app('statement')),
|
|
973
|
-
),
|
|
974
|
-
labelledStatement: seq(
|
|
975
|
-
app('spaces'),
|
|
976
|
-
app('identifier'),
|
|
977
|
-
app('spaces'),
|
|
978
|
-
_(':'),
|
|
979
|
-
app('statement'),
|
|
980
|
-
),
|
|
981
|
-
throwStatement: seq(app('spaces'), app('throw'), app('expression'), lexIgnored(app('sc'))),
|
|
982
|
-
tryStatement: choice(
|
|
983
|
-
seq(app('spaces'), app('try'), app('block'), app('catchBlock'), app('finallyBlock')),
|
|
984
|
-
seq(app('spaces'), app('try'), app('block'), app('finallyBlock')),
|
|
985
|
-
seq(app('spaces'), app('try'), app('block'), app('catchBlock')),
|
|
986
|
-
),
|
|
987
|
-
catchBlock: seq(
|
|
988
|
-
app('spaces'),
|
|
989
|
-
app('catch'),
|
|
990
|
-
app('spaces'),
|
|
991
|
-
_('('),
|
|
992
|
-
app('formalParameter'),
|
|
993
|
-
app('spaces'),
|
|
994
|
-
_(')'),
|
|
995
|
-
app('block'),
|
|
996
|
-
),
|
|
997
|
-
finallyBlock: seq(app('spaces'), app('finally'), app('block')),
|
|
998
|
-
debuggerStatement: seq(app('spaces'), lexIgnored(seq(app('debugger'), app('sc')))),
|
|
999
|
-
functionDeclaration: seq(
|
|
1000
|
-
app('spaces'),
|
|
1001
|
-
app('function'),
|
|
1002
|
-
app('spaces'),
|
|
1003
|
-
app('identifier'),
|
|
1004
|
-
app('spaces'),
|
|
1005
|
-
_('('),
|
|
1006
|
-
app('formalParameterList'),
|
|
1007
|
-
app('spaces'),
|
|
1008
|
-
_(')'),
|
|
1009
|
-
app('spaces'),
|
|
1010
|
-
_('{'),
|
|
1011
|
-
app('functionBody'),
|
|
1012
|
-
app('spaces'),
|
|
1013
|
-
_('}'),
|
|
1014
|
-
),
|
|
1015
|
-
functionExpression: choice(
|
|
1016
|
-
seq(
|
|
1017
|
-
app('spaces'),
|
|
1018
|
-
app('function'),
|
|
1019
|
-
app('spaces'),
|
|
1020
|
-
app('identifier'),
|
|
1021
|
-
app('spaces'),
|
|
1022
|
-
_('('),
|
|
1023
|
-
app('formalParameterList'),
|
|
1024
|
-
app('spaces'),
|
|
1025
|
-
_(')'),
|
|
1026
|
-
app('spaces'),
|
|
1027
|
-
_('{'),
|
|
1028
|
-
app('functionBody'),
|
|
1029
|
-
app('spaces'),
|
|
1030
|
-
_('}'),
|
|
1031
|
-
),
|
|
1032
|
-
seq(
|
|
1033
|
-
app('spaces'),
|
|
1034
|
-
app('function'),
|
|
1035
|
-
app('spaces'),
|
|
1036
|
-
_('('),
|
|
1037
|
-
app('formalParameterList'),
|
|
1038
|
-
app('spaces'),
|
|
1039
|
-
_(')'),
|
|
1040
|
-
app('spaces'),
|
|
1041
|
-
_('{'),
|
|
1042
|
-
app('functionBody'),
|
|
1043
|
-
app('spaces'),
|
|
1044
|
-
_('}'),
|
|
1045
|
-
),
|
|
1046
|
-
),
|
|
1047
|
-
formalParameterList: choice(
|
|
1048
|
-
seq(app('formalParameter'), rep(seq(app('spaces'), _(','), app('formalParameter')))),
|
|
1049
|
-
seq(),
|
|
1050
|
-
),
|
|
1051
|
-
formalParameter: seq(app('spaces'), app('identifier')),
|
|
1052
|
-
functionBody: seq(lookahead(rep(app('directive'))), rep(app('sourceElement'))),
|
|
1053
|
-
sourceElement: choice(app('functionDeclaration'), app('statement')),
|
|
1054
|
-
directive: seq(app('spaces'), app('stringLiteral'), lexIgnored(app('sc'))),
|
|
1055
|
-
});
|
|
1056
|
-
};
|
|
1057
|
-
export default fac;
|