@slidejs/dsl 0.0.1

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.
@@ -0,0 +1,2992 @@
1
+ // @generated by Peggy 4.2.0.
2
+ //
3
+ // https://peggyjs.org/
4
+
5
+
6
+ function peg$subclass(child, parent) {
7
+ function C() { this.constructor = child; }
8
+ C.prototype = parent.prototype;
9
+ child.prototype = new C();
10
+ }
11
+
12
+ function peg$SyntaxError(message, expected, found, location) {
13
+ var self = Error.call(this, message);
14
+ // istanbul ignore next Check is a necessary evil to support older environments
15
+ if (Object.setPrototypeOf) {
16
+ Object.setPrototypeOf(self, peg$SyntaxError.prototype);
17
+ }
18
+ self.expected = expected;
19
+ self.found = found;
20
+ self.location = location;
21
+ self.name = "SyntaxError";
22
+ return self;
23
+ }
24
+
25
+ peg$subclass(peg$SyntaxError, Error);
26
+
27
+ function peg$padEnd(str, targetLength, padString) {
28
+ padString = padString || " ";
29
+ if (str.length > targetLength) { return str; }
30
+ targetLength -= str.length;
31
+ padString += padString.repeat(targetLength);
32
+ return str + padString.slice(0, targetLength);
33
+ }
34
+
35
+ peg$SyntaxError.prototype.format = function(sources) {
36
+ var str = "Error: " + this.message;
37
+ if (this.location) {
38
+ var src = null;
39
+ var k;
40
+ for (k = 0; k < sources.length; k++) {
41
+ if (sources[k].source === this.location.source) {
42
+ src = sources[k].text.split(/\r\n|\n|\r/g);
43
+ break;
44
+ }
45
+ }
46
+ var s = this.location.start;
47
+ var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
48
+ ? this.location.source.offset(s)
49
+ : s;
50
+ var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
51
+ if (src) {
52
+ var e = this.location.end;
53
+ var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
54
+ var line = src[s.line - 1];
55
+ var last = s.line === e.line ? e.column : line.length + 1;
56
+ var hatLen = (last - s.column) || 1;
57
+ str += "\n --> " + loc + "\n"
58
+ + filler + " |\n"
59
+ + offset_s.line + " | " + line + "\n"
60
+ + filler + " | " + peg$padEnd("", s.column - 1, ' ')
61
+ + peg$padEnd("", hatLen, "^");
62
+ } else {
63
+ str += "\n at " + loc;
64
+ }
65
+ }
66
+ return str;
67
+ };
68
+
69
+ peg$SyntaxError.buildMessage = function(expected, found) {
70
+ var DESCRIBE_EXPECTATION_FNS = {
71
+ literal: function(expectation) {
72
+ return "\"" + literalEscape(expectation.text) + "\"";
73
+ },
74
+
75
+ class: function(expectation) {
76
+ var escapedParts = expectation.parts.map(function(part) {
77
+ return Array.isArray(part)
78
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
79
+ : classEscape(part);
80
+ });
81
+
82
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
83
+ },
84
+
85
+ any: function() {
86
+ return "any character";
87
+ },
88
+
89
+ end: function() {
90
+ return "end of input";
91
+ },
92
+
93
+ other: function(expectation) {
94
+ return expectation.description;
95
+ }
96
+ };
97
+
98
+ function hex(ch) {
99
+ return ch.charCodeAt(0).toString(16).toUpperCase();
100
+ }
101
+
102
+ function literalEscape(s) {
103
+ return s
104
+ .replace(/\\/g, "\\\\")
105
+ .replace(/"/g, "\\\"")
106
+ .replace(/\0/g, "\\0")
107
+ .replace(/\t/g, "\\t")
108
+ .replace(/\n/g, "\\n")
109
+ .replace(/\r/g, "\\r")
110
+ .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
111
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
112
+ }
113
+
114
+ function classEscape(s) {
115
+ return s
116
+ .replace(/\\/g, "\\\\")
117
+ .replace(/\]/g, "\\]")
118
+ .replace(/\^/g, "\\^")
119
+ .replace(/-/g, "\\-")
120
+ .replace(/\0/g, "\\0")
121
+ .replace(/\t/g, "\\t")
122
+ .replace(/\n/g, "\\n")
123
+ .replace(/\r/g, "\\r")
124
+ .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
125
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
126
+ }
127
+
128
+ function describeExpectation(expectation) {
129
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
130
+ }
131
+
132
+ function describeExpected(expected) {
133
+ var descriptions = expected.map(describeExpectation);
134
+ var i, j;
135
+
136
+ descriptions.sort();
137
+
138
+ if (descriptions.length > 0) {
139
+ for (i = 1, j = 1; i < descriptions.length; i++) {
140
+ if (descriptions[i - 1] !== descriptions[i]) {
141
+ descriptions[j] = descriptions[i];
142
+ j++;
143
+ }
144
+ }
145
+ descriptions.length = j;
146
+ }
147
+
148
+ switch (descriptions.length) {
149
+ case 1:
150
+ return descriptions[0];
151
+
152
+ case 2:
153
+ return descriptions[0] + " or " + descriptions[1];
154
+
155
+ default:
156
+ return descriptions.slice(0, -1).join(", ")
157
+ + ", or "
158
+ + descriptions[descriptions.length - 1];
159
+ }
160
+ }
161
+
162
+ function describeFound(found) {
163
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
164
+ }
165
+
166
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
167
+ };
168
+
169
+ function peg$parse(input, options) {
170
+ options = options !== undefined ? options : {};
171
+
172
+ var peg$FAILED = {};
173
+ var peg$source = options.grammarSource;
174
+
175
+ var peg$startRuleFunctions = { Start: peg$parseStart };
176
+ var peg$startRuleFunction = peg$parseStart;
177
+
178
+ var peg$c0 = "present";
179
+ var peg$c1 = "{";
180
+ var peg$c2 = "}";
181
+ var peg$c3 = "quiz";
182
+ var peg$c4 = "survey";
183
+ var peg$c5 = "form";
184
+ var peg$c6 = "assessment";
185
+ var peg$c7 = "rules";
186
+ var peg$c8 = "rule";
187
+ var peg$c9 = "start";
188
+ var peg$c10 = "content";
189
+ var peg$c11 = "end";
190
+ var peg$c12 = "for";
191
+ var peg$c13 = "in";
192
+ var peg$c14 = "slide";
193
+ var peg$c15 = "dynamic";
194
+ var peg$c16 = "text";
195
+ var peg$c17 = "name";
196
+ var peg$c18 = ":";
197
+ var peg$c19 = "attrs";
198
+ var peg$c20 = "behavior";
199
+ var peg$c21 = "transition";
200
+ var peg$c22 = "+";
201
+ var peg$c23 = ".";
202
+ var peg$c24 = "\"";
203
+ var peg$c25 = "'";
204
+ var peg$c26 = "\\";
205
+ var peg$c27 = "n";
206
+ var peg$c28 = "r";
207
+ var peg$c29 = "t";
208
+ var peg$c30 = "true";
209
+ var peg$c31 = "false";
210
+ var peg$c32 = "//";
211
+ var peg$c33 = "/*";
212
+ var peg$c34 = "*/";
213
+
214
+ var peg$r0 = /^[a-zA-Z_]/;
215
+ var peg$r1 = /^[a-zA-Z0-9_]/;
216
+ var peg$r2 = /^["'\\]/;
217
+ var peg$r3 = /^[0-9]/;
218
+ var peg$r4 = /^[\t-\r \u2028-\u2029]/;
219
+ var peg$r5 = /^[ \t\v\f]/;
220
+ var peg$r6 = /^[\n\r\u2028\u2029]/;
221
+
222
+ var peg$e0 = peg$literalExpectation("present", false);
223
+ var peg$e1 = peg$literalExpectation("{", false);
224
+ var peg$e2 = peg$literalExpectation("}", false);
225
+ var peg$e3 = peg$literalExpectation("quiz", false);
226
+ var peg$e4 = peg$literalExpectation("survey", false);
227
+ var peg$e5 = peg$literalExpectation("form", false);
228
+ var peg$e6 = peg$literalExpectation("assessment", false);
229
+ var peg$e7 = peg$literalExpectation("rules", false);
230
+ var peg$e8 = peg$literalExpectation("rule", false);
231
+ var peg$e9 = peg$literalExpectation("start", false);
232
+ var peg$e10 = peg$literalExpectation("content", false);
233
+ var peg$e11 = peg$literalExpectation("end", false);
234
+ var peg$e12 = peg$literalExpectation("for", false);
235
+ var peg$e13 = peg$literalExpectation("in", false);
236
+ var peg$e14 = peg$literalExpectation("slide", false);
237
+ var peg$e15 = peg$literalExpectation("dynamic", false);
238
+ var peg$e16 = peg$literalExpectation("text", false);
239
+ var peg$e17 = peg$literalExpectation("name", false);
240
+ var peg$e18 = peg$literalExpectation(":", false);
241
+ var peg$e19 = peg$literalExpectation("attrs", false);
242
+ var peg$e20 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false);
243
+ var peg$e21 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false);
244
+ var peg$e22 = peg$literalExpectation("behavior", false);
245
+ var peg$e23 = peg$literalExpectation("transition", false);
246
+ var peg$e24 = peg$literalExpectation("+", false);
247
+ var peg$e25 = peg$literalExpectation(".", false);
248
+ var peg$e26 = peg$literalExpectation("\"", false);
249
+ var peg$e27 = peg$literalExpectation("'", false);
250
+ var peg$e28 = peg$literalExpectation("\\", false);
251
+ var peg$e29 = peg$anyExpectation();
252
+ var peg$e30 = peg$classExpectation(["\"", "'", "\\"], false, false);
253
+ var peg$e31 = peg$literalExpectation("n", false);
254
+ var peg$e32 = peg$literalExpectation("r", false);
255
+ var peg$e33 = peg$literalExpectation("t", false);
256
+ var peg$e34 = peg$classExpectation([["0", "9"]], false, false);
257
+ var peg$e35 = peg$literalExpectation("true", false);
258
+ var peg$e36 = peg$literalExpectation("false", false);
259
+ var peg$e37 = peg$otherExpectation("whitespace");
260
+ var peg$e38 = peg$classExpectation([["\t", "\r"], " ", ["\u2028", "\u2029"]], false, false);
261
+ var peg$e39 = peg$classExpectation([" ", "\t", "\v", "\f"], false, false);
262
+ var peg$e40 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false);
263
+ var peg$e41 = peg$literalExpectation("//", false);
264
+ var peg$e42 = peg$literalExpectation("/*", false);
265
+ var peg$e43 = peg$literalExpectation("*/", false);
266
+
267
+ var peg$f0 = function(presentation) {
268
+ return presentation;
269
+ };
270
+ var peg$f1 = function(type, name, body) {
271
+ return {
272
+ version: "1.0.0",
273
+ sourceType: type,
274
+ sourceId: name,
275
+ ...body
276
+ };
277
+ };
278
+ var peg$f2 = function(rules) {
279
+ return { rules };
280
+ };
281
+ var peg$f3 = function(rules) {
282
+ return rules;
283
+ };
284
+ var peg$f4 = function(name, slides) {
285
+ return buildNode("rule", {
286
+ ruleType: "start",
287
+ name,
288
+ slides
289
+ });
290
+ };
291
+ var peg$f5 = function(name, body) {
292
+ return buildNode("rule", {
293
+ ruleType: "content",
294
+ name,
295
+ body
296
+ });
297
+ };
298
+ var peg$f6 = function(name, slides) {
299
+ return buildNode("rule", {
300
+ ruleType: "end",
301
+ name,
302
+ slides
303
+ });
304
+ };
305
+ var peg$f7 = function(variable, collection, body) {
306
+ return buildNode("for", {
307
+ variable,
308
+ collection,
309
+ body
310
+ });
311
+ };
312
+ var peg$f8 = function(variable, collection, body) {
313
+ return buildNode("for", {
314
+ variable,
315
+ collection,
316
+ body
317
+ });
318
+ };
319
+ var peg$f9 = function(slides) {
320
+ return slides;
321
+ };
322
+ var peg$f10 = function(content, behavior) {
323
+ return buildNode("slide", {
324
+ content,
325
+ behavior: behavior || undefined
326
+ });
327
+ };
328
+ var peg$f11 = function(name, attrs) {
329
+ return buildNode("dynamic", {
330
+ component: name,
331
+ props: attrs
332
+ });
333
+ };
334
+ var peg$f12 = function(lines) {
335
+ return buildNode("text", {
336
+ lines
337
+ });
338
+ };
339
+ var peg$f13 = function(name) {
340
+ return name;
341
+ };
342
+ var peg$f14 = function(attrs) {
343
+ return buildAttrs(attrs);
344
+ };
345
+ var peg$f15 = function(attrs) {
346
+ return attrs;
347
+ };
348
+ var peg$f16 = function(key, value) {
349
+ return [key, value];
350
+ };
351
+ var peg$f17 = function(first, rest) {
352
+ return first + rest.join('');
353
+ };
354
+ var peg$f18 = function(lines) {
355
+ return lines;
356
+ };
357
+ var peg$f19 = function(expr) {
358
+ return expr;
359
+ };
360
+ var peg$f20 = function(transition) {
361
+ return buildNode("behavior", {
362
+ transition
363
+ });
364
+ };
365
+ var peg$f21 = function(transType, options) {
366
+ return buildNode("transition", {
367
+ transType,
368
+ options: options || {}
369
+ });
370
+ };
371
+ var peg$f22 = function(first, rest) {
372
+ return first + rest.join('');
373
+ };
374
+ var peg$f23 = function(opts) {
375
+ return buildOptions(opts);
376
+ };
377
+ var peg$f24 = function(key, value) {
378
+ return [key, value];
379
+ };
380
+ var peg$f25 = function(left, right) {
381
+ return buildNode("binary", {
382
+ operator: "+",
383
+ left,
384
+ right
385
+ });
386
+ };
387
+ var peg$f26 = function(head, tail) {
388
+ return buildNode("member", {
389
+ object: head,
390
+ properties: tail.map(t => t[1])
391
+ });
392
+ };
393
+ var peg$f27 = function(id) {
394
+ return buildNode("member", {
395
+ object: id,
396
+ properties: []
397
+ });
398
+ };
399
+ var peg$f28 = function(first, rest) {
400
+ return first + rest.join('');
401
+ };
402
+ var peg$f29 = function(first, rest) {
403
+ return first + rest.join('');
404
+ };
405
+ var peg$f30 = function(chars) {
406
+ return chars.join('');
407
+ };
408
+ var peg$f31 = function(chars) {
409
+ return chars.join('');
410
+ };
411
+ var peg$f32 = function(char) { return char; };
412
+ var peg$f33 = function(sequence) { return sequence; };
413
+ var peg$f34 = function(char) { return char; };
414
+ var peg$f35 = function(sequence) { return sequence; };
415
+ var peg$f36 = function() { return "\n"; };
416
+ var peg$f37 = function() { return "\r"; };
417
+ var peg$f38 = function() { return "\t"; };
418
+ var peg$f39 = function(digits) {
419
+ return buildNode("number", {
420
+ value: parseInt(digits.join(''), 10)
421
+ });
422
+ };
423
+ var peg$f40 = function() {
424
+ return buildNode("boolean", {
425
+ value: true
426
+ });
427
+ };
428
+ var peg$f41 = function() {
429
+ return buildNode("boolean", {
430
+ value: false
431
+ });
432
+ };
433
+ var peg$currPos = options.peg$currPos | 0;
434
+ var peg$savedPos = peg$currPos;
435
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
436
+ var peg$maxFailPos = peg$currPos;
437
+ var peg$maxFailExpected = options.peg$maxFailExpected || [];
438
+ var peg$silentFails = options.peg$silentFails | 0;
439
+
440
+ var peg$result;
441
+
442
+ if (options.startRule) {
443
+ if (!(options.startRule in peg$startRuleFunctions)) {
444
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
445
+ }
446
+
447
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
448
+ }
449
+
450
+ function text() {
451
+ return input.substring(peg$savedPos, peg$currPos);
452
+ }
453
+
454
+ function offset() {
455
+ return peg$savedPos;
456
+ }
457
+
458
+ function range() {
459
+ return {
460
+ source: peg$source,
461
+ start: peg$savedPos,
462
+ end: peg$currPos
463
+ };
464
+ }
465
+
466
+ function location() {
467
+ return peg$computeLocation(peg$savedPos, peg$currPos);
468
+ }
469
+
470
+ function expected(description, location) {
471
+ location = location !== undefined
472
+ ? location
473
+ : peg$computeLocation(peg$savedPos, peg$currPos);
474
+
475
+ throw peg$buildStructuredError(
476
+ [peg$otherExpectation(description)],
477
+ input.substring(peg$savedPos, peg$currPos),
478
+ location
479
+ );
480
+ }
481
+
482
+ function error(message, location) {
483
+ location = location !== undefined
484
+ ? location
485
+ : peg$computeLocation(peg$savedPos, peg$currPos);
486
+
487
+ throw peg$buildSimpleError(message, location);
488
+ }
489
+
490
+ function peg$literalExpectation(text, ignoreCase) {
491
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
492
+ }
493
+
494
+ function peg$classExpectation(parts, inverted, ignoreCase) {
495
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
496
+ }
497
+
498
+ function peg$anyExpectation() {
499
+ return { type: "any" };
500
+ }
501
+
502
+ function peg$endExpectation() {
503
+ return { type: "end" };
504
+ }
505
+
506
+ function peg$otherExpectation(description) {
507
+ return { type: "other", description: description };
508
+ }
509
+
510
+ function peg$computePosDetails(pos) {
511
+ var details = peg$posDetailsCache[pos];
512
+ var p;
513
+
514
+ if (details) {
515
+ return details;
516
+ } else {
517
+ if (pos >= peg$posDetailsCache.length) {
518
+ p = peg$posDetailsCache.length - 1;
519
+ } else {
520
+ p = pos;
521
+ while (!peg$posDetailsCache[--p]) {}
522
+ }
523
+
524
+ details = peg$posDetailsCache[p];
525
+ details = {
526
+ line: details.line,
527
+ column: details.column
528
+ };
529
+
530
+ while (p < pos) {
531
+ if (input.charCodeAt(p) === 10) {
532
+ details.line++;
533
+ details.column = 1;
534
+ } else {
535
+ details.column++;
536
+ }
537
+
538
+ p++;
539
+ }
540
+
541
+ peg$posDetailsCache[pos] = details;
542
+
543
+ return details;
544
+ }
545
+ }
546
+
547
+ function peg$computeLocation(startPos, endPos, offset) {
548
+ var startPosDetails = peg$computePosDetails(startPos);
549
+ var endPosDetails = peg$computePosDetails(endPos);
550
+
551
+ var res = {
552
+ source: peg$source,
553
+ start: {
554
+ offset: startPos,
555
+ line: startPosDetails.line,
556
+ column: startPosDetails.column
557
+ },
558
+ end: {
559
+ offset: endPos,
560
+ line: endPosDetails.line,
561
+ column: endPosDetails.column
562
+ }
563
+ };
564
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
565
+ res.start = peg$source.offset(res.start);
566
+ res.end = peg$source.offset(res.end);
567
+ }
568
+ return res;
569
+ }
570
+
571
+ function peg$fail(expected) {
572
+ if (peg$currPos < peg$maxFailPos) { return; }
573
+
574
+ if (peg$currPos > peg$maxFailPos) {
575
+ peg$maxFailPos = peg$currPos;
576
+ peg$maxFailExpected = [];
577
+ }
578
+
579
+ peg$maxFailExpected.push(expected);
580
+ }
581
+
582
+ function peg$buildSimpleError(message, location) {
583
+ return new peg$SyntaxError(message, null, null, location);
584
+ }
585
+
586
+ function peg$buildStructuredError(expected, found, location) {
587
+ return new peg$SyntaxError(
588
+ peg$SyntaxError.buildMessage(expected, found),
589
+ expected,
590
+ found,
591
+ location
592
+ );
593
+ }
594
+
595
+ function peg$parseStart() {
596
+ var s0, s1, s2, s3;
597
+
598
+ s0 = peg$currPos;
599
+ s1 = peg$parse_();
600
+ s2 = peg$parsePresentation();
601
+ if (s2 !== peg$FAILED) {
602
+ s3 = peg$parse_();
603
+ peg$savedPos = s0;
604
+ s0 = peg$f0(s2);
605
+ } else {
606
+ peg$currPos = s0;
607
+ s0 = peg$FAILED;
608
+ }
609
+
610
+ return s0;
611
+ }
612
+
613
+ function peg$parsePresentation() {
614
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
615
+
616
+ s0 = peg$currPos;
617
+ if (input.substr(peg$currPos, 7) === peg$c0) {
618
+ s1 = peg$c0;
619
+ peg$currPos += 7;
620
+ } else {
621
+ s1 = peg$FAILED;
622
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
623
+ }
624
+ if (s1 !== peg$FAILED) {
625
+ s2 = peg$parse_();
626
+ s3 = peg$parseSourceType();
627
+ if (s3 !== peg$FAILED) {
628
+ s4 = peg$parse_();
629
+ s5 = peg$parseStringLiteral();
630
+ if (s5 !== peg$FAILED) {
631
+ s6 = peg$parse_();
632
+ if (input.charCodeAt(peg$currPos) === 123) {
633
+ s7 = peg$c1;
634
+ peg$currPos++;
635
+ } else {
636
+ s7 = peg$FAILED;
637
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
638
+ }
639
+ if (s7 !== peg$FAILED) {
640
+ s8 = peg$parse_();
641
+ s9 = peg$parsePresentationBody();
642
+ if (s9 !== peg$FAILED) {
643
+ s10 = peg$parse_();
644
+ if (input.charCodeAt(peg$currPos) === 125) {
645
+ s11 = peg$c2;
646
+ peg$currPos++;
647
+ } else {
648
+ s11 = peg$FAILED;
649
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
650
+ }
651
+ if (s11 !== peg$FAILED) {
652
+ peg$savedPos = s0;
653
+ s0 = peg$f1(s3, s5, s9);
654
+ } else {
655
+ peg$currPos = s0;
656
+ s0 = peg$FAILED;
657
+ }
658
+ } else {
659
+ peg$currPos = s0;
660
+ s0 = peg$FAILED;
661
+ }
662
+ } else {
663
+ peg$currPos = s0;
664
+ s0 = peg$FAILED;
665
+ }
666
+ } else {
667
+ peg$currPos = s0;
668
+ s0 = peg$FAILED;
669
+ }
670
+ } else {
671
+ peg$currPos = s0;
672
+ s0 = peg$FAILED;
673
+ }
674
+ } else {
675
+ peg$currPos = s0;
676
+ s0 = peg$FAILED;
677
+ }
678
+
679
+ return s0;
680
+ }
681
+
682
+ function peg$parseSourceType() {
683
+ var s0;
684
+
685
+ if (input.substr(peg$currPos, 4) === peg$c3) {
686
+ s0 = peg$c3;
687
+ peg$currPos += 4;
688
+ } else {
689
+ s0 = peg$FAILED;
690
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
691
+ }
692
+ if (s0 === peg$FAILED) {
693
+ if (input.substr(peg$currPos, 6) === peg$c4) {
694
+ s0 = peg$c4;
695
+ peg$currPos += 6;
696
+ } else {
697
+ s0 = peg$FAILED;
698
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
699
+ }
700
+ if (s0 === peg$FAILED) {
701
+ if (input.substr(peg$currPos, 4) === peg$c5) {
702
+ s0 = peg$c5;
703
+ peg$currPos += 4;
704
+ } else {
705
+ s0 = peg$FAILED;
706
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
707
+ }
708
+ if (s0 === peg$FAILED) {
709
+ if (input.substr(peg$currPos, 10) === peg$c6) {
710
+ s0 = peg$c6;
711
+ peg$currPos += 10;
712
+ } else {
713
+ s0 = peg$FAILED;
714
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
715
+ }
716
+ }
717
+ }
718
+ }
719
+
720
+ return s0;
721
+ }
722
+
723
+ function peg$parsePresentationBody() {
724
+ var s0, s1, s2, s3, s4, s5, s6, s7;
725
+
726
+ s0 = peg$currPos;
727
+ if (input.substr(peg$currPos, 5) === peg$c7) {
728
+ s1 = peg$c7;
729
+ peg$currPos += 5;
730
+ } else {
731
+ s1 = peg$FAILED;
732
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
733
+ }
734
+ if (s1 !== peg$FAILED) {
735
+ s2 = peg$parse_();
736
+ if (input.charCodeAt(peg$currPos) === 123) {
737
+ s3 = peg$c1;
738
+ peg$currPos++;
739
+ } else {
740
+ s3 = peg$FAILED;
741
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
742
+ }
743
+ if (s3 !== peg$FAILED) {
744
+ s4 = peg$parse_();
745
+ s5 = peg$parseRuleList();
746
+ s6 = peg$parse_();
747
+ if (input.charCodeAt(peg$currPos) === 125) {
748
+ s7 = peg$c2;
749
+ peg$currPos++;
750
+ } else {
751
+ s7 = peg$FAILED;
752
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
753
+ }
754
+ if (s7 !== peg$FAILED) {
755
+ peg$savedPos = s0;
756
+ s0 = peg$f2(s5);
757
+ } else {
758
+ peg$currPos = s0;
759
+ s0 = peg$FAILED;
760
+ }
761
+ } else {
762
+ peg$currPos = s0;
763
+ s0 = peg$FAILED;
764
+ }
765
+ } else {
766
+ peg$currPos = s0;
767
+ s0 = peg$FAILED;
768
+ }
769
+
770
+ return s0;
771
+ }
772
+
773
+ function peg$parseRuleList() {
774
+ var s0, s1, s2;
775
+
776
+ s0 = peg$currPos;
777
+ s1 = [];
778
+ s2 = peg$parseRule();
779
+ while (s2 !== peg$FAILED) {
780
+ s1.push(s2);
781
+ s2 = peg$parseRule();
782
+ }
783
+ peg$savedPos = s0;
784
+ s1 = peg$f3(s1);
785
+ s0 = s1;
786
+
787
+ return s0;
788
+ }
789
+
790
+ function peg$parseRule() {
791
+ var s0;
792
+
793
+ s0 = peg$parseStartRule();
794
+ if (s0 === peg$FAILED) {
795
+ s0 = peg$parseContentRule();
796
+ if (s0 === peg$FAILED) {
797
+ s0 = peg$parseEndRule();
798
+ }
799
+ }
800
+
801
+ return s0;
802
+ }
803
+
804
+ function peg$parseStartRule() {
805
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
806
+
807
+ s0 = peg$currPos;
808
+ if (input.substr(peg$currPos, 4) === peg$c8) {
809
+ s1 = peg$c8;
810
+ peg$currPos += 4;
811
+ } else {
812
+ s1 = peg$FAILED;
813
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
814
+ }
815
+ if (s1 !== peg$FAILED) {
816
+ s2 = peg$parse_();
817
+ if (input.substr(peg$currPos, 5) === peg$c9) {
818
+ s3 = peg$c9;
819
+ peg$currPos += 5;
820
+ } else {
821
+ s3 = peg$FAILED;
822
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
823
+ }
824
+ if (s3 !== peg$FAILED) {
825
+ s4 = peg$parse_();
826
+ s5 = peg$parseStringLiteral();
827
+ if (s5 !== peg$FAILED) {
828
+ s6 = peg$parse_();
829
+ if (input.charCodeAt(peg$currPos) === 123) {
830
+ s7 = peg$c1;
831
+ peg$currPos++;
832
+ } else {
833
+ s7 = peg$FAILED;
834
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
835
+ }
836
+ if (s7 !== peg$FAILED) {
837
+ s8 = peg$parse_();
838
+ s9 = peg$parseSlideList();
839
+ s10 = peg$parse_();
840
+ if (input.charCodeAt(peg$currPos) === 125) {
841
+ s11 = peg$c2;
842
+ peg$currPos++;
843
+ } else {
844
+ s11 = peg$FAILED;
845
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
846
+ }
847
+ if (s11 !== peg$FAILED) {
848
+ s12 = peg$parse_();
849
+ peg$savedPos = s0;
850
+ s0 = peg$f4(s5, s9);
851
+ } else {
852
+ peg$currPos = s0;
853
+ s0 = peg$FAILED;
854
+ }
855
+ } else {
856
+ peg$currPos = s0;
857
+ s0 = peg$FAILED;
858
+ }
859
+ } else {
860
+ peg$currPos = s0;
861
+ s0 = peg$FAILED;
862
+ }
863
+ } else {
864
+ peg$currPos = s0;
865
+ s0 = peg$FAILED;
866
+ }
867
+ } else {
868
+ peg$currPos = s0;
869
+ s0 = peg$FAILED;
870
+ }
871
+
872
+ return s0;
873
+ }
874
+
875
+ function peg$parseContentRule() {
876
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
877
+
878
+ s0 = peg$currPos;
879
+ if (input.substr(peg$currPos, 4) === peg$c8) {
880
+ s1 = peg$c8;
881
+ peg$currPos += 4;
882
+ } else {
883
+ s1 = peg$FAILED;
884
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
885
+ }
886
+ if (s1 !== peg$FAILED) {
887
+ s2 = peg$parse_();
888
+ if (input.substr(peg$currPos, 7) === peg$c10) {
889
+ s3 = peg$c10;
890
+ peg$currPos += 7;
891
+ } else {
892
+ s3 = peg$FAILED;
893
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
894
+ }
895
+ if (s3 !== peg$FAILED) {
896
+ s4 = peg$parse_();
897
+ s5 = peg$parseStringLiteral();
898
+ if (s5 !== peg$FAILED) {
899
+ s6 = peg$parse_();
900
+ if (input.charCodeAt(peg$currPos) === 123) {
901
+ s7 = peg$c1;
902
+ peg$currPos++;
903
+ } else {
904
+ s7 = peg$FAILED;
905
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
906
+ }
907
+ if (s7 !== peg$FAILED) {
908
+ s8 = peg$parse_();
909
+ s9 = peg$parseContentBody();
910
+ if (s9 !== peg$FAILED) {
911
+ s10 = peg$parse_();
912
+ if (input.charCodeAt(peg$currPos) === 125) {
913
+ s11 = peg$c2;
914
+ peg$currPos++;
915
+ } else {
916
+ s11 = peg$FAILED;
917
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
918
+ }
919
+ if (s11 !== peg$FAILED) {
920
+ s12 = peg$parse_();
921
+ peg$savedPos = s0;
922
+ s0 = peg$f5(s5, s9);
923
+ } else {
924
+ peg$currPos = s0;
925
+ s0 = peg$FAILED;
926
+ }
927
+ } else {
928
+ peg$currPos = s0;
929
+ s0 = peg$FAILED;
930
+ }
931
+ } else {
932
+ peg$currPos = s0;
933
+ s0 = peg$FAILED;
934
+ }
935
+ } else {
936
+ peg$currPos = s0;
937
+ s0 = peg$FAILED;
938
+ }
939
+ } else {
940
+ peg$currPos = s0;
941
+ s0 = peg$FAILED;
942
+ }
943
+ } else {
944
+ peg$currPos = s0;
945
+ s0 = peg$FAILED;
946
+ }
947
+
948
+ return s0;
949
+ }
950
+
951
+ function peg$parseEndRule() {
952
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
953
+
954
+ s0 = peg$currPos;
955
+ if (input.substr(peg$currPos, 4) === peg$c8) {
956
+ s1 = peg$c8;
957
+ peg$currPos += 4;
958
+ } else {
959
+ s1 = peg$FAILED;
960
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
961
+ }
962
+ if (s1 !== peg$FAILED) {
963
+ s2 = peg$parse_();
964
+ if (input.substr(peg$currPos, 3) === peg$c11) {
965
+ s3 = peg$c11;
966
+ peg$currPos += 3;
967
+ } else {
968
+ s3 = peg$FAILED;
969
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
970
+ }
971
+ if (s3 !== peg$FAILED) {
972
+ s4 = peg$parse_();
973
+ s5 = peg$parseStringLiteral();
974
+ if (s5 !== peg$FAILED) {
975
+ s6 = peg$parse_();
976
+ if (input.charCodeAt(peg$currPos) === 123) {
977
+ s7 = peg$c1;
978
+ peg$currPos++;
979
+ } else {
980
+ s7 = peg$FAILED;
981
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
982
+ }
983
+ if (s7 !== peg$FAILED) {
984
+ s8 = peg$parse_();
985
+ s9 = peg$parseSlideList();
986
+ s10 = peg$parse_();
987
+ if (input.charCodeAt(peg$currPos) === 125) {
988
+ s11 = peg$c2;
989
+ peg$currPos++;
990
+ } else {
991
+ s11 = peg$FAILED;
992
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
993
+ }
994
+ if (s11 !== peg$FAILED) {
995
+ s12 = peg$parse_();
996
+ peg$savedPos = s0;
997
+ s0 = peg$f6(s5, s9);
998
+ } else {
999
+ peg$currPos = s0;
1000
+ s0 = peg$FAILED;
1001
+ }
1002
+ } else {
1003
+ peg$currPos = s0;
1004
+ s0 = peg$FAILED;
1005
+ }
1006
+ } else {
1007
+ peg$currPos = s0;
1008
+ s0 = peg$FAILED;
1009
+ }
1010
+ } else {
1011
+ peg$currPos = s0;
1012
+ s0 = peg$FAILED;
1013
+ }
1014
+ } else {
1015
+ peg$currPos = s0;
1016
+ s0 = peg$FAILED;
1017
+ }
1018
+
1019
+ return s0;
1020
+ }
1021
+
1022
+ function peg$parseContentBody() {
1023
+ var s0;
1024
+
1025
+ s0 = peg$parseForLoop();
1026
+ if (s0 === peg$FAILED) {
1027
+ s0 = peg$parseSlideList();
1028
+ }
1029
+
1030
+ return s0;
1031
+ }
1032
+
1033
+ function peg$parseForLoop() {
1034
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
1035
+
1036
+ s0 = peg$currPos;
1037
+ if (input.substr(peg$currPos, 3) === peg$c12) {
1038
+ s1 = peg$c12;
1039
+ peg$currPos += 3;
1040
+ } else {
1041
+ s1 = peg$FAILED;
1042
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1043
+ }
1044
+ if (s1 !== peg$FAILED) {
1045
+ s2 = peg$parse_();
1046
+ s3 = peg$parseIdentifier();
1047
+ if (s3 !== peg$FAILED) {
1048
+ s4 = peg$parse_();
1049
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1050
+ s5 = peg$c13;
1051
+ peg$currPos += 2;
1052
+ } else {
1053
+ s5 = peg$FAILED;
1054
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1055
+ }
1056
+ if (s5 !== peg$FAILED) {
1057
+ s6 = peg$parse_();
1058
+ s7 = peg$parsePathExpression();
1059
+ if (s7 !== peg$FAILED) {
1060
+ s8 = peg$parse_();
1061
+ if (input.charCodeAt(peg$currPos) === 123) {
1062
+ s9 = peg$c1;
1063
+ peg$currPos++;
1064
+ } else {
1065
+ s9 = peg$FAILED;
1066
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1067
+ }
1068
+ if (s9 !== peg$FAILED) {
1069
+ s10 = peg$parse_();
1070
+ s11 = peg$parseForLoopBody();
1071
+ if (s11 !== peg$FAILED) {
1072
+ s12 = peg$parse_();
1073
+ if (input.charCodeAt(peg$currPos) === 125) {
1074
+ s13 = peg$c2;
1075
+ peg$currPos++;
1076
+ } else {
1077
+ s13 = peg$FAILED;
1078
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1079
+ }
1080
+ if (s13 !== peg$FAILED) {
1081
+ s14 = peg$parse_();
1082
+ peg$savedPos = s0;
1083
+ s0 = peg$f7(s3, s7, s11);
1084
+ } else {
1085
+ peg$currPos = s0;
1086
+ s0 = peg$FAILED;
1087
+ }
1088
+ } else {
1089
+ peg$currPos = s0;
1090
+ s0 = peg$FAILED;
1091
+ }
1092
+ } else {
1093
+ peg$currPos = s0;
1094
+ s0 = peg$FAILED;
1095
+ }
1096
+ } else {
1097
+ peg$currPos = s0;
1098
+ s0 = peg$FAILED;
1099
+ }
1100
+ } else {
1101
+ peg$currPos = s0;
1102
+ s0 = peg$FAILED;
1103
+ }
1104
+ } else {
1105
+ peg$currPos = s0;
1106
+ s0 = peg$FAILED;
1107
+ }
1108
+ } else {
1109
+ peg$currPos = s0;
1110
+ s0 = peg$FAILED;
1111
+ }
1112
+
1113
+ return s0;
1114
+ }
1115
+
1116
+ function peg$parseForLoopBody() {
1117
+ var s0;
1118
+
1119
+ s0 = peg$parseNestedForLoop();
1120
+ if (s0 === peg$FAILED) {
1121
+ s0 = peg$parseSlideList();
1122
+ }
1123
+
1124
+ return s0;
1125
+ }
1126
+
1127
+ function peg$parseNestedForLoop() {
1128
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
1129
+
1130
+ s0 = peg$currPos;
1131
+ if (input.substr(peg$currPos, 3) === peg$c12) {
1132
+ s1 = peg$c12;
1133
+ peg$currPos += 3;
1134
+ } else {
1135
+ s1 = peg$FAILED;
1136
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1137
+ }
1138
+ if (s1 !== peg$FAILED) {
1139
+ s2 = peg$parse_();
1140
+ s3 = peg$parseIdentifier();
1141
+ if (s3 !== peg$FAILED) {
1142
+ s4 = peg$parse_();
1143
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1144
+ s5 = peg$c13;
1145
+ peg$currPos += 2;
1146
+ } else {
1147
+ s5 = peg$FAILED;
1148
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1149
+ }
1150
+ if (s5 !== peg$FAILED) {
1151
+ s6 = peg$parse_();
1152
+ s7 = peg$parsePathExpression();
1153
+ if (s7 !== peg$FAILED) {
1154
+ s8 = peg$parse_();
1155
+ if (input.charCodeAt(peg$currPos) === 123) {
1156
+ s9 = peg$c1;
1157
+ peg$currPos++;
1158
+ } else {
1159
+ s9 = peg$FAILED;
1160
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1161
+ }
1162
+ if (s9 !== peg$FAILED) {
1163
+ s10 = peg$parse_();
1164
+ s11 = peg$parseSlideList();
1165
+ s12 = peg$parse_();
1166
+ if (input.charCodeAt(peg$currPos) === 125) {
1167
+ s13 = peg$c2;
1168
+ peg$currPos++;
1169
+ } else {
1170
+ s13 = peg$FAILED;
1171
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1172
+ }
1173
+ if (s13 !== peg$FAILED) {
1174
+ s14 = peg$parse_();
1175
+ peg$savedPos = s0;
1176
+ s0 = peg$f8(s3, s7, s11);
1177
+ } else {
1178
+ peg$currPos = s0;
1179
+ s0 = peg$FAILED;
1180
+ }
1181
+ } else {
1182
+ peg$currPos = s0;
1183
+ s0 = peg$FAILED;
1184
+ }
1185
+ } else {
1186
+ peg$currPos = s0;
1187
+ s0 = peg$FAILED;
1188
+ }
1189
+ } else {
1190
+ peg$currPos = s0;
1191
+ s0 = peg$FAILED;
1192
+ }
1193
+ } else {
1194
+ peg$currPos = s0;
1195
+ s0 = peg$FAILED;
1196
+ }
1197
+ } else {
1198
+ peg$currPos = s0;
1199
+ s0 = peg$FAILED;
1200
+ }
1201
+
1202
+ return s0;
1203
+ }
1204
+
1205
+ function peg$parseSlideList() {
1206
+ var s0, s1, s2;
1207
+
1208
+ s0 = peg$currPos;
1209
+ s1 = [];
1210
+ s2 = peg$parseSlide();
1211
+ while (s2 !== peg$FAILED) {
1212
+ s1.push(s2);
1213
+ s2 = peg$parseSlide();
1214
+ }
1215
+ peg$savedPos = s0;
1216
+ s1 = peg$f9(s1);
1217
+ s0 = s1;
1218
+
1219
+ return s0;
1220
+ }
1221
+
1222
+ function peg$parseSlide() {
1223
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
1224
+
1225
+ s0 = peg$currPos;
1226
+ if (input.substr(peg$currPos, 5) === peg$c14) {
1227
+ s1 = peg$c14;
1228
+ peg$currPos += 5;
1229
+ } else {
1230
+ s1 = peg$FAILED;
1231
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1232
+ }
1233
+ if (s1 !== peg$FAILED) {
1234
+ s2 = peg$parse_();
1235
+ if (input.charCodeAt(peg$currPos) === 123) {
1236
+ s3 = peg$c1;
1237
+ peg$currPos++;
1238
+ } else {
1239
+ s3 = peg$FAILED;
1240
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1241
+ }
1242
+ if (s3 !== peg$FAILED) {
1243
+ s4 = peg$parse_();
1244
+ s5 = peg$parseContent();
1245
+ if (s5 !== peg$FAILED) {
1246
+ s6 = peg$parse_();
1247
+ s7 = peg$parseBehavior();
1248
+ if (s7 === peg$FAILED) {
1249
+ s7 = null;
1250
+ }
1251
+ s8 = peg$parse_();
1252
+ if (input.charCodeAt(peg$currPos) === 125) {
1253
+ s9 = peg$c2;
1254
+ peg$currPos++;
1255
+ } else {
1256
+ s9 = peg$FAILED;
1257
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1258
+ }
1259
+ if (s9 !== peg$FAILED) {
1260
+ s10 = peg$parse_();
1261
+ peg$savedPos = s0;
1262
+ s0 = peg$f10(s5, s7);
1263
+ } else {
1264
+ peg$currPos = s0;
1265
+ s0 = peg$FAILED;
1266
+ }
1267
+ } else {
1268
+ peg$currPos = s0;
1269
+ s0 = peg$FAILED;
1270
+ }
1271
+ } else {
1272
+ peg$currPos = s0;
1273
+ s0 = peg$FAILED;
1274
+ }
1275
+ } else {
1276
+ peg$currPos = s0;
1277
+ s0 = peg$FAILED;
1278
+ }
1279
+
1280
+ return s0;
1281
+ }
1282
+
1283
+ function peg$parseContent() {
1284
+ var s0;
1285
+
1286
+ s0 = peg$parseDynamicContent();
1287
+ if (s0 === peg$FAILED) {
1288
+ s0 = peg$parseTextContent();
1289
+ }
1290
+
1291
+ return s0;
1292
+ }
1293
+
1294
+ function peg$parseDynamicContent() {
1295
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
1296
+
1297
+ s0 = peg$currPos;
1298
+ if (input.substr(peg$currPos, 7) === peg$c10) {
1299
+ s1 = peg$c10;
1300
+ peg$currPos += 7;
1301
+ } else {
1302
+ s1 = peg$FAILED;
1303
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1304
+ }
1305
+ if (s1 !== peg$FAILED) {
1306
+ s2 = peg$parse_();
1307
+ if (input.substr(peg$currPos, 7) === peg$c15) {
1308
+ s3 = peg$c15;
1309
+ peg$currPos += 7;
1310
+ } else {
1311
+ s3 = peg$FAILED;
1312
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1313
+ }
1314
+ if (s3 !== peg$FAILED) {
1315
+ s4 = peg$parse_();
1316
+ if (input.charCodeAt(peg$currPos) === 123) {
1317
+ s5 = peg$c1;
1318
+ peg$currPos++;
1319
+ } else {
1320
+ s5 = peg$FAILED;
1321
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1322
+ }
1323
+ if (s5 !== peg$FAILED) {
1324
+ s6 = peg$parse_();
1325
+ s7 = peg$parseComponentName();
1326
+ if (s7 !== peg$FAILED) {
1327
+ s8 = peg$parse_();
1328
+ s9 = peg$parseAttrs();
1329
+ if (s9 !== peg$FAILED) {
1330
+ s10 = peg$parse_();
1331
+ if (input.charCodeAt(peg$currPos) === 125) {
1332
+ s11 = peg$c2;
1333
+ peg$currPos++;
1334
+ } else {
1335
+ s11 = peg$FAILED;
1336
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1337
+ }
1338
+ if (s11 !== peg$FAILED) {
1339
+ s12 = peg$parse_();
1340
+ peg$savedPos = s0;
1341
+ s0 = peg$f11(s7, s9);
1342
+ } else {
1343
+ peg$currPos = s0;
1344
+ s0 = peg$FAILED;
1345
+ }
1346
+ } else {
1347
+ peg$currPos = s0;
1348
+ s0 = peg$FAILED;
1349
+ }
1350
+ } else {
1351
+ peg$currPos = s0;
1352
+ s0 = peg$FAILED;
1353
+ }
1354
+ } else {
1355
+ peg$currPos = s0;
1356
+ s0 = peg$FAILED;
1357
+ }
1358
+ } else {
1359
+ peg$currPos = s0;
1360
+ s0 = peg$FAILED;
1361
+ }
1362
+ } else {
1363
+ peg$currPos = s0;
1364
+ s0 = peg$FAILED;
1365
+ }
1366
+
1367
+ return s0;
1368
+ }
1369
+
1370
+ function peg$parseTextContent() {
1371
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
1372
+
1373
+ s0 = peg$currPos;
1374
+ if (input.substr(peg$currPos, 7) === peg$c10) {
1375
+ s1 = peg$c10;
1376
+ peg$currPos += 7;
1377
+ } else {
1378
+ s1 = peg$FAILED;
1379
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1380
+ }
1381
+ if (s1 !== peg$FAILED) {
1382
+ s2 = peg$parse_();
1383
+ if (input.substr(peg$currPos, 4) === peg$c16) {
1384
+ s3 = peg$c16;
1385
+ peg$currPos += 4;
1386
+ } else {
1387
+ s3 = peg$FAILED;
1388
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1389
+ }
1390
+ if (s3 !== peg$FAILED) {
1391
+ s4 = peg$parse_();
1392
+ if (input.charCodeAt(peg$currPos) === 123) {
1393
+ s5 = peg$c1;
1394
+ peg$currPos++;
1395
+ } else {
1396
+ s5 = peg$FAILED;
1397
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1398
+ }
1399
+ if (s5 !== peg$FAILED) {
1400
+ s6 = peg$parse_();
1401
+ s7 = peg$parseTextLineList();
1402
+ s8 = peg$parse_();
1403
+ if (input.charCodeAt(peg$currPos) === 125) {
1404
+ s9 = peg$c2;
1405
+ peg$currPos++;
1406
+ } else {
1407
+ s9 = peg$FAILED;
1408
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1409
+ }
1410
+ if (s9 !== peg$FAILED) {
1411
+ s10 = peg$parse_();
1412
+ peg$savedPos = s0;
1413
+ s0 = peg$f12(s7);
1414
+ } else {
1415
+ peg$currPos = s0;
1416
+ s0 = peg$FAILED;
1417
+ }
1418
+ } else {
1419
+ peg$currPos = s0;
1420
+ s0 = peg$FAILED;
1421
+ }
1422
+ } else {
1423
+ peg$currPos = s0;
1424
+ s0 = peg$FAILED;
1425
+ }
1426
+ } else {
1427
+ peg$currPos = s0;
1428
+ s0 = peg$FAILED;
1429
+ }
1430
+
1431
+ return s0;
1432
+ }
1433
+
1434
+ function peg$parseComponentName() {
1435
+ var s0, s1, s2, s3, s4, s5;
1436
+
1437
+ s0 = peg$currPos;
1438
+ if (input.substr(peg$currPos, 4) === peg$c17) {
1439
+ s1 = peg$c17;
1440
+ peg$currPos += 4;
1441
+ } else {
1442
+ s1 = peg$FAILED;
1443
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1444
+ }
1445
+ if (s1 !== peg$FAILED) {
1446
+ s2 = peg$parse_();
1447
+ if (input.charCodeAt(peg$currPos) === 58) {
1448
+ s3 = peg$c18;
1449
+ peg$currPos++;
1450
+ } else {
1451
+ s3 = peg$FAILED;
1452
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1453
+ }
1454
+ if (s3 !== peg$FAILED) {
1455
+ s4 = peg$parse_();
1456
+ s5 = peg$parseStringLiteral();
1457
+ if (s5 !== peg$FAILED) {
1458
+ peg$savedPos = s0;
1459
+ s0 = peg$f13(s5);
1460
+ } else {
1461
+ peg$currPos = s0;
1462
+ s0 = peg$FAILED;
1463
+ }
1464
+ } else {
1465
+ peg$currPos = s0;
1466
+ s0 = peg$FAILED;
1467
+ }
1468
+ } else {
1469
+ peg$currPos = s0;
1470
+ s0 = peg$FAILED;
1471
+ }
1472
+
1473
+ return s0;
1474
+ }
1475
+
1476
+ function peg$parseAttrs() {
1477
+ var s0, s1, s2, s3, s4, s5, s6, s7;
1478
+
1479
+ s0 = peg$currPos;
1480
+ if (input.substr(peg$currPos, 5) === peg$c19) {
1481
+ s1 = peg$c19;
1482
+ peg$currPos += 5;
1483
+ } else {
1484
+ s1 = peg$FAILED;
1485
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1486
+ }
1487
+ if (s1 !== peg$FAILED) {
1488
+ s2 = peg$parse_();
1489
+ if (input.charCodeAt(peg$currPos) === 123) {
1490
+ s3 = peg$c1;
1491
+ peg$currPos++;
1492
+ } else {
1493
+ s3 = peg$FAILED;
1494
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1495
+ }
1496
+ if (s3 !== peg$FAILED) {
1497
+ s4 = peg$parse_();
1498
+ s5 = peg$parseAttrList();
1499
+ s6 = peg$parse_();
1500
+ if (input.charCodeAt(peg$currPos) === 125) {
1501
+ s7 = peg$c2;
1502
+ peg$currPos++;
1503
+ } else {
1504
+ s7 = peg$FAILED;
1505
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1506
+ }
1507
+ if (s7 !== peg$FAILED) {
1508
+ peg$savedPos = s0;
1509
+ s0 = peg$f14(s5);
1510
+ } else {
1511
+ peg$currPos = s0;
1512
+ s0 = peg$FAILED;
1513
+ }
1514
+ } else {
1515
+ peg$currPos = s0;
1516
+ s0 = peg$FAILED;
1517
+ }
1518
+ } else {
1519
+ peg$currPos = s0;
1520
+ s0 = peg$FAILED;
1521
+ }
1522
+
1523
+ return s0;
1524
+ }
1525
+
1526
+ function peg$parseAttrList() {
1527
+ var s0, s1, s2;
1528
+
1529
+ s0 = peg$currPos;
1530
+ s1 = [];
1531
+ s2 = peg$parseAttr();
1532
+ while (s2 !== peg$FAILED) {
1533
+ s1.push(s2);
1534
+ s2 = peg$parseAttr();
1535
+ }
1536
+ peg$savedPos = s0;
1537
+ s1 = peg$f15(s1);
1538
+ s0 = s1;
1539
+
1540
+ return s0;
1541
+ }
1542
+
1543
+ function peg$parseAttr() {
1544
+ var s0, s1, s2, s3, s4, s5, s6;
1545
+
1546
+ s0 = peg$currPos;
1547
+ s1 = peg$parseAttrKey();
1548
+ if (s1 !== peg$FAILED) {
1549
+ s2 = peg$parse_();
1550
+ if (input.charCodeAt(peg$currPos) === 58) {
1551
+ s3 = peg$c18;
1552
+ peg$currPos++;
1553
+ } else {
1554
+ s3 = peg$FAILED;
1555
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1556
+ }
1557
+ if (s3 !== peg$FAILED) {
1558
+ s4 = peg$parse_();
1559
+ s5 = peg$parseAttrValue();
1560
+ if (s5 !== peg$FAILED) {
1561
+ s6 = peg$parse_();
1562
+ peg$savedPos = s0;
1563
+ s0 = peg$f16(s1, s5);
1564
+ } else {
1565
+ peg$currPos = s0;
1566
+ s0 = peg$FAILED;
1567
+ }
1568
+ } else {
1569
+ peg$currPos = s0;
1570
+ s0 = peg$FAILED;
1571
+ }
1572
+ } else {
1573
+ peg$currPos = s0;
1574
+ s0 = peg$FAILED;
1575
+ }
1576
+
1577
+ return s0;
1578
+ }
1579
+
1580
+ function peg$parseAttrValue() {
1581
+ var s0;
1582
+
1583
+ s0 = peg$parseStringLiteral();
1584
+ if (s0 === peg$FAILED) {
1585
+ s0 = peg$parseNumberLiteral();
1586
+ if (s0 === peg$FAILED) {
1587
+ s0 = peg$parseBooleanLiteral();
1588
+ if (s0 === peg$FAILED) {
1589
+ s0 = peg$parsePathExpression();
1590
+ }
1591
+ }
1592
+ }
1593
+
1594
+ return s0;
1595
+ }
1596
+
1597
+ function peg$parseAttrKey() {
1598
+ var s0, s1, s2, s3;
1599
+
1600
+ s0 = peg$currPos;
1601
+ s1 = input.charAt(peg$currPos);
1602
+ if (peg$r0.test(s1)) {
1603
+ peg$currPos++;
1604
+ } else {
1605
+ s1 = peg$FAILED;
1606
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
1607
+ }
1608
+ if (s1 !== peg$FAILED) {
1609
+ s2 = [];
1610
+ s3 = input.charAt(peg$currPos);
1611
+ if (peg$r1.test(s3)) {
1612
+ peg$currPos++;
1613
+ } else {
1614
+ s3 = peg$FAILED;
1615
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
1616
+ }
1617
+ while (s3 !== peg$FAILED) {
1618
+ s2.push(s3);
1619
+ s3 = input.charAt(peg$currPos);
1620
+ if (peg$r1.test(s3)) {
1621
+ peg$currPos++;
1622
+ } else {
1623
+ s3 = peg$FAILED;
1624
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
1625
+ }
1626
+ }
1627
+ peg$savedPos = s0;
1628
+ s0 = peg$f17(s1, s2);
1629
+ } else {
1630
+ peg$currPos = s0;
1631
+ s0 = peg$FAILED;
1632
+ }
1633
+
1634
+ return s0;
1635
+ }
1636
+
1637
+ function peg$parseTextLineList() {
1638
+ var s0, s1, s2;
1639
+
1640
+ s0 = peg$currPos;
1641
+ s1 = [];
1642
+ s2 = peg$parseTextLine();
1643
+ while (s2 !== peg$FAILED) {
1644
+ s1.push(s2);
1645
+ s2 = peg$parseTextLine();
1646
+ }
1647
+ peg$savedPos = s0;
1648
+ s1 = peg$f18(s1);
1649
+ s0 = s1;
1650
+
1651
+ return s0;
1652
+ }
1653
+
1654
+ function peg$parseTextLine() {
1655
+ var s0, s1, s2;
1656
+
1657
+ s0 = peg$currPos;
1658
+ s1 = peg$parseExpression();
1659
+ if (s1 !== peg$FAILED) {
1660
+ s2 = peg$parse_();
1661
+ peg$savedPos = s0;
1662
+ s0 = peg$f19(s1);
1663
+ } else {
1664
+ peg$currPos = s0;
1665
+ s0 = peg$FAILED;
1666
+ }
1667
+
1668
+ return s0;
1669
+ }
1670
+
1671
+ function peg$parseBehavior() {
1672
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8;
1673
+
1674
+ s0 = peg$currPos;
1675
+ if (input.substr(peg$currPos, 8) === peg$c20) {
1676
+ s1 = peg$c20;
1677
+ peg$currPos += 8;
1678
+ } else {
1679
+ s1 = peg$FAILED;
1680
+ if (peg$silentFails === 0) { peg$fail(peg$e22); }
1681
+ }
1682
+ if (s1 !== peg$FAILED) {
1683
+ s2 = peg$parse_();
1684
+ if (input.charCodeAt(peg$currPos) === 123) {
1685
+ s3 = peg$c1;
1686
+ peg$currPos++;
1687
+ } else {
1688
+ s3 = peg$FAILED;
1689
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1690
+ }
1691
+ if (s3 !== peg$FAILED) {
1692
+ s4 = peg$parse_();
1693
+ s5 = peg$parseTransition();
1694
+ if (s5 !== peg$FAILED) {
1695
+ s6 = peg$parse_();
1696
+ if (input.charCodeAt(peg$currPos) === 125) {
1697
+ s7 = peg$c2;
1698
+ peg$currPos++;
1699
+ } else {
1700
+ s7 = peg$FAILED;
1701
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1702
+ }
1703
+ if (s7 !== peg$FAILED) {
1704
+ s8 = peg$parse_();
1705
+ peg$savedPos = s0;
1706
+ s0 = peg$f20(s5);
1707
+ } else {
1708
+ peg$currPos = s0;
1709
+ s0 = peg$FAILED;
1710
+ }
1711
+ } else {
1712
+ peg$currPos = s0;
1713
+ s0 = peg$FAILED;
1714
+ }
1715
+ } else {
1716
+ peg$currPos = s0;
1717
+ s0 = peg$FAILED;
1718
+ }
1719
+ } else {
1720
+ peg$currPos = s0;
1721
+ s0 = peg$FAILED;
1722
+ }
1723
+
1724
+ return s0;
1725
+ }
1726
+
1727
+ function peg$parseTransition() {
1728
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
1729
+
1730
+ s0 = peg$currPos;
1731
+ if (input.substr(peg$currPos, 10) === peg$c21) {
1732
+ s1 = peg$c21;
1733
+ peg$currPos += 10;
1734
+ } else {
1735
+ s1 = peg$FAILED;
1736
+ if (peg$silentFails === 0) { peg$fail(peg$e23); }
1737
+ }
1738
+ if (s1 !== peg$FAILED) {
1739
+ s2 = peg$parse_();
1740
+ s3 = peg$parseTransitionType();
1741
+ if (s3 !== peg$FAILED) {
1742
+ s4 = peg$parse_();
1743
+ if (input.charCodeAt(peg$currPos) === 123) {
1744
+ s5 = peg$c1;
1745
+ peg$currPos++;
1746
+ } else {
1747
+ s5 = peg$FAILED;
1748
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1749
+ }
1750
+ if (s5 !== peg$FAILED) {
1751
+ s6 = peg$parse_();
1752
+ s7 = peg$parseTransitionOptions();
1753
+ s8 = peg$parse_();
1754
+ if (input.charCodeAt(peg$currPos) === 125) {
1755
+ s9 = peg$c2;
1756
+ peg$currPos++;
1757
+ } else {
1758
+ s9 = peg$FAILED;
1759
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1760
+ }
1761
+ if (s9 !== peg$FAILED) {
1762
+ s10 = peg$parse_();
1763
+ peg$savedPos = s0;
1764
+ s0 = peg$f21(s3, s7);
1765
+ } else {
1766
+ peg$currPos = s0;
1767
+ s0 = peg$FAILED;
1768
+ }
1769
+ } else {
1770
+ peg$currPos = s0;
1771
+ s0 = peg$FAILED;
1772
+ }
1773
+ } else {
1774
+ peg$currPos = s0;
1775
+ s0 = peg$FAILED;
1776
+ }
1777
+ } else {
1778
+ peg$currPos = s0;
1779
+ s0 = peg$FAILED;
1780
+ }
1781
+
1782
+ return s0;
1783
+ }
1784
+
1785
+ function peg$parseTransitionType() {
1786
+ var s0, s1, s2, s3;
1787
+
1788
+ s0 = peg$currPos;
1789
+ s1 = input.charAt(peg$currPos);
1790
+ if (peg$r0.test(s1)) {
1791
+ peg$currPos++;
1792
+ } else {
1793
+ s1 = peg$FAILED;
1794
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
1795
+ }
1796
+ if (s1 !== peg$FAILED) {
1797
+ s2 = [];
1798
+ s3 = input.charAt(peg$currPos);
1799
+ if (peg$r1.test(s3)) {
1800
+ peg$currPos++;
1801
+ } else {
1802
+ s3 = peg$FAILED;
1803
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
1804
+ }
1805
+ while (s3 !== peg$FAILED) {
1806
+ s2.push(s3);
1807
+ s3 = input.charAt(peg$currPos);
1808
+ if (peg$r1.test(s3)) {
1809
+ peg$currPos++;
1810
+ } else {
1811
+ s3 = peg$FAILED;
1812
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
1813
+ }
1814
+ }
1815
+ peg$savedPos = s0;
1816
+ s0 = peg$f22(s1, s2);
1817
+ } else {
1818
+ peg$currPos = s0;
1819
+ s0 = peg$FAILED;
1820
+ }
1821
+
1822
+ return s0;
1823
+ }
1824
+
1825
+ function peg$parseTransitionOptions() {
1826
+ var s0, s1, s2;
1827
+
1828
+ s0 = peg$currPos;
1829
+ s1 = [];
1830
+ s2 = peg$parseTransitionOption();
1831
+ while (s2 !== peg$FAILED) {
1832
+ s1.push(s2);
1833
+ s2 = peg$parseTransitionOption();
1834
+ }
1835
+ peg$savedPos = s0;
1836
+ s1 = peg$f23(s1);
1837
+ s0 = s1;
1838
+
1839
+ return s0;
1840
+ }
1841
+
1842
+ function peg$parseTransitionOption() {
1843
+ var s0, s1, s2, s3, s4, s5, s6;
1844
+
1845
+ s0 = peg$currPos;
1846
+ s1 = peg$parseIdentifier();
1847
+ if (s1 !== peg$FAILED) {
1848
+ s2 = peg$parse_();
1849
+ if (input.charCodeAt(peg$currPos) === 58) {
1850
+ s3 = peg$c18;
1851
+ peg$currPos++;
1852
+ } else {
1853
+ s3 = peg$FAILED;
1854
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1855
+ }
1856
+ if (s3 !== peg$FAILED) {
1857
+ s4 = peg$parse_();
1858
+ s5 = peg$parseExpression();
1859
+ if (s5 !== peg$FAILED) {
1860
+ s6 = peg$parse_();
1861
+ peg$savedPos = s0;
1862
+ s0 = peg$f24(s1, s5);
1863
+ } else {
1864
+ peg$currPos = s0;
1865
+ s0 = peg$FAILED;
1866
+ }
1867
+ } else {
1868
+ peg$currPos = s0;
1869
+ s0 = peg$FAILED;
1870
+ }
1871
+ } else {
1872
+ peg$currPos = s0;
1873
+ s0 = peg$FAILED;
1874
+ }
1875
+
1876
+ return s0;
1877
+ }
1878
+
1879
+ function peg$parseExpression() {
1880
+ var s0;
1881
+
1882
+ s0 = peg$parseBinaryExpression();
1883
+ if (s0 === peg$FAILED) {
1884
+ s0 = peg$parsePrimaryExpression();
1885
+ }
1886
+
1887
+ return s0;
1888
+ }
1889
+
1890
+ function peg$parseBinaryExpression() {
1891
+ var s0, s1, s2, s3, s4, s5;
1892
+
1893
+ s0 = peg$currPos;
1894
+ s1 = peg$parsePrimaryExpression();
1895
+ if (s1 !== peg$FAILED) {
1896
+ s2 = peg$parse_();
1897
+ if (input.charCodeAt(peg$currPos) === 43) {
1898
+ s3 = peg$c22;
1899
+ peg$currPos++;
1900
+ } else {
1901
+ s3 = peg$FAILED;
1902
+ if (peg$silentFails === 0) { peg$fail(peg$e24); }
1903
+ }
1904
+ if (s3 !== peg$FAILED) {
1905
+ s4 = peg$parse_();
1906
+ s5 = peg$parseExpression();
1907
+ if (s5 !== peg$FAILED) {
1908
+ peg$savedPos = s0;
1909
+ s0 = peg$f25(s1, s5);
1910
+ } else {
1911
+ peg$currPos = s0;
1912
+ s0 = peg$FAILED;
1913
+ }
1914
+ } else {
1915
+ peg$currPos = s0;
1916
+ s0 = peg$FAILED;
1917
+ }
1918
+ } else {
1919
+ peg$currPos = s0;
1920
+ s0 = peg$FAILED;
1921
+ }
1922
+
1923
+ return s0;
1924
+ }
1925
+
1926
+ function peg$parsePrimaryExpression() {
1927
+ var s0;
1928
+
1929
+ s0 = peg$parseStringLiteral();
1930
+ if (s0 === peg$FAILED) {
1931
+ s0 = peg$parseNumberLiteral();
1932
+ if (s0 === peg$FAILED) {
1933
+ s0 = peg$parseBooleanLiteral();
1934
+ if (s0 === peg$FAILED) {
1935
+ s0 = peg$parsePathExpression();
1936
+ }
1937
+ }
1938
+ }
1939
+
1940
+ return s0;
1941
+ }
1942
+
1943
+ function peg$parsePathExpression() {
1944
+ var s0, s1, s2, s3, s4, s5;
1945
+
1946
+ s0 = peg$currPos;
1947
+ s1 = peg$parseIdentifier();
1948
+ if (s1 !== peg$FAILED) {
1949
+ s2 = [];
1950
+ s3 = peg$currPos;
1951
+ if (input.charCodeAt(peg$currPos) === 46) {
1952
+ s4 = peg$c23;
1953
+ peg$currPos++;
1954
+ } else {
1955
+ s4 = peg$FAILED;
1956
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
1957
+ }
1958
+ if (s4 !== peg$FAILED) {
1959
+ s5 = peg$parsePropertyName();
1960
+ if (s5 !== peg$FAILED) {
1961
+ s4 = [s4, s5];
1962
+ s3 = s4;
1963
+ } else {
1964
+ peg$currPos = s3;
1965
+ s3 = peg$FAILED;
1966
+ }
1967
+ } else {
1968
+ peg$currPos = s3;
1969
+ s3 = peg$FAILED;
1970
+ }
1971
+ if (s3 !== peg$FAILED) {
1972
+ while (s3 !== peg$FAILED) {
1973
+ s2.push(s3);
1974
+ s3 = peg$currPos;
1975
+ if (input.charCodeAt(peg$currPos) === 46) {
1976
+ s4 = peg$c23;
1977
+ peg$currPos++;
1978
+ } else {
1979
+ s4 = peg$FAILED;
1980
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
1981
+ }
1982
+ if (s4 !== peg$FAILED) {
1983
+ s5 = peg$parsePropertyName();
1984
+ if (s5 !== peg$FAILED) {
1985
+ s4 = [s4, s5];
1986
+ s3 = s4;
1987
+ } else {
1988
+ peg$currPos = s3;
1989
+ s3 = peg$FAILED;
1990
+ }
1991
+ } else {
1992
+ peg$currPos = s3;
1993
+ s3 = peg$FAILED;
1994
+ }
1995
+ }
1996
+ } else {
1997
+ s2 = peg$FAILED;
1998
+ }
1999
+ if (s2 !== peg$FAILED) {
2000
+ peg$savedPos = s0;
2001
+ s0 = peg$f26(s1, s2);
2002
+ } else {
2003
+ peg$currPos = s0;
2004
+ s0 = peg$FAILED;
2005
+ }
2006
+ } else {
2007
+ peg$currPos = s0;
2008
+ s0 = peg$FAILED;
2009
+ }
2010
+ if (s0 === peg$FAILED) {
2011
+ s0 = peg$currPos;
2012
+ s1 = peg$parseIdentifier();
2013
+ if (s1 !== peg$FAILED) {
2014
+ peg$savedPos = s0;
2015
+ s1 = peg$f27(s1);
2016
+ }
2017
+ s0 = s1;
2018
+ }
2019
+
2020
+ return s0;
2021
+ }
2022
+
2023
+ function peg$parsePropertyName() {
2024
+ var s0, s1, s2, s3;
2025
+
2026
+ s0 = peg$currPos;
2027
+ s1 = input.charAt(peg$currPos);
2028
+ if (peg$r0.test(s1)) {
2029
+ peg$currPos++;
2030
+ } else {
2031
+ s1 = peg$FAILED;
2032
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
2033
+ }
2034
+ if (s1 !== peg$FAILED) {
2035
+ s2 = [];
2036
+ s3 = input.charAt(peg$currPos);
2037
+ if (peg$r1.test(s3)) {
2038
+ peg$currPos++;
2039
+ } else {
2040
+ s3 = peg$FAILED;
2041
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2042
+ }
2043
+ while (s3 !== peg$FAILED) {
2044
+ s2.push(s3);
2045
+ s3 = input.charAt(peg$currPos);
2046
+ if (peg$r1.test(s3)) {
2047
+ peg$currPos++;
2048
+ } else {
2049
+ s3 = peg$FAILED;
2050
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2051
+ }
2052
+ }
2053
+ peg$savedPos = s0;
2054
+ s0 = peg$f28(s1, s2);
2055
+ } else {
2056
+ peg$currPos = s0;
2057
+ s0 = peg$FAILED;
2058
+ }
2059
+
2060
+ return s0;
2061
+ }
2062
+
2063
+ function peg$parseIdentifier() {
2064
+ var s0, s1, s2, s3, s4;
2065
+
2066
+ s0 = peg$currPos;
2067
+ s1 = peg$currPos;
2068
+ peg$silentFails++;
2069
+ s2 = peg$parseReservedWord();
2070
+ peg$silentFails--;
2071
+ if (s2 === peg$FAILED) {
2072
+ s1 = undefined;
2073
+ } else {
2074
+ peg$currPos = s1;
2075
+ s1 = peg$FAILED;
2076
+ }
2077
+ if (s1 !== peg$FAILED) {
2078
+ s2 = input.charAt(peg$currPos);
2079
+ if (peg$r0.test(s2)) {
2080
+ peg$currPos++;
2081
+ } else {
2082
+ s2 = peg$FAILED;
2083
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
2084
+ }
2085
+ if (s2 !== peg$FAILED) {
2086
+ s3 = [];
2087
+ s4 = input.charAt(peg$currPos);
2088
+ if (peg$r1.test(s4)) {
2089
+ peg$currPos++;
2090
+ } else {
2091
+ s4 = peg$FAILED;
2092
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2093
+ }
2094
+ while (s4 !== peg$FAILED) {
2095
+ s3.push(s4);
2096
+ s4 = input.charAt(peg$currPos);
2097
+ if (peg$r1.test(s4)) {
2098
+ peg$currPos++;
2099
+ } else {
2100
+ s4 = peg$FAILED;
2101
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2102
+ }
2103
+ }
2104
+ peg$savedPos = s0;
2105
+ s0 = peg$f29(s2, s3);
2106
+ } else {
2107
+ peg$currPos = s0;
2108
+ s0 = peg$FAILED;
2109
+ }
2110
+ } else {
2111
+ peg$currPos = s0;
2112
+ s0 = peg$FAILED;
2113
+ }
2114
+
2115
+ return s0;
2116
+ }
2117
+
2118
+ function peg$parseStringLiteral() {
2119
+ var s0, s1, s2, s3;
2120
+
2121
+ s0 = peg$currPos;
2122
+ if (input.charCodeAt(peg$currPos) === 34) {
2123
+ s1 = peg$c24;
2124
+ peg$currPos++;
2125
+ } else {
2126
+ s1 = peg$FAILED;
2127
+ if (peg$silentFails === 0) { peg$fail(peg$e26); }
2128
+ }
2129
+ if (s1 !== peg$FAILED) {
2130
+ s2 = [];
2131
+ s3 = peg$parseDoubleStringCharacter();
2132
+ while (s3 !== peg$FAILED) {
2133
+ s2.push(s3);
2134
+ s3 = peg$parseDoubleStringCharacter();
2135
+ }
2136
+ if (input.charCodeAt(peg$currPos) === 34) {
2137
+ s3 = peg$c24;
2138
+ peg$currPos++;
2139
+ } else {
2140
+ s3 = peg$FAILED;
2141
+ if (peg$silentFails === 0) { peg$fail(peg$e26); }
2142
+ }
2143
+ if (s3 !== peg$FAILED) {
2144
+ peg$savedPos = s0;
2145
+ s0 = peg$f30(s2);
2146
+ } else {
2147
+ peg$currPos = s0;
2148
+ s0 = peg$FAILED;
2149
+ }
2150
+ } else {
2151
+ peg$currPos = s0;
2152
+ s0 = peg$FAILED;
2153
+ }
2154
+ if (s0 === peg$FAILED) {
2155
+ s0 = peg$currPos;
2156
+ if (input.charCodeAt(peg$currPos) === 39) {
2157
+ s1 = peg$c25;
2158
+ peg$currPos++;
2159
+ } else {
2160
+ s1 = peg$FAILED;
2161
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
2162
+ }
2163
+ if (s1 !== peg$FAILED) {
2164
+ s2 = [];
2165
+ s3 = peg$parseSingleStringCharacter();
2166
+ while (s3 !== peg$FAILED) {
2167
+ s2.push(s3);
2168
+ s3 = peg$parseSingleStringCharacter();
2169
+ }
2170
+ if (input.charCodeAt(peg$currPos) === 39) {
2171
+ s3 = peg$c25;
2172
+ peg$currPos++;
2173
+ } else {
2174
+ s3 = peg$FAILED;
2175
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
2176
+ }
2177
+ if (s3 !== peg$FAILED) {
2178
+ peg$savedPos = s0;
2179
+ s0 = peg$f31(s2);
2180
+ } else {
2181
+ peg$currPos = s0;
2182
+ s0 = peg$FAILED;
2183
+ }
2184
+ } else {
2185
+ peg$currPos = s0;
2186
+ s0 = peg$FAILED;
2187
+ }
2188
+ }
2189
+
2190
+ return s0;
2191
+ }
2192
+
2193
+ function peg$parseDoubleStringCharacter() {
2194
+ var s0, s1, s2, s3;
2195
+
2196
+ s0 = peg$currPos;
2197
+ s1 = peg$currPos;
2198
+ peg$silentFails++;
2199
+ if (input.charCodeAt(peg$currPos) === 34) {
2200
+ s2 = peg$c24;
2201
+ peg$currPos++;
2202
+ } else {
2203
+ s2 = peg$FAILED;
2204
+ if (peg$silentFails === 0) { peg$fail(peg$e26); }
2205
+ }
2206
+ peg$silentFails--;
2207
+ if (s2 === peg$FAILED) {
2208
+ s1 = undefined;
2209
+ } else {
2210
+ peg$currPos = s1;
2211
+ s1 = peg$FAILED;
2212
+ }
2213
+ if (s1 !== peg$FAILED) {
2214
+ s2 = peg$currPos;
2215
+ peg$silentFails++;
2216
+ if (input.charCodeAt(peg$currPos) === 92) {
2217
+ s3 = peg$c26;
2218
+ peg$currPos++;
2219
+ } else {
2220
+ s3 = peg$FAILED;
2221
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
2222
+ }
2223
+ peg$silentFails--;
2224
+ if (s3 === peg$FAILED) {
2225
+ s2 = undefined;
2226
+ } else {
2227
+ peg$currPos = s2;
2228
+ s2 = peg$FAILED;
2229
+ }
2230
+ if (s2 !== peg$FAILED) {
2231
+ if (input.length > peg$currPos) {
2232
+ s3 = input.charAt(peg$currPos);
2233
+ peg$currPos++;
2234
+ } else {
2235
+ s3 = peg$FAILED;
2236
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2237
+ }
2238
+ if (s3 !== peg$FAILED) {
2239
+ peg$savedPos = s0;
2240
+ s0 = peg$f32(s3);
2241
+ } else {
2242
+ peg$currPos = s0;
2243
+ s0 = peg$FAILED;
2244
+ }
2245
+ } else {
2246
+ peg$currPos = s0;
2247
+ s0 = peg$FAILED;
2248
+ }
2249
+ } else {
2250
+ peg$currPos = s0;
2251
+ s0 = peg$FAILED;
2252
+ }
2253
+ if (s0 === peg$FAILED) {
2254
+ s0 = peg$currPos;
2255
+ if (input.charCodeAt(peg$currPos) === 92) {
2256
+ s1 = peg$c26;
2257
+ peg$currPos++;
2258
+ } else {
2259
+ s1 = peg$FAILED;
2260
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
2261
+ }
2262
+ if (s1 !== peg$FAILED) {
2263
+ s2 = peg$parseEscapeSequence();
2264
+ if (s2 !== peg$FAILED) {
2265
+ peg$savedPos = s0;
2266
+ s0 = peg$f33(s2);
2267
+ } else {
2268
+ peg$currPos = s0;
2269
+ s0 = peg$FAILED;
2270
+ }
2271
+ } else {
2272
+ peg$currPos = s0;
2273
+ s0 = peg$FAILED;
2274
+ }
2275
+ }
2276
+
2277
+ return s0;
2278
+ }
2279
+
2280
+ function peg$parseSingleStringCharacter() {
2281
+ var s0, s1, s2, s3;
2282
+
2283
+ s0 = peg$currPos;
2284
+ s1 = peg$currPos;
2285
+ peg$silentFails++;
2286
+ if (input.charCodeAt(peg$currPos) === 39) {
2287
+ s2 = peg$c25;
2288
+ peg$currPos++;
2289
+ } else {
2290
+ s2 = peg$FAILED;
2291
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
2292
+ }
2293
+ peg$silentFails--;
2294
+ if (s2 === peg$FAILED) {
2295
+ s1 = undefined;
2296
+ } else {
2297
+ peg$currPos = s1;
2298
+ s1 = peg$FAILED;
2299
+ }
2300
+ if (s1 !== peg$FAILED) {
2301
+ s2 = peg$currPos;
2302
+ peg$silentFails++;
2303
+ if (input.charCodeAt(peg$currPos) === 92) {
2304
+ s3 = peg$c26;
2305
+ peg$currPos++;
2306
+ } else {
2307
+ s3 = peg$FAILED;
2308
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
2309
+ }
2310
+ peg$silentFails--;
2311
+ if (s3 === peg$FAILED) {
2312
+ s2 = undefined;
2313
+ } else {
2314
+ peg$currPos = s2;
2315
+ s2 = peg$FAILED;
2316
+ }
2317
+ if (s2 !== peg$FAILED) {
2318
+ if (input.length > peg$currPos) {
2319
+ s3 = input.charAt(peg$currPos);
2320
+ peg$currPos++;
2321
+ } else {
2322
+ s3 = peg$FAILED;
2323
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2324
+ }
2325
+ if (s3 !== peg$FAILED) {
2326
+ peg$savedPos = s0;
2327
+ s0 = peg$f34(s3);
2328
+ } else {
2329
+ peg$currPos = s0;
2330
+ s0 = peg$FAILED;
2331
+ }
2332
+ } else {
2333
+ peg$currPos = s0;
2334
+ s0 = peg$FAILED;
2335
+ }
2336
+ } else {
2337
+ peg$currPos = s0;
2338
+ s0 = peg$FAILED;
2339
+ }
2340
+ if (s0 === peg$FAILED) {
2341
+ s0 = peg$currPos;
2342
+ if (input.charCodeAt(peg$currPos) === 92) {
2343
+ s1 = peg$c26;
2344
+ peg$currPos++;
2345
+ } else {
2346
+ s1 = peg$FAILED;
2347
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
2348
+ }
2349
+ if (s1 !== peg$FAILED) {
2350
+ s2 = peg$parseEscapeSequence();
2351
+ if (s2 !== peg$FAILED) {
2352
+ peg$savedPos = s0;
2353
+ s0 = peg$f35(s2);
2354
+ } else {
2355
+ peg$currPos = s0;
2356
+ s0 = peg$FAILED;
2357
+ }
2358
+ } else {
2359
+ peg$currPos = s0;
2360
+ s0 = peg$FAILED;
2361
+ }
2362
+ }
2363
+
2364
+ return s0;
2365
+ }
2366
+
2367
+ function peg$parseEscapeSequence() {
2368
+ var s0, s1;
2369
+
2370
+ s0 = input.charAt(peg$currPos);
2371
+ if (peg$r2.test(s0)) {
2372
+ peg$currPos++;
2373
+ } else {
2374
+ s0 = peg$FAILED;
2375
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2376
+ }
2377
+ if (s0 === peg$FAILED) {
2378
+ s0 = peg$currPos;
2379
+ if (input.charCodeAt(peg$currPos) === 110) {
2380
+ s1 = peg$c27;
2381
+ peg$currPos++;
2382
+ } else {
2383
+ s1 = peg$FAILED;
2384
+ if (peg$silentFails === 0) { peg$fail(peg$e31); }
2385
+ }
2386
+ if (s1 !== peg$FAILED) {
2387
+ peg$savedPos = s0;
2388
+ s1 = peg$f36();
2389
+ }
2390
+ s0 = s1;
2391
+ if (s0 === peg$FAILED) {
2392
+ s0 = peg$currPos;
2393
+ if (input.charCodeAt(peg$currPos) === 114) {
2394
+ s1 = peg$c28;
2395
+ peg$currPos++;
2396
+ } else {
2397
+ s1 = peg$FAILED;
2398
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
2399
+ }
2400
+ if (s1 !== peg$FAILED) {
2401
+ peg$savedPos = s0;
2402
+ s1 = peg$f37();
2403
+ }
2404
+ s0 = s1;
2405
+ if (s0 === peg$FAILED) {
2406
+ s0 = peg$currPos;
2407
+ if (input.charCodeAt(peg$currPos) === 116) {
2408
+ s1 = peg$c29;
2409
+ peg$currPos++;
2410
+ } else {
2411
+ s1 = peg$FAILED;
2412
+ if (peg$silentFails === 0) { peg$fail(peg$e33); }
2413
+ }
2414
+ if (s1 !== peg$FAILED) {
2415
+ peg$savedPos = s0;
2416
+ s1 = peg$f38();
2417
+ }
2418
+ s0 = s1;
2419
+ }
2420
+ }
2421
+ }
2422
+
2423
+ return s0;
2424
+ }
2425
+
2426
+ function peg$parseNumberLiteral() {
2427
+ var s0, s1, s2;
2428
+
2429
+ s0 = peg$currPos;
2430
+ s1 = [];
2431
+ s2 = input.charAt(peg$currPos);
2432
+ if (peg$r3.test(s2)) {
2433
+ peg$currPos++;
2434
+ } else {
2435
+ s2 = peg$FAILED;
2436
+ if (peg$silentFails === 0) { peg$fail(peg$e34); }
2437
+ }
2438
+ if (s2 !== peg$FAILED) {
2439
+ while (s2 !== peg$FAILED) {
2440
+ s1.push(s2);
2441
+ s2 = input.charAt(peg$currPos);
2442
+ if (peg$r3.test(s2)) {
2443
+ peg$currPos++;
2444
+ } else {
2445
+ s2 = peg$FAILED;
2446
+ if (peg$silentFails === 0) { peg$fail(peg$e34); }
2447
+ }
2448
+ }
2449
+ } else {
2450
+ s1 = peg$FAILED;
2451
+ }
2452
+ if (s1 !== peg$FAILED) {
2453
+ peg$savedPos = s0;
2454
+ s1 = peg$f39(s1);
2455
+ }
2456
+ s0 = s1;
2457
+
2458
+ return s0;
2459
+ }
2460
+
2461
+ function peg$parseBooleanLiteral() {
2462
+ var s0, s1;
2463
+
2464
+ s0 = peg$currPos;
2465
+ if (input.substr(peg$currPos, 4) === peg$c30) {
2466
+ s1 = peg$c30;
2467
+ peg$currPos += 4;
2468
+ } else {
2469
+ s1 = peg$FAILED;
2470
+ if (peg$silentFails === 0) { peg$fail(peg$e35); }
2471
+ }
2472
+ if (s1 !== peg$FAILED) {
2473
+ peg$savedPos = s0;
2474
+ s1 = peg$f40();
2475
+ }
2476
+ s0 = s1;
2477
+ if (s0 === peg$FAILED) {
2478
+ s0 = peg$currPos;
2479
+ if (input.substr(peg$currPos, 5) === peg$c31) {
2480
+ s1 = peg$c31;
2481
+ peg$currPos += 5;
2482
+ } else {
2483
+ s1 = peg$FAILED;
2484
+ if (peg$silentFails === 0) { peg$fail(peg$e36); }
2485
+ }
2486
+ if (s1 !== peg$FAILED) {
2487
+ peg$savedPos = s0;
2488
+ s1 = peg$f41();
2489
+ }
2490
+ s0 = s1;
2491
+ }
2492
+
2493
+ return s0;
2494
+ }
2495
+
2496
+ function peg$parseReservedWord() {
2497
+ var s0, s1, s2, s3;
2498
+
2499
+ s0 = peg$currPos;
2500
+ if (input.substr(peg$currPos, 7) === peg$c0) {
2501
+ s1 = peg$c0;
2502
+ peg$currPos += 7;
2503
+ } else {
2504
+ s1 = peg$FAILED;
2505
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
2506
+ }
2507
+ if (s1 === peg$FAILED) {
2508
+ if (input.substr(peg$currPos, 4) === peg$c8) {
2509
+ s1 = peg$c8;
2510
+ peg$currPos += 4;
2511
+ } else {
2512
+ s1 = peg$FAILED;
2513
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
2514
+ }
2515
+ if (s1 === peg$FAILED) {
2516
+ if (input.substr(peg$currPos, 5) === peg$c9) {
2517
+ s1 = peg$c9;
2518
+ peg$currPos += 5;
2519
+ } else {
2520
+ s1 = peg$FAILED;
2521
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
2522
+ }
2523
+ if (s1 === peg$FAILED) {
2524
+ if (input.substr(peg$currPos, 7) === peg$c10) {
2525
+ s1 = peg$c10;
2526
+ peg$currPos += 7;
2527
+ } else {
2528
+ s1 = peg$FAILED;
2529
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
2530
+ }
2531
+ if (s1 === peg$FAILED) {
2532
+ if (input.substr(peg$currPos, 3) === peg$c11) {
2533
+ s1 = peg$c11;
2534
+ peg$currPos += 3;
2535
+ } else {
2536
+ s1 = peg$FAILED;
2537
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
2538
+ }
2539
+ if (s1 === peg$FAILED) {
2540
+ if (input.substr(peg$currPos, 3) === peg$c12) {
2541
+ s1 = peg$c12;
2542
+ peg$currPos += 3;
2543
+ } else {
2544
+ s1 = peg$FAILED;
2545
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
2546
+ }
2547
+ if (s1 === peg$FAILED) {
2548
+ if (input.substr(peg$currPos, 2) === peg$c13) {
2549
+ s1 = peg$c13;
2550
+ peg$currPos += 2;
2551
+ } else {
2552
+ s1 = peg$FAILED;
2553
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
2554
+ }
2555
+ if (s1 === peg$FAILED) {
2556
+ if (input.substr(peg$currPos, 5) === peg$c14) {
2557
+ s1 = peg$c14;
2558
+ peg$currPos += 5;
2559
+ } else {
2560
+ s1 = peg$FAILED;
2561
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
2562
+ }
2563
+ if (s1 === peg$FAILED) {
2564
+ if (input.substr(peg$currPos, 7) === peg$c15) {
2565
+ s1 = peg$c15;
2566
+ peg$currPos += 7;
2567
+ } else {
2568
+ s1 = peg$FAILED;
2569
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
2570
+ }
2571
+ if (s1 === peg$FAILED) {
2572
+ if (input.substr(peg$currPos, 4) === peg$c16) {
2573
+ s1 = peg$c16;
2574
+ peg$currPos += 4;
2575
+ } else {
2576
+ s1 = peg$FAILED;
2577
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
2578
+ }
2579
+ if (s1 === peg$FAILED) {
2580
+ if (input.substr(peg$currPos, 4) === peg$c17) {
2581
+ s1 = peg$c17;
2582
+ peg$currPos += 4;
2583
+ } else {
2584
+ s1 = peg$FAILED;
2585
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
2586
+ }
2587
+ if (s1 === peg$FAILED) {
2588
+ if (input.substr(peg$currPos, 5) === peg$c19) {
2589
+ s1 = peg$c19;
2590
+ peg$currPos += 5;
2591
+ } else {
2592
+ s1 = peg$FAILED;
2593
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
2594
+ }
2595
+ if (s1 === peg$FAILED) {
2596
+ if (input.substr(peg$currPos, 8) === peg$c20) {
2597
+ s1 = peg$c20;
2598
+ peg$currPos += 8;
2599
+ } else {
2600
+ s1 = peg$FAILED;
2601
+ if (peg$silentFails === 0) { peg$fail(peg$e22); }
2602
+ }
2603
+ if (s1 === peg$FAILED) {
2604
+ if (input.substr(peg$currPos, 10) === peg$c21) {
2605
+ s1 = peg$c21;
2606
+ peg$currPos += 10;
2607
+ } else {
2608
+ s1 = peg$FAILED;
2609
+ if (peg$silentFails === 0) { peg$fail(peg$e23); }
2610
+ }
2611
+ }
2612
+ }
2613
+ }
2614
+ }
2615
+ }
2616
+ }
2617
+ }
2618
+ }
2619
+ }
2620
+ }
2621
+ }
2622
+ }
2623
+ }
2624
+ if (s1 !== peg$FAILED) {
2625
+ s2 = peg$currPos;
2626
+ peg$silentFails++;
2627
+ s3 = peg$parseIdentifierPart();
2628
+ peg$silentFails--;
2629
+ if (s3 === peg$FAILED) {
2630
+ s2 = undefined;
2631
+ } else {
2632
+ peg$currPos = s2;
2633
+ s2 = peg$FAILED;
2634
+ }
2635
+ if (s2 !== peg$FAILED) {
2636
+ s1 = [s1, s2];
2637
+ s0 = s1;
2638
+ } else {
2639
+ peg$currPos = s0;
2640
+ s0 = peg$FAILED;
2641
+ }
2642
+ } else {
2643
+ peg$currPos = s0;
2644
+ s0 = peg$FAILED;
2645
+ }
2646
+
2647
+ return s0;
2648
+ }
2649
+
2650
+ function peg$parseIdentifierPart() {
2651
+ var s0;
2652
+
2653
+ s0 = input.charAt(peg$currPos);
2654
+ if (peg$r1.test(s0)) {
2655
+ peg$currPos++;
2656
+ } else {
2657
+ s0 = peg$FAILED;
2658
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2659
+ }
2660
+
2661
+ return s0;
2662
+ }
2663
+
2664
+ function peg$parse_() {
2665
+ var s0, s1;
2666
+
2667
+ peg$silentFails++;
2668
+ s0 = [];
2669
+ s1 = input.charAt(peg$currPos);
2670
+ if (peg$r4.test(s1)) {
2671
+ peg$currPos++;
2672
+ } else {
2673
+ s1 = peg$FAILED;
2674
+ if (peg$silentFails === 0) { peg$fail(peg$e38); }
2675
+ }
2676
+ if (s1 === peg$FAILED) {
2677
+ s1 = peg$parseComment();
2678
+ }
2679
+ while (s1 !== peg$FAILED) {
2680
+ s0.push(s1);
2681
+ s1 = input.charAt(peg$currPos);
2682
+ if (peg$r4.test(s1)) {
2683
+ peg$currPos++;
2684
+ } else {
2685
+ s1 = peg$FAILED;
2686
+ if (peg$silentFails === 0) { peg$fail(peg$e38); }
2687
+ }
2688
+ if (s1 === peg$FAILED) {
2689
+ s1 = peg$parseComment();
2690
+ }
2691
+ }
2692
+ peg$silentFails--;
2693
+ s1 = peg$FAILED;
2694
+ if (peg$silentFails === 0) { peg$fail(peg$e37); }
2695
+
2696
+ return s0;
2697
+ }
2698
+
2699
+ function peg$parseWhiteSpace() {
2700
+ var s0;
2701
+
2702
+ s0 = input.charAt(peg$currPos);
2703
+ if (peg$r5.test(s0)) {
2704
+ peg$currPos++;
2705
+ } else {
2706
+ s0 = peg$FAILED;
2707
+ if (peg$silentFails === 0) { peg$fail(peg$e39); }
2708
+ }
2709
+
2710
+ return s0;
2711
+ }
2712
+
2713
+ function peg$parseLineTerminator() {
2714
+ var s0;
2715
+
2716
+ s0 = input.charAt(peg$currPos);
2717
+ if (peg$r6.test(s0)) {
2718
+ peg$currPos++;
2719
+ } else {
2720
+ s0 = peg$FAILED;
2721
+ if (peg$silentFails === 0) { peg$fail(peg$e40); }
2722
+ }
2723
+
2724
+ return s0;
2725
+ }
2726
+
2727
+ function peg$parseComment() {
2728
+ var s0;
2729
+
2730
+ s0 = peg$parseSingleLineComment();
2731
+ if (s0 === peg$FAILED) {
2732
+ s0 = peg$parseMultiLineComment();
2733
+ }
2734
+
2735
+ return s0;
2736
+ }
2737
+
2738
+ function peg$parseSingleLineComment() {
2739
+ var s0, s1, s2, s3, s4, s5;
2740
+
2741
+ s0 = peg$currPos;
2742
+ if (input.substr(peg$currPos, 2) === peg$c32) {
2743
+ s1 = peg$c32;
2744
+ peg$currPos += 2;
2745
+ } else {
2746
+ s1 = peg$FAILED;
2747
+ if (peg$silentFails === 0) { peg$fail(peg$e41); }
2748
+ }
2749
+ if (s1 !== peg$FAILED) {
2750
+ s2 = [];
2751
+ s3 = peg$currPos;
2752
+ s4 = peg$currPos;
2753
+ peg$silentFails++;
2754
+ s5 = peg$parseLineTerminator();
2755
+ peg$silentFails--;
2756
+ if (s5 === peg$FAILED) {
2757
+ s4 = undefined;
2758
+ } else {
2759
+ peg$currPos = s4;
2760
+ s4 = peg$FAILED;
2761
+ }
2762
+ if (s4 !== peg$FAILED) {
2763
+ if (input.length > peg$currPos) {
2764
+ s5 = input.charAt(peg$currPos);
2765
+ peg$currPos++;
2766
+ } else {
2767
+ s5 = peg$FAILED;
2768
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2769
+ }
2770
+ if (s5 !== peg$FAILED) {
2771
+ s4 = [s4, s5];
2772
+ s3 = s4;
2773
+ } else {
2774
+ peg$currPos = s3;
2775
+ s3 = peg$FAILED;
2776
+ }
2777
+ } else {
2778
+ peg$currPos = s3;
2779
+ s3 = peg$FAILED;
2780
+ }
2781
+ while (s3 !== peg$FAILED) {
2782
+ s2.push(s3);
2783
+ s3 = peg$currPos;
2784
+ s4 = peg$currPos;
2785
+ peg$silentFails++;
2786
+ s5 = peg$parseLineTerminator();
2787
+ peg$silentFails--;
2788
+ if (s5 === peg$FAILED) {
2789
+ s4 = undefined;
2790
+ } else {
2791
+ peg$currPos = s4;
2792
+ s4 = peg$FAILED;
2793
+ }
2794
+ if (s4 !== peg$FAILED) {
2795
+ if (input.length > peg$currPos) {
2796
+ s5 = input.charAt(peg$currPos);
2797
+ peg$currPos++;
2798
+ } else {
2799
+ s5 = peg$FAILED;
2800
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2801
+ }
2802
+ if (s5 !== peg$FAILED) {
2803
+ s4 = [s4, s5];
2804
+ s3 = s4;
2805
+ } else {
2806
+ peg$currPos = s3;
2807
+ s3 = peg$FAILED;
2808
+ }
2809
+ } else {
2810
+ peg$currPos = s3;
2811
+ s3 = peg$FAILED;
2812
+ }
2813
+ }
2814
+ s1 = [s1, s2];
2815
+ s0 = s1;
2816
+ } else {
2817
+ peg$currPos = s0;
2818
+ s0 = peg$FAILED;
2819
+ }
2820
+
2821
+ return s0;
2822
+ }
2823
+
2824
+ function peg$parseMultiLineComment() {
2825
+ var s0, s1, s2, s3, s4, s5;
2826
+
2827
+ s0 = peg$currPos;
2828
+ if (input.substr(peg$currPos, 2) === peg$c33) {
2829
+ s1 = peg$c33;
2830
+ peg$currPos += 2;
2831
+ } else {
2832
+ s1 = peg$FAILED;
2833
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
2834
+ }
2835
+ if (s1 !== peg$FAILED) {
2836
+ s2 = [];
2837
+ s3 = peg$currPos;
2838
+ s4 = peg$currPos;
2839
+ peg$silentFails++;
2840
+ if (input.substr(peg$currPos, 2) === peg$c34) {
2841
+ s5 = peg$c34;
2842
+ peg$currPos += 2;
2843
+ } else {
2844
+ s5 = peg$FAILED;
2845
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2846
+ }
2847
+ peg$silentFails--;
2848
+ if (s5 === peg$FAILED) {
2849
+ s4 = undefined;
2850
+ } else {
2851
+ peg$currPos = s4;
2852
+ s4 = peg$FAILED;
2853
+ }
2854
+ if (s4 !== peg$FAILED) {
2855
+ if (input.length > peg$currPos) {
2856
+ s5 = input.charAt(peg$currPos);
2857
+ peg$currPos++;
2858
+ } else {
2859
+ s5 = peg$FAILED;
2860
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2861
+ }
2862
+ if (s5 !== peg$FAILED) {
2863
+ s4 = [s4, s5];
2864
+ s3 = s4;
2865
+ } else {
2866
+ peg$currPos = s3;
2867
+ s3 = peg$FAILED;
2868
+ }
2869
+ } else {
2870
+ peg$currPos = s3;
2871
+ s3 = peg$FAILED;
2872
+ }
2873
+ while (s3 !== peg$FAILED) {
2874
+ s2.push(s3);
2875
+ s3 = peg$currPos;
2876
+ s4 = peg$currPos;
2877
+ peg$silentFails++;
2878
+ if (input.substr(peg$currPos, 2) === peg$c34) {
2879
+ s5 = peg$c34;
2880
+ peg$currPos += 2;
2881
+ } else {
2882
+ s5 = peg$FAILED;
2883
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2884
+ }
2885
+ peg$silentFails--;
2886
+ if (s5 === peg$FAILED) {
2887
+ s4 = undefined;
2888
+ } else {
2889
+ peg$currPos = s4;
2890
+ s4 = peg$FAILED;
2891
+ }
2892
+ if (s4 !== peg$FAILED) {
2893
+ if (input.length > peg$currPos) {
2894
+ s5 = input.charAt(peg$currPos);
2895
+ peg$currPos++;
2896
+ } else {
2897
+ s5 = peg$FAILED;
2898
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2899
+ }
2900
+ if (s5 !== peg$FAILED) {
2901
+ s4 = [s4, s5];
2902
+ s3 = s4;
2903
+ } else {
2904
+ peg$currPos = s3;
2905
+ s3 = peg$FAILED;
2906
+ }
2907
+ } else {
2908
+ peg$currPos = s3;
2909
+ s3 = peg$FAILED;
2910
+ }
2911
+ }
2912
+ if (input.substr(peg$currPos, 2) === peg$c34) {
2913
+ s3 = peg$c34;
2914
+ peg$currPos += 2;
2915
+ } else {
2916
+ s3 = peg$FAILED;
2917
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2918
+ }
2919
+ if (s3 !== peg$FAILED) {
2920
+ s1 = [s1, s2, s3];
2921
+ s0 = s1;
2922
+ } else {
2923
+ peg$currPos = s0;
2924
+ s0 = peg$FAILED;
2925
+ }
2926
+ } else {
2927
+ peg$currPos = s0;
2928
+ s0 = peg$FAILED;
2929
+ }
2930
+
2931
+ return s0;
2932
+ }
2933
+
2934
+
2935
+ /**
2936
+ * 构建 AST 节点
2937
+ */
2938
+ function buildNode(type, data) {
2939
+ return { type, ...data };
2940
+ }
2941
+
2942
+ /**
2943
+ * 构建属性对象
2944
+ */
2945
+ function buildAttrs(attrs) {
2946
+ return Object.fromEntries(attrs);
2947
+ }
2948
+
2949
+ /**
2950
+ * 构建选项对象
2951
+ */
2952
+ function buildOptions(opts) {
2953
+ return Object.fromEntries(opts);
2954
+ }
2955
+
2956
+ peg$result = peg$startRuleFunction();
2957
+
2958
+ if (options.peg$library) {
2959
+ return /** @type {any} */ ({
2960
+ peg$result,
2961
+ peg$currPos,
2962
+ peg$FAILED,
2963
+ peg$maxFailExpected,
2964
+ peg$maxFailPos
2965
+ });
2966
+ }
2967
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
2968
+ return peg$result;
2969
+ } else {
2970
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
2971
+ peg$fail(peg$endExpectation());
2972
+ }
2973
+
2974
+ throw peg$buildStructuredError(
2975
+ peg$maxFailExpected,
2976
+ peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
2977
+ peg$maxFailPos < input.length
2978
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
2979
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
2980
+ );
2981
+ }
2982
+ }
2983
+
2984
+ const peg$allowedStartRules = [
2985
+ "Start"
2986
+ ];
2987
+
2988
+ export {
2989
+ peg$allowedStartRules as StartRules,
2990
+ peg$SyntaxError as SyntaxError,
2991
+ peg$parse as parse
2992
+ };