hello-lights 0.3.3 → 0.3.5

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,1006 @@
1
+ /*
2
+ * Generated by PEG.js 0.10.0.
3
+ *
4
+ * http://pegjs.org/
5
+ */
6
+
7
+ "use strict";
8
+
9
+ function peg$subclass(child, parent) {
10
+ function ctor() { this.constructor = child; }
11
+ ctor.prototype = parent.prototype;
12
+ child.prototype = new ctor();
13
+ }
14
+
15
+ function peg$SyntaxError(message, expected, found, location) {
16
+ this.message = message;
17
+ this.expected = expected;
18
+ this.found = found;
19
+ this.location = location;
20
+ this.name = "SyntaxError";
21
+
22
+ if (typeof Error.captureStackTrace === "function") {
23
+ Error.captureStackTrace(this, peg$SyntaxError);
24
+ }
25
+ }
26
+
27
+ peg$subclass(peg$SyntaxError, Error);
28
+
29
+ peg$SyntaxError.buildMessage = function(expected, found) {
30
+ var DESCRIBE_EXPECTATION_FNS = {
31
+ literal: function(expectation) {
32
+ return "\"" + literalEscape(expectation.text) + "\"";
33
+ },
34
+
35
+ "class": function(expectation) {
36
+ var escapedParts = "",
37
+ i;
38
+
39
+ for (i = 0; i < expectation.parts.length; i++) {
40
+ escapedParts += expectation.parts[i] instanceof Array
41
+ ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
42
+ : classEscape(expectation.parts[i]);
43
+ }
44
+
45
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
46
+ },
47
+
48
+ any: function(expectation) {
49
+ return "any character";
50
+ },
51
+
52
+ end: function(expectation) {
53
+ return "end of input";
54
+ },
55
+
56
+ other: function(expectation) {
57
+ return expectation.description;
58
+ }
59
+ };
60
+
61
+ function hex(ch) {
62
+ return ch.charCodeAt(0).toString(16).toUpperCase();
63
+ }
64
+
65
+ function literalEscape(s) {
66
+ return s
67
+ .replace(/\\/g, '\\\\')
68
+ .replace(/"/g, '\\"')
69
+ .replace(/\0/g, '\\0')
70
+ .replace(/\t/g, '\\t')
71
+ .replace(/\n/g, '\\n')
72
+ .replace(/\r/g, '\\r')
73
+ .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
74
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
75
+ }
76
+
77
+ function classEscape(s) {
78
+ return s
79
+ .replace(/\\/g, '\\\\')
80
+ .replace(/\]/g, '\\]')
81
+ .replace(/\^/g, '\\^')
82
+ .replace(/-/g, '\\-')
83
+ .replace(/\0/g, '\\0')
84
+ .replace(/\t/g, '\\t')
85
+ .replace(/\n/g, '\\n')
86
+ .replace(/\r/g, '\\r')
87
+ .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
88
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
89
+ }
90
+
91
+ function describeExpectation(expectation) {
92
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
93
+ }
94
+
95
+ function describeExpected(expected) {
96
+ var descriptions = new Array(expected.length),
97
+ i, j;
98
+
99
+ for (i = 0; i < expected.length; i++) {
100
+ descriptions[i] = describeExpectation(expected[i]);
101
+ }
102
+
103
+ descriptions.sort();
104
+
105
+ if (descriptions.length > 0) {
106
+ for (i = 1, j = 1; i < descriptions.length; i++) {
107
+ if (descriptions[i - 1] !== descriptions[i]) {
108
+ descriptions[j] = descriptions[i];
109
+ j++;
110
+ }
111
+ }
112
+ descriptions.length = j;
113
+ }
114
+
115
+ switch (descriptions.length) {
116
+ case 1:
117
+ return descriptions[0];
118
+
119
+ case 2:
120
+ return descriptions[0] + " or " + descriptions[1];
121
+
122
+ default:
123
+ return descriptions.slice(0, -1).join(", ")
124
+ + ", or "
125
+ + descriptions[descriptions.length - 1];
126
+ }
127
+ }
128
+
129
+ function describeFound(found) {
130
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
131
+ }
132
+
133
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
134
+ };
135
+
136
+ function peg$parse(input, options) {
137
+ options = options !== void 0 ? options : {};
138
+
139
+ var peg$FAILED = {},
140
+
141
+ peg$startRuleFunctions = { Start: peg$parseStart },
142
+ peg$startRuleFunction = peg$parseStart,
143
+
144
+ peg$c0 = function(command) { return [command]; },
145
+ peg$c1 = "(",
146
+ peg$c2 = peg$literalExpectation("(", false),
147
+ peg$c3 = ")",
148
+ peg$c4 = peg$literalExpectation(")", false),
149
+ peg$c5 = function(first, rest) {
150
+ return [first, ...(rest || [])];
151
+ },
152
+ peg$c6 = function(name, args) {
153
+ return { type: 'command', name, args: args || [], loc: loc() };
154
+ },
155
+ peg$c7 = function(head, tail) { return [head, ...(tail || [])]; },
156
+ peg$c8 = function(name) { return { type: 'variable', name, loc: loc() }; },
157
+ peg$c9 = function(value) { return { type: 'value', value, loc: loc() }; },
158
+ peg$c10 = function(command) { return command; },
159
+ peg$c11 = ":",
160
+ peg$c12 = peg$literalExpectation(":", false),
161
+ peg$c13 = function(name) { return name; },
162
+ peg$c14 = /^[a-z_]/i,
163
+ peg$c15 = peg$classExpectation([["a", "z"], "_"], false, true),
164
+ peg$c16 = /^[a-z_0-9\-]/i,
165
+ peg$c17 = peg$classExpectation([["a", "z"], "_", ["0", "9"], "-"], false, true),
166
+ peg$c18 = function(head, tail) { return head + tail.join(''); },
167
+ peg$c19 = /^[0-9]/,
168
+ peg$c20 = peg$classExpectation([["0", "9"]], false, false),
169
+ peg$c21 = function(digits) { return parseInt(digits.join(''), 10); },
170
+ peg$c22 = "\"",
171
+ peg$c23 = peg$literalExpectation("\"", false),
172
+ peg$c24 = function(contents) { return contents.join(''); },
173
+ peg$c25 = "\\",
174
+ peg$c26 = peg$literalExpectation("\\", false),
175
+ peg$c27 = peg$anyExpectation(),
176
+ peg$c28 = function(char) { return char; },
177
+ peg$c29 = /^[ \t\r\n]/,
178
+ peg$c30 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false),
179
+ peg$c31 = ";",
180
+ peg$c32 = peg$literalExpectation(";", false),
181
+ peg$c33 = /^[^\r\n]/,
182
+ peg$c34 = peg$classExpectation(["\r", "\n"], true, false),
183
+ peg$c35 = /^[\r\n]/,
184
+ peg$c36 = peg$classExpectation(["\r", "\n"], false, false),
185
+
186
+ peg$currPos = 0,
187
+ peg$savedPos = 0,
188
+ peg$posDetailsCache = [{ line: 1, column: 1 }],
189
+ peg$maxFailPos = 0,
190
+ peg$maxFailExpected = [],
191
+ peg$silentFails = 0,
192
+
193
+ peg$result;
194
+
195
+ if ("startRule" in options) {
196
+ if (!(options.startRule in peg$startRuleFunctions)) {
197
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
198
+ }
199
+
200
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
201
+ }
202
+
203
+ function text() {
204
+ return input.substring(peg$savedPos, peg$currPos);
205
+ }
206
+
207
+ function location() {
208
+ return peg$computeLocation(peg$savedPos, peg$currPos);
209
+ }
210
+
211
+ function expected(description, location) {
212
+ location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
213
+
214
+ throw peg$buildStructuredError(
215
+ [peg$otherExpectation(description)],
216
+ input.substring(peg$savedPos, peg$currPos),
217
+ location
218
+ );
219
+ }
220
+
221
+ function error(message, location) {
222
+ location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
223
+
224
+ throw peg$buildSimpleError(message, location);
225
+ }
226
+
227
+ function peg$literalExpectation(text, ignoreCase) {
228
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
229
+ }
230
+
231
+ function peg$classExpectation(parts, inverted, ignoreCase) {
232
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
233
+ }
234
+
235
+ function peg$anyExpectation() {
236
+ return { type: "any" };
237
+ }
238
+
239
+ function peg$endExpectation() {
240
+ return { type: "end" };
241
+ }
242
+
243
+ function peg$otherExpectation(description) {
244
+ return { type: "other", description: description };
245
+ }
246
+
247
+ function peg$computePosDetails(pos) {
248
+ var details = peg$posDetailsCache[pos], p;
249
+
250
+ if (details) {
251
+ return details;
252
+ } else {
253
+ p = pos - 1;
254
+ while (!peg$posDetailsCache[p]) {
255
+ p--;
256
+ }
257
+
258
+ details = peg$posDetailsCache[p];
259
+ details = {
260
+ line: details.line,
261
+ column: details.column
262
+ };
263
+
264
+ while (p < pos) {
265
+ if (input.charCodeAt(p) === 10) {
266
+ details.line++;
267
+ details.column = 1;
268
+ } else {
269
+ details.column++;
270
+ }
271
+
272
+ p++;
273
+ }
274
+
275
+ peg$posDetailsCache[pos] = details;
276
+ return details;
277
+ }
278
+ }
279
+
280
+ function peg$computeLocation(startPos, endPos) {
281
+ var startPosDetails = peg$computePosDetails(startPos),
282
+ endPosDetails = peg$computePosDetails(endPos);
283
+
284
+ return {
285
+ start: {
286
+ offset: startPos,
287
+ line: startPosDetails.line,
288
+ column: startPosDetails.column
289
+ },
290
+ end: {
291
+ offset: endPos,
292
+ line: endPosDetails.line,
293
+ column: endPosDetails.column
294
+ }
295
+ };
296
+ }
297
+
298
+ function peg$fail(expected) {
299
+ if (peg$currPos < peg$maxFailPos) { return; }
300
+
301
+ if (peg$currPos > peg$maxFailPos) {
302
+ peg$maxFailPos = peg$currPos;
303
+ peg$maxFailExpected = [];
304
+ }
305
+
306
+ peg$maxFailExpected.push(expected);
307
+ }
308
+
309
+ function peg$buildSimpleError(message, location) {
310
+ return new peg$SyntaxError(message, null, null, location);
311
+ }
312
+
313
+ function peg$buildStructuredError(expected, found, location) {
314
+ return new peg$SyntaxError(
315
+ peg$SyntaxError.buildMessage(expected, found),
316
+ expected,
317
+ found,
318
+ location
319
+ );
320
+ }
321
+
322
+ function peg$parseStart() {
323
+ var s0, s1, s2, s3;
324
+
325
+ s0 = peg$currPos;
326
+ s1 = peg$parse_();
327
+ if (s1 !== peg$FAILED) {
328
+ s2 = peg$parseCommand();
329
+ if (s2 !== peg$FAILED) {
330
+ s3 = peg$parse_();
331
+ if (s3 !== peg$FAILED) {
332
+ peg$savedPos = s0;
333
+ s1 = peg$c0(s2);
334
+ s0 = s1;
335
+ } else {
336
+ peg$currPos = s0;
337
+ s0 = peg$FAILED;
338
+ }
339
+ } else {
340
+ peg$currPos = s0;
341
+ s0 = peg$FAILED;
342
+ }
343
+ } else {
344
+ peg$currPos = s0;
345
+ s0 = peg$FAILED;
346
+ }
347
+ if (s0 === peg$FAILED) {
348
+ s0 = peg$parseCommands();
349
+ }
350
+
351
+ return s0;
352
+ }
353
+
354
+ function peg$parseCommands() {
355
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8;
356
+
357
+ s0 = peg$currPos;
358
+ s1 = peg$parse_();
359
+ if (s1 !== peg$FAILED) {
360
+ if (input.charCodeAt(peg$currPos) === 40) {
361
+ s2 = peg$c1;
362
+ peg$currPos++;
363
+ } else {
364
+ s2 = peg$FAILED;
365
+ if (peg$silentFails === 0) { peg$fail(peg$c2); }
366
+ }
367
+ if (s2 !== peg$FAILED) {
368
+ s3 = peg$parse_();
369
+ if (s3 !== peg$FAILED) {
370
+ s4 = peg$parseCommand();
371
+ if (s4 !== peg$FAILED) {
372
+ s5 = peg$parse_();
373
+ if (s5 !== peg$FAILED) {
374
+ if (input.charCodeAt(peg$currPos) === 41) {
375
+ s6 = peg$c3;
376
+ peg$currPos++;
377
+ } else {
378
+ s6 = peg$FAILED;
379
+ if (peg$silentFails === 0) { peg$fail(peg$c4); }
380
+ }
381
+ if (s6 !== peg$FAILED) {
382
+ s7 = peg$parse_();
383
+ if (s7 !== peg$FAILED) {
384
+ s8 = peg$parseCommands();
385
+ if (s8 === peg$FAILED) {
386
+ s8 = null;
387
+ }
388
+ if (s8 !== peg$FAILED) {
389
+ peg$savedPos = s0;
390
+ s1 = peg$c5(s4, s8);
391
+ s0 = s1;
392
+ } else {
393
+ peg$currPos = s0;
394
+ s0 = peg$FAILED;
395
+ }
396
+ } else {
397
+ peg$currPos = s0;
398
+ s0 = peg$FAILED;
399
+ }
400
+ } else {
401
+ peg$currPos = s0;
402
+ s0 = peg$FAILED;
403
+ }
404
+ } else {
405
+ peg$currPos = s0;
406
+ s0 = peg$FAILED;
407
+ }
408
+ } else {
409
+ peg$currPos = s0;
410
+ s0 = peg$FAILED;
411
+ }
412
+ } else {
413
+ peg$currPos = s0;
414
+ s0 = peg$FAILED;
415
+ }
416
+ } else {
417
+ peg$currPos = s0;
418
+ s0 = peg$FAILED;
419
+ }
420
+ } else {
421
+ peg$currPos = s0;
422
+ s0 = peg$FAILED;
423
+ }
424
+
425
+ return s0;
426
+ }
427
+
428
+ function peg$parseCommand() {
429
+ var s0, s1, s2;
430
+
431
+ s0 = peg$currPos;
432
+ s1 = peg$parseIdentifier();
433
+ if (s1 !== peg$FAILED) {
434
+ s2 = peg$parseArguments();
435
+ if (s2 === peg$FAILED) {
436
+ s2 = null;
437
+ }
438
+ if (s2 !== peg$FAILED) {
439
+ peg$savedPos = s0;
440
+ s1 = peg$c6(s1, s2);
441
+ s0 = s1;
442
+ } else {
443
+ peg$currPos = s0;
444
+ s0 = peg$FAILED;
445
+ }
446
+ } else {
447
+ peg$currPos = s0;
448
+ s0 = peg$FAILED;
449
+ }
450
+
451
+ return s0;
452
+ }
453
+
454
+ function peg$parseArguments() {
455
+ var s0, s1, s2, s3;
456
+
457
+ s0 = peg$currPos;
458
+ s1 = peg$parse_();
459
+ if (s1 !== peg$FAILED) {
460
+ s2 = peg$parseArgument();
461
+ if (s2 !== peg$FAILED) {
462
+ s3 = peg$parseArguments();
463
+ if (s3 === peg$FAILED) {
464
+ s3 = null;
465
+ }
466
+ if (s3 !== peg$FAILED) {
467
+ peg$savedPos = s0;
468
+ s1 = peg$c7(s2, s3);
469
+ s0 = s1;
470
+ } else {
471
+ peg$currPos = s0;
472
+ s0 = peg$FAILED;
473
+ }
474
+ } else {
475
+ peg$currPos = s0;
476
+ s0 = peg$FAILED;
477
+ }
478
+ } else {
479
+ peg$currPos = s0;
480
+ s0 = peg$FAILED;
481
+ }
482
+
483
+ return s0;
484
+ }
485
+
486
+ function peg$parseArgument() {
487
+ var s0, s1, s2, s3, s4, s5;
488
+
489
+ s0 = peg$currPos;
490
+ s1 = peg$parseVariable();
491
+ if (s1 !== peg$FAILED) {
492
+ peg$savedPos = s0;
493
+ s1 = peg$c8(s1);
494
+ }
495
+ s0 = s1;
496
+ if (s0 === peg$FAILED) {
497
+ s0 = peg$currPos;
498
+ s1 = peg$parseIdentifier();
499
+ if (s1 !== peg$FAILED) {
500
+ peg$savedPos = s0;
501
+ s1 = peg$c9(s1);
502
+ }
503
+ s0 = s1;
504
+ if (s0 === peg$FAILED) {
505
+ s0 = peg$currPos;
506
+ s1 = peg$parseNumber();
507
+ if (s1 !== peg$FAILED) {
508
+ peg$savedPos = s0;
509
+ s1 = peg$c9(s1);
510
+ }
511
+ s0 = s1;
512
+ if (s0 === peg$FAILED) {
513
+ s0 = peg$currPos;
514
+ s1 = peg$parseString();
515
+ if (s1 !== peg$FAILED) {
516
+ peg$savedPos = s0;
517
+ s1 = peg$c9(s1);
518
+ }
519
+ s0 = s1;
520
+ if (s0 === peg$FAILED) {
521
+ s0 = peg$currPos;
522
+ if (input.charCodeAt(peg$currPos) === 40) {
523
+ s1 = peg$c1;
524
+ peg$currPos++;
525
+ } else {
526
+ s1 = peg$FAILED;
527
+ if (peg$silentFails === 0) { peg$fail(peg$c2); }
528
+ }
529
+ if (s1 !== peg$FAILED) {
530
+ s2 = peg$parse_();
531
+ if (s2 !== peg$FAILED) {
532
+ s3 = peg$parseCommand();
533
+ if (s3 !== peg$FAILED) {
534
+ s4 = peg$parse_();
535
+ if (s4 !== peg$FAILED) {
536
+ if (input.charCodeAt(peg$currPos) === 41) {
537
+ s5 = peg$c3;
538
+ peg$currPos++;
539
+ } else {
540
+ s5 = peg$FAILED;
541
+ if (peg$silentFails === 0) { peg$fail(peg$c4); }
542
+ }
543
+ if (s5 !== peg$FAILED) {
544
+ peg$savedPos = s0;
545
+ s1 = peg$c10(s3);
546
+ s0 = s1;
547
+ } else {
548
+ peg$currPos = s0;
549
+ s0 = peg$FAILED;
550
+ }
551
+ } else {
552
+ peg$currPos = s0;
553
+ s0 = peg$FAILED;
554
+ }
555
+ } else {
556
+ peg$currPos = s0;
557
+ s0 = peg$FAILED;
558
+ }
559
+ } else {
560
+ peg$currPos = s0;
561
+ s0 = peg$FAILED;
562
+ }
563
+ } else {
564
+ peg$currPos = s0;
565
+ s0 = peg$FAILED;
566
+ }
567
+ }
568
+ }
569
+ }
570
+ }
571
+
572
+ return s0;
573
+ }
574
+
575
+ function peg$parseVariable() {
576
+ var s0, s1, s2;
577
+
578
+ s0 = peg$currPos;
579
+ if (input.charCodeAt(peg$currPos) === 58) {
580
+ s1 = peg$c11;
581
+ peg$currPos++;
582
+ } else {
583
+ s1 = peg$FAILED;
584
+ if (peg$silentFails === 0) { peg$fail(peg$c12); }
585
+ }
586
+ if (s1 !== peg$FAILED) {
587
+ s2 = peg$parseIdentifier();
588
+ if (s2 !== peg$FAILED) {
589
+ peg$savedPos = s0;
590
+ s1 = peg$c13(s2);
591
+ s0 = s1;
592
+ } else {
593
+ peg$currPos = s0;
594
+ s0 = peg$FAILED;
595
+ }
596
+ } else {
597
+ peg$currPos = s0;
598
+ s0 = peg$FAILED;
599
+ }
600
+
601
+ return s0;
602
+ }
603
+
604
+ function peg$parseIdentifier() {
605
+ var s0, s1, s2, s3;
606
+
607
+ s0 = peg$currPos;
608
+ if (peg$c14.test(input.charAt(peg$currPos))) {
609
+ s1 = input.charAt(peg$currPos);
610
+ peg$currPos++;
611
+ } else {
612
+ s1 = peg$FAILED;
613
+ if (peg$silentFails === 0) { peg$fail(peg$c15); }
614
+ }
615
+ if (s1 !== peg$FAILED) {
616
+ s2 = [];
617
+ if (peg$c16.test(input.charAt(peg$currPos))) {
618
+ s3 = input.charAt(peg$currPos);
619
+ peg$currPos++;
620
+ } else {
621
+ s3 = peg$FAILED;
622
+ if (peg$silentFails === 0) { peg$fail(peg$c17); }
623
+ }
624
+ while (s3 !== peg$FAILED) {
625
+ s2.push(s3);
626
+ if (peg$c16.test(input.charAt(peg$currPos))) {
627
+ s3 = input.charAt(peg$currPos);
628
+ peg$currPos++;
629
+ } else {
630
+ s3 = peg$FAILED;
631
+ if (peg$silentFails === 0) { peg$fail(peg$c17); }
632
+ }
633
+ }
634
+ if (s2 !== peg$FAILED) {
635
+ peg$savedPos = s0;
636
+ s1 = peg$c18(s1, s2);
637
+ s0 = s1;
638
+ } else {
639
+ peg$currPos = s0;
640
+ s0 = peg$FAILED;
641
+ }
642
+ } else {
643
+ peg$currPos = s0;
644
+ s0 = peg$FAILED;
645
+ }
646
+
647
+ return s0;
648
+ }
649
+
650
+ function peg$parseNumber() {
651
+ var s0, s1, s2;
652
+
653
+ s0 = peg$currPos;
654
+ s1 = [];
655
+ if (peg$c19.test(input.charAt(peg$currPos))) {
656
+ s2 = input.charAt(peg$currPos);
657
+ peg$currPos++;
658
+ } else {
659
+ s2 = peg$FAILED;
660
+ if (peg$silentFails === 0) { peg$fail(peg$c20); }
661
+ }
662
+ if (s2 !== peg$FAILED) {
663
+ while (s2 !== peg$FAILED) {
664
+ s1.push(s2);
665
+ if (peg$c19.test(input.charAt(peg$currPos))) {
666
+ s2 = input.charAt(peg$currPos);
667
+ peg$currPos++;
668
+ } else {
669
+ s2 = peg$FAILED;
670
+ if (peg$silentFails === 0) { peg$fail(peg$c20); }
671
+ }
672
+ }
673
+ } else {
674
+ s1 = peg$FAILED;
675
+ }
676
+ if (s1 !== peg$FAILED) {
677
+ peg$savedPos = s0;
678
+ s1 = peg$c21(s1);
679
+ }
680
+ s0 = s1;
681
+
682
+ return s0;
683
+ }
684
+
685
+ function peg$parseString() {
686
+ var s0, s1, s2, s3;
687
+
688
+ s0 = peg$currPos;
689
+ if (input.charCodeAt(peg$currPos) === 34) {
690
+ s1 = peg$c22;
691
+ peg$currPos++;
692
+ } else {
693
+ s1 = peg$FAILED;
694
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
695
+ }
696
+ if (s1 !== peg$FAILED) {
697
+ s2 = [];
698
+ s3 = peg$parseStringContents();
699
+ while (s3 !== peg$FAILED) {
700
+ s2.push(s3);
701
+ s3 = peg$parseStringContents();
702
+ }
703
+ if (s2 !== peg$FAILED) {
704
+ if (input.charCodeAt(peg$currPos) === 34) {
705
+ s3 = peg$c22;
706
+ peg$currPos++;
707
+ } else {
708
+ s3 = peg$FAILED;
709
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
710
+ }
711
+ if (s3 !== peg$FAILED) {
712
+ peg$savedPos = s0;
713
+ s1 = peg$c24(s2);
714
+ s0 = s1;
715
+ } else {
716
+ peg$currPos = s0;
717
+ s0 = peg$FAILED;
718
+ }
719
+ } else {
720
+ peg$currPos = s0;
721
+ s0 = peg$FAILED;
722
+ }
723
+ } else {
724
+ peg$currPos = s0;
725
+ s0 = peg$FAILED;
726
+ }
727
+
728
+ return s0;
729
+ }
730
+
731
+ function peg$parseStringContents() {
732
+ var s0, s1, s2;
733
+
734
+ s0 = peg$currPos;
735
+ s1 = peg$currPos;
736
+ peg$silentFails++;
737
+ if (input.charCodeAt(peg$currPos) === 34) {
738
+ s2 = peg$c22;
739
+ peg$currPos++;
740
+ } else {
741
+ s2 = peg$FAILED;
742
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
743
+ }
744
+ if (s2 === peg$FAILED) {
745
+ if (input.charCodeAt(peg$currPos) === 92) {
746
+ s2 = peg$c25;
747
+ peg$currPos++;
748
+ } else {
749
+ s2 = peg$FAILED;
750
+ if (peg$silentFails === 0) { peg$fail(peg$c26); }
751
+ }
752
+ }
753
+ peg$silentFails--;
754
+ if (s2 === peg$FAILED) {
755
+ s1 = void 0;
756
+ } else {
757
+ peg$currPos = s1;
758
+ s1 = peg$FAILED;
759
+ }
760
+ if (s1 !== peg$FAILED) {
761
+ if (input.length > peg$currPos) {
762
+ s2 = input.charAt(peg$currPos);
763
+ peg$currPos++;
764
+ } else {
765
+ s2 = peg$FAILED;
766
+ if (peg$silentFails === 0) { peg$fail(peg$c27); }
767
+ }
768
+ if (s2 !== peg$FAILED) {
769
+ peg$savedPos = s0;
770
+ s1 = peg$c28(s2);
771
+ s0 = s1;
772
+ } else {
773
+ peg$currPos = s0;
774
+ s0 = peg$FAILED;
775
+ }
776
+ } else {
777
+ peg$currPos = s0;
778
+ s0 = peg$FAILED;
779
+ }
780
+ if (s0 === peg$FAILED) {
781
+ s0 = peg$currPos;
782
+ if (input.charCodeAt(peg$currPos) === 92) {
783
+ s1 = peg$c25;
784
+ peg$currPos++;
785
+ } else {
786
+ s1 = peg$FAILED;
787
+ if (peg$silentFails === 0) { peg$fail(peg$c26); }
788
+ }
789
+ if (s1 !== peg$FAILED) {
790
+ s2 = peg$parseEscapeChar();
791
+ if (s2 !== peg$FAILED) {
792
+ peg$savedPos = s0;
793
+ s1 = peg$c28(s2);
794
+ s0 = s1;
795
+ } else {
796
+ peg$currPos = s0;
797
+ s0 = peg$FAILED;
798
+ }
799
+ } else {
800
+ peg$currPos = s0;
801
+ s0 = peg$FAILED;
802
+ }
803
+ }
804
+
805
+ return s0;
806
+ }
807
+
808
+ function peg$parseEscapeChar() {
809
+ var s0;
810
+
811
+ if (input.charCodeAt(peg$currPos) === 34) {
812
+ s0 = peg$c22;
813
+ peg$currPos++;
814
+ } else {
815
+ s0 = peg$FAILED;
816
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
817
+ }
818
+ if (s0 === peg$FAILED) {
819
+ if (input.charCodeAt(peg$currPos) === 92) {
820
+ s0 = peg$c25;
821
+ peg$currPos++;
822
+ } else {
823
+ s0 = peg$FAILED;
824
+ if (peg$silentFails === 0) { peg$fail(peg$c26); }
825
+ }
826
+ }
827
+
828
+ return s0;
829
+ }
830
+
831
+ function peg$parse_() {
832
+ var s0, s1;
833
+
834
+ s0 = [];
835
+ s1 = peg$parseFiller();
836
+ while (s1 !== peg$FAILED) {
837
+ s0.push(s1);
838
+ s1 = peg$parseFiller();
839
+ }
840
+
841
+ return s0;
842
+ }
843
+
844
+ function peg$parseFiller() {
845
+ var s0, s1, s2, s3;
846
+
847
+ if (peg$c29.test(input.charAt(peg$currPos))) {
848
+ s0 = input.charAt(peg$currPos);
849
+ peg$currPos++;
850
+ } else {
851
+ s0 = peg$FAILED;
852
+ if (peg$silentFails === 0) { peg$fail(peg$c30); }
853
+ }
854
+ if (s0 === peg$FAILED) {
855
+ s0 = peg$currPos;
856
+ if (input.charCodeAt(peg$currPos) === 59) {
857
+ s1 = peg$c31;
858
+ peg$currPos++;
859
+ } else {
860
+ s1 = peg$FAILED;
861
+ if (peg$silentFails === 0) { peg$fail(peg$c32); }
862
+ }
863
+ if (s1 !== peg$FAILED) {
864
+ s2 = [];
865
+ if (peg$c33.test(input.charAt(peg$currPos))) {
866
+ s3 = input.charAt(peg$currPos);
867
+ peg$currPos++;
868
+ } else {
869
+ s3 = peg$FAILED;
870
+ if (peg$silentFails === 0) { peg$fail(peg$c34); }
871
+ }
872
+ while (s3 !== peg$FAILED) {
873
+ s2.push(s3);
874
+ if (peg$c33.test(input.charAt(peg$currPos))) {
875
+ s3 = input.charAt(peg$currPos);
876
+ peg$currPos++;
877
+ } else {
878
+ s3 = peg$FAILED;
879
+ if (peg$silentFails === 0) { peg$fail(peg$c34); }
880
+ }
881
+ }
882
+ if (s2 !== peg$FAILED) {
883
+ if (peg$c35.test(input.charAt(peg$currPos))) {
884
+ s3 = input.charAt(peg$currPos);
885
+ peg$currPos++;
886
+ } else {
887
+ s3 = peg$FAILED;
888
+ if (peg$silentFails === 0) { peg$fail(peg$c36); }
889
+ }
890
+ if (s3 !== peg$FAILED) {
891
+ s1 = [s1, s2, s3];
892
+ s0 = s1;
893
+ } else {
894
+ peg$currPos = s0;
895
+ s0 = peg$FAILED;
896
+ }
897
+ } else {
898
+ peg$currPos = s0;
899
+ s0 = peg$FAILED;
900
+ }
901
+ } else {
902
+ peg$currPos = s0;
903
+ s0 = peg$FAILED;
904
+ }
905
+ if (s0 === peg$FAILED) {
906
+ s0 = peg$currPos;
907
+ if (input.charCodeAt(peg$currPos) === 59) {
908
+ s1 = peg$c31;
909
+ peg$currPos++;
910
+ } else {
911
+ s1 = peg$FAILED;
912
+ if (peg$silentFails === 0) { peg$fail(peg$c32); }
913
+ }
914
+ if (s1 !== peg$FAILED) {
915
+ s2 = [];
916
+ if (peg$c33.test(input.charAt(peg$currPos))) {
917
+ s3 = input.charAt(peg$currPos);
918
+ peg$currPos++;
919
+ } else {
920
+ s3 = peg$FAILED;
921
+ if (peg$silentFails === 0) { peg$fail(peg$c34); }
922
+ }
923
+ while (s3 !== peg$FAILED) {
924
+ s2.push(s3);
925
+ if (peg$c33.test(input.charAt(peg$currPos))) {
926
+ s3 = input.charAt(peg$currPos);
927
+ peg$currPos++;
928
+ } else {
929
+ s3 = peg$FAILED;
930
+ if (peg$silentFails === 0) { peg$fail(peg$c34); }
931
+ }
932
+ }
933
+ if (s2 !== peg$FAILED) {
934
+ s3 = peg$parseEOF();
935
+ if (s3 !== peg$FAILED) {
936
+ s1 = [s1, s2, s3];
937
+ s0 = s1;
938
+ } else {
939
+ peg$currPos = s0;
940
+ s0 = peg$FAILED;
941
+ }
942
+ } else {
943
+ peg$currPos = s0;
944
+ s0 = peg$FAILED;
945
+ }
946
+ } else {
947
+ peg$currPos = s0;
948
+ s0 = peg$FAILED;
949
+ }
950
+ }
951
+ }
952
+
953
+ return s0;
954
+ }
955
+
956
+ function peg$parseEOF() {
957
+ var s0, s1;
958
+
959
+ s0 = peg$currPos;
960
+ peg$silentFails++;
961
+ if (input.length > peg$currPos) {
962
+ s1 = input.charAt(peg$currPos);
963
+ peg$currPos++;
964
+ } else {
965
+ s1 = peg$FAILED;
966
+ if (peg$silentFails === 0) { peg$fail(peg$c27); }
967
+ }
968
+ peg$silentFails--;
969
+ if (s1 === peg$FAILED) {
970
+ s0 = void 0;
971
+ } else {
972
+ peg$currPos = s0;
973
+ s0 = peg$FAILED;
974
+ }
975
+
976
+ return s0;
977
+ }
978
+
979
+
980
+ const formatter = options.formatter;
981
+ const loc = () => formatter.formatLocation(location());
982
+
983
+
984
+ peg$result = peg$startRuleFunction();
985
+
986
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
987
+ return peg$result;
988
+ } else {
989
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
990
+ peg$fail(peg$endExpectation());
991
+ }
992
+
993
+ throw peg$buildStructuredError(
994
+ peg$maxFailExpected,
995
+ peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
996
+ peg$maxFailPos < input.length
997
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
998
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
999
+ );
1000
+ }
1001
+ }
1002
+
1003
+ module.exports = {
1004
+ SyntaxError: peg$SyntaxError,
1005
+ parse: peg$parse
1006
+ };