@letsrunit/gherkin 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1419 @@
1
+ // @generated by Peggy 5.0.6.
2
+ //
3
+ // https://peggyjs.org/
4
+
5
+
6
+ class peg$SyntaxError extends SyntaxError {
7
+ constructor(message, expected, found, location) {
8
+ super(message);
9
+ this.expected = expected;
10
+ this.found = found;
11
+ this.location = location;
12
+ this.name = "SyntaxError";
13
+ }
14
+
15
+ format(sources) {
16
+ let str = "Error: " + this.message;
17
+ if (this.location) {
18
+ let src = null;
19
+ const st = sources.find(s => s.source === this.location.source);
20
+ if (st) {
21
+ src = st.text.split(/\r\n|\n|\r/g);
22
+ }
23
+ const s = this.location.start;
24
+ const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
25
+ ? this.location.source.offset(s)
26
+ : s;
27
+ const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
28
+ if (src) {
29
+ const e = this.location.end;
30
+ const filler = "".padEnd(offset_s.line.toString().length, " ");
31
+ const line = src[s.line - 1];
32
+ const last = s.line === e.line ? e.column : line.length + 1;
33
+ const hatLen = (last - s.column) || 1;
34
+ str += "\n --> " + loc + "\n"
35
+ + filler + " |\n"
36
+ + offset_s.line + " | " + line + "\n"
37
+ + filler + " | " + "".padEnd(s.column - 1, " ")
38
+ + "".padEnd(hatLen, "^");
39
+ } else {
40
+ str += "\n at " + loc;
41
+ }
42
+ }
43
+ return str;
44
+ }
45
+
46
+ static buildMessage(expected, found) {
47
+ function hex(ch) {
48
+ return ch.codePointAt(0).toString(16).toUpperCase();
49
+ }
50
+
51
+ const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
52
+ ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
53
+ : null;
54
+ function unicodeEscape(s) {
55
+ if (nonPrintable) {
56
+ return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
57
+ }
58
+ return s;
59
+ }
60
+
61
+ function literalEscape(s) {
62
+ return unicodeEscape(s
63
+ .replace(/\\/g, "\\\\")
64
+ .replace(/"/g, "\\\"")
65
+ .replace(/\0/g, "\\0")
66
+ .replace(/\t/g, "\\t")
67
+ .replace(/\n/g, "\\n")
68
+ .replace(/\r/g, "\\r")
69
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
70
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
71
+ }
72
+
73
+ function classEscape(s) {
74
+ return unicodeEscape(s
75
+ .replace(/\\/g, "\\\\")
76
+ .replace(/\]/g, "\\]")
77
+ .replace(/\^/g, "\\^")
78
+ .replace(/-/g, "\\-")
79
+ .replace(/\0/g, "\\0")
80
+ .replace(/\t/g, "\\t")
81
+ .replace(/\n/g, "\\n")
82
+ .replace(/\r/g, "\\r")
83
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
84
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
85
+ }
86
+
87
+ const DESCRIBE_EXPECTATION_FNS = {
88
+ literal(expectation) {
89
+ return "\"" + literalEscape(expectation.text) + "\"";
90
+ },
91
+
92
+ class(expectation) {
93
+ const escapedParts = expectation.parts.map(
94
+ part => (Array.isArray(part)
95
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
96
+ : classEscape(part))
97
+ );
98
+
99
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
100
+ },
101
+
102
+ any() {
103
+ return "any character";
104
+ },
105
+
106
+ end() {
107
+ return "end of input";
108
+ },
109
+
110
+ other(expectation) {
111
+ return expectation.description;
112
+ },
113
+ };
114
+
115
+ function describeExpectation(expectation) {
116
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
117
+ }
118
+
119
+ function describeExpected(expected) {
120
+ const descriptions = expected.map(describeExpectation);
121
+ descriptions.sort();
122
+
123
+ if (descriptions.length > 0) {
124
+ let j = 1;
125
+ for (let i = 1; i < descriptions.length; i++) {
126
+ if (descriptions[i - 1] !== descriptions[i]) {
127
+ descriptions[j] = descriptions[i];
128
+ j++;
129
+ }
130
+ }
131
+ descriptions.length = j;
132
+ }
133
+
134
+ switch (descriptions.length) {
135
+ case 1:
136
+ return descriptions[0];
137
+
138
+ case 2:
139
+ return descriptions[0] + " or " + descriptions[1];
140
+
141
+ default:
142
+ return descriptions.slice(0, -1).join(", ")
143
+ + ", or "
144
+ + descriptions[descriptions.length - 1];
145
+ }
146
+ }
147
+
148
+ function describeFound(found) {
149
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
150
+ }
151
+
152
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
153
+ }
154
+ }
155
+
156
+ function peg$parse(input, options) {
157
+ options = options !== undefined ? options : {};
158
+
159
+ const peg$FAILED = {};
160
+ const peg$source = options.grammarSource;
161
+
162
+ const peg$startRuleFunctions = {
163
+ Start: peg$parseStart,
164
+ };
165
+ let peg$startRuleFunction = peg$parseStart;
166
+
167
+ const peg$c0 = "within";
168
+ const peg$c1 = "with";
169
+ const peg$c2 = "without";
170
+ const peg$c3 = "`";
171
+ const peg$c4 = "date";
172
+ const peg$c5 = "of";
173
+ const peg$c6 = "button";
174
+ const peg$c7 = "link";
175
+ const peg$c8 = "field";
176
+ const peg$c9 = "image";
177
+ const peg$c10 = "text";
178
+ const peg$c11 = "the";
179
+ const peg$c12 = "\"";
180
+ const peg$c13 = "\\\"";
181
+
182
+ const peg$r0 = /^[a-zA-Z]/;
183
+ const peg$r1 = /^[^`]/;
184
+ const peg$r2 = /^[a-zA-Z_]/;
185
+ const peg$r3 = /^[a-zA-Z0-9_\-]/;
186
+ const peg$r4 = /^[ \t\r\n]/;
187
+
188
+ const peg$e0 = peg$literalExpectation("within", true);
189
+ const peg$e1 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
190
+ const peg$e2 = peg$literalExpectation("with", true);
191
+ const peg$e3 = peg$literalExpectation("without", true);
192
+ const peg$e4 = peg$literalExpectation("`", false);
193
+ const peg$e5 = peg$classExpectation(["`"], true, false, false);
194
+ const peg$e6 = peg$literalExpectation("date", true);
195
+ const peg$e7 = peg$literalExpectation("of", true);
196
+ const peg$e8 = peg$anyExpectation();
197
+ const peg$e9 = peg$literalExpectation("button", true);
198
+ const peg$e10 = peg$literalExpectation("link", true);
199
+ const peg$e11 = peg$literalExpectation("field", true);
200
+ const peg$e12 = peg$literalExpectation("image", true);
201
+ const peg$e13 = peg$literalExpectation("text", true);
202
+ const peg$e14 = peg$literalExpectation("the", true);
203
+ const peg$e15 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false);
204
+ const peg$e16 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false, false);
205
+ const peg$e17 = peg$literalExpectation("\"", false);
206
+ const peg$e18 = peg$literalExpectation("\\\"", false);
207
+ const peg$e19 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false);
208
+
209
+ function peg$f0(e) { return e; }
210
+ function peg$f1(base, s) { return s; }
211
+ function peg$f2(base, rest) { return { type: "Within", base, ancestors: rest ?? [] }; }
212
+ function peg$f3(sel, wp) { return wp; }
213
+ function peg$f4(sel, parts) {
214
+ const include = [], exclude = [];
215
+ for (const x of parts) {
216
+ (x.incl ? include : exclude).push(x.p);
217
+ }
218
+ return { type: "With", selector: sel, include, exclude };
219
+ }
220
+ function peg$f5(p) { return { incl: true, p }; }
221
+ function peg$f6(p) { return { incl: false, p }; }
222
+ function peg$f7(s) { return { type: "Selector", mode: "raw", raw: s.trim() }; }
223
+ function peg$f8(base) { return { type: "Selector", mode: "role", role: base.role, name: base.name }; }
224
+ function peg$f9(n) { return { type: "Selector", mode: "date", name: n }; }
225
+ function peg$f10(s) { return `"${s}"`; }
226
+ function peg$f11(r, n) { return { role: r, name: n ?? null }; }
227
+ function peg$f12(r, n) { return { role: r, name: n }; }
228
+ function peg$f13(t) { return { type: "Selector", mode: "tag", tag: t }; }
229
+ function peg$f14(sel) { return { type: "HasDescendant", selector: sel }; }
230
+ function peg$f15(chars) { return chars; }
231
+ let peg$currPos = options.peg$currPos | 0;
232
+ let peg$savedPos = peg$currPos;
233
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
234
+ let peg$maxFailPos = peg$currPos;
235
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
236
+ let peg$silentFails = options.peg$silentFails | 0;
237
+
238
+ let peg$result;
239
+
240
+ if (options.startRule) {
241
+ if (!(options.startRule in peg$startRuleFunctions)) {
242
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
243
+ }
244
+
245
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
246
+ }
247
+
248
+ function text() {
249
+ return input.substring(peg$savedPos, peg$currPos);
250
+ }
251
+
252
+ function offset() {
253
+ return peg$savedPos;
254
+ }
255
+
256
+ function range() {
257
+ return {
258
+ source: peg$source,
259
+ start: peg$savedPos,
260
+ end: peg$currPos,
261
+ };
262
+ }
263
+
264
+ function location() {
265
+ return peg$computeLocation(peg$savedPos, peg$currPos);
266
+ }
267
+
268
+ function expected(description, location) {
269
+ location = location !== undefined
270
+ ? location
271
+ : peg$computeLocation(peg$savedPos, peg$currPos);
272
+
273
+ throw peg$buildStructuredError(
274
+ [peg$otherExpectation(description)],
275
+ input.substring(peg$savedPos, peg$currPos),
276
+ location
277
+ );
278
+ }
279
+
280
+ function error(message, location) {
281
+ location = location !== undefined
282
+ ? location
283
+ : peg$computeLocation(peg$savedPos, peg$currPos);
284
+
285
+ throw peg$buildSimpleError(message, location);
286
+ }
287
+
288
+ function peg$getUnicode(pos = peg$currPos) {
289
+ const cp = input.codePointAt(pos);
290
+ if (cp === undefined) {
291
+ return "";
292
+ }
293
+ return String.fromCodePoint(cp);
294
+ }
295
+
296
+ function peg$literalExpectation(text, ignoreCase) {
297
+ return { type: "literal", text, ignoreCase };
298
+ }
299
+
300
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
301
+ return { type: "class", parts, inverted, ignoreCase, unicode };
302
+ }
303
+
304
+ function peg$anyExpectation() {
305
+ return { type: "any" };
306
+ }
307
+
308
+ function peg$endExpectation() {
309
+ return { type: "end" };
310
+ }
311
+
312
+ function peg$otherExpectation(description) {
313
+ return { type: "other", description };
314
+ }
315
+
316
+ function peg$computePosDetails(pos) {
317
+ let details = peg$posDetailsCache[pos];
318
+ let p;
319
+
320
+ if (details) {
321
+ return details;
322
+ } else {
323
+ if (pos >= peg$posDetailsCache.length) {
324
+ p = peg$posDetailsCache.length - 1;
325
+ } else {
326
+ p = pos;
327
+ while (!peg$posDetailsCache[--p]) {}
328
+ }
329
+
330
+ details = peg$posDetailsCache[p];
331
+ details = {
332
+ line: details.line,
333
+ column: details.column,
334
+ };
335
+
336
+ while (p < pos) {
337
+ if (input.charCodeAt(p) === 10) {
338
+ details.line++;
339
+ details.column = 1;
340
+ } else {
341
+ details.column++;
342
+ }
343
+
344
+ p++;
345
+ }
346
+
347
+ peg$posDetailsCache[pos] = details;
348
+
349
+ return details;
350
+ }
351
+ }
352
+
353
+ function peg$computeLocation(startPos, endPos, offset) {
354
+ const startPosDetails = peg$computePosDetails(startPos);
355
+ const endPosDetails = peg$computePosDetails(endPos);
356
+
357
+ const res = {
358
+ source: peg$source,
359
+ start: {
360
+ offset: startPos,
361
+ line: startPosDetails.line,
362
+ column: startPosDetails.column,
363
+ },
364
+ end: {
365
+ offset: endPos,
366
+ line: endPosDetails.line,
367
+ column: endPosDetails.column,
368
+ },
369
+ };
370
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
371
+ res.start = peg$source.offset(res.start);
372
+ res.end = peg$source.offset(res.end);
373
+ }
374
+ return res;
375
+ }
376
+
377
+ function peg$fail(expected) {
378
+ if (peg$currPos < peg$maxFailPos) { return; }
379
+
380
+ if (peg$currPos > peg$maxFailPos) {
381
+ peg$maxFailPos = peg$currPos;
382
+ peg$maxFailExpected = [];
383
+ }
384
+
385
+ peg$maxFailExpected.push(expected);
386
+ }
387
+
388
+ function peg$buildSimpleError(message, location) {
389
+ return new peg$SyntaxError(message, null, null, location);
390
+ }
391
+
392
+ function peg$buildStructuredError(expected, found, location) {
393
+ return new peg$SyntaxError(
394
+ peg$SyntaxError.buildMessage(expected, found),
395
+ expected,
396
+ found,
397
+ location
398
+ );
399
+ }
400
+
401
+ function peg$parseStart() {
402
+ let s0, s1, s2, s3;
403
+
404
+ s0 = peg$currPos;
405
+ s1 = peg$parse_();
406
+ s2 = peg$parseExpr();
407
+ if (s2 !== peg$FAILED) {
408
+ s3 = peg$parse_();
409
+ peg$savedPos = s0;
410
+ s0 = peg$f0(s2);
411
+ } else {
412
+ peg$currPos = s0;
413
+ s0 = peg$FAILED;
414
+ }
415
+
416
+ return s0;
417
+ }
418
+
419
+ function peg$parseExpr() {
420
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8;
421
+
422
+ s0 = peg$currPos;
423
+ s1 = peg$parseWithExpr();
424
+ if (s1 !== peg$FAILED) {
425
+ s2 = [];
426
+ s3 = peg$currPos;
427
+ s4 = peg$parse_();
428
+ s5 = input.substr(peg$currPos, 6);
429
+ if (s5.toLowerCase() === peg$c0) {
430
+ peg$currPos += (6);
431
+ } else {
432
+ s5 = peg$FAILED;
433
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
434
+ }
435
+ if (s5 !== peg$FAILED) {
436
+ s6 = peg$currPos;
437
+ peg$silentFails++;
438
+ s7 = input.charAt(peg$currPos);
439
+ if (peg$r0.test(s7)) {
440
+ peg$currPos++;
441
+ } else {
442
+ s7 = peg$FAILED;
443
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
444
+ }
445
+ peg$silentFails--;
446
+ if (s7 === peg$FAILED) {
447
+ s6 = undefined;
448
+ } else {
449
+ peg$currPos = s6;
450
+ s6 = peg$FAILED;
451
+ }
452
+ if (s6 !== peg$FAILED) {
453
+ s7 = peg$parse_();
454
+ s8 = peg$parseSelector();
455
+ if (s8 !== peg$FAILED) {
456
+ peg$savedPos = s3;
457
+ s3 = peg$f1(s1, s8);
458
+ } else {
459
+ peg$currPos = s3;
460
+ s3 = peg$FAILED;
461
+ }
462
+ } else {
463
+ peg$currPos = s3;
464
+ s3 = peg$FAILED;
465
+ }
466
+ } else {
467
+ peg$currPos = s3;
468
+ s3 = peg$FAILED;
469
+ }
470
+ while (s3 !== peg$FAILED) {
471
+ s2.push(s3);
472
+ s3 = peg$currPos;
473
+ s4 = peg$parse_();
474
+ s5 = input.substr(peg$currPos, 6);
475
+ if (s5.toLowerCase() === peg$c0) {
476
+ peg$currPos += (6);
477
+ } else {
478
+ s5 = peg$FAILED;
479
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
480
+ }
481
+ if (s5 !== peg$FAILED) {
482
+ s6 = peg$currPos;
483
+ peg$silentFails++;
484
+ s7 = input.charAt(peg$currPos);
485
+ if (peg$r0.test(s7)) {
486
+ peg$currPos++;
487
+ } else {
488
+ s7 = peg$FAILED;
489
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
490
+ }
491
+ peg$silentFails--;
492
+ if (s7 === peg$FAILED) {
493
+ s6 = undefined;
494
+ } else {
495
+ peg$currPos = s6;
496
+ s6 = peg$FAILED;
497
+ }
498
+ if (s6 !== peg$FAILED) {
499
+ s7 = peg$parse_();
500
+ s8 = peg$parseSelector();
501
+ if (s8 !== peg$FAILED) {
502
+ peg$savedPos = s3;
503
+ s3 = peg$f1(s1, s8);
504
+ } else {
505
+ peg$currPos = s3;
506
+ s3 = peg$FAILED;
507
+ }
508
+ } else {
509
+ peg$currPos = s3;
510
+ s3 = peg$FAILED;
511
+ }
512
+ } else {
513
+ peg$currPos = s3;
514
+ s3 = peg$FAILED;
515
+ }
516
+ }
517
+ peg$savedPos = s0;
518
+ s0 = peg$f2(s1, s2);
519
+ } else {
520
+ peg$currPos = s0;
521
+ s0 = peg$FAILED;
522
+ }
523
+
524
+ return s0;
525
+ }
526
+
527
+ function peg$parseWithExpr() {
528
+ let s0, s1, s2, s3, s4, s5;
529
+
530
+ s0 = peg$currPos;
531
+ s1 = peg$parseSelector();
532
+ if (s1 !== peg$FAILED) {
533
+ s2 = [];
534
+ s3 = peg$currPos;
535
+ s4 = peg$parse_();
536
+ s5 = peg$parseWithPart();
537
+ if (s5 !== peg$FAILED) {
538
+ peg$savedPos = s3;
539
+ s3 = peg$f3(s1, s5);
540
+ } else {
541
+ peg$currPos = s3;
542
+ s3 = peg$FAILED;
543
+ }
544
+ while (s3 !== peg$FAILED) {
545
+ s2.push(s3);
546
+ s3 = peg$currPos;
547
+ s4 = peg$parse_();
548
+ s5 = peg$parseWithPart();
549
+ if (s5 !== peg$FAILED) {
550
+ peg$savedPos = s3;
551
+ s3 = peg$f3(s1, s5);
552
+ } else {
553
+ peg$currPos = s3;
554
+ s3 = peg$FAILED;
555
+ }
556
+ }
557
+ peg$savedPos = s0;
558
+ s0 = peg$f4(s1, s2);
559
+ } else {
560
+ peg$currPos = s0;
561
+ s0 = peg$FAILED;
562
+ }
563
+
564
+ return s0;
565
+ }
566
+
567
+ function peg$parseWithPart() {
568
+ let s0, s1, s2, s3, s4;
569
+
570
+ s0 = peg$currPos;
571
+ s1 = input.substr(peg$currPos, 4);
572
+ if (s1.toLowerCase() === peg$c1) {
573
+ peg$currPos += (4);
574
+ } else {
575
+ s1 = peg$FAILED;
576
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
577
+ }
578
+ if (s1 !== peg$FAILED) {
579
+ s2 = peg$currPos;
580
+ peg$silentFails++;
581
+ s3 = input.charAt(peg$currPos);
582
+ if (peg$r0.test(s3)) {
583
+ peg$currPos++;
584
+ } else {
585
+ s3 = peg$FAILED;
586
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
587
+ }
588
+ peg$silentFails--;
589
+ if (s3 === peg$FAILED) {
590
+ s2 = undefined;
591
+ } else {
592
+ peg$currPos = s2;
593
+ s2 = peg$FAILED;
594
+ }
595
+ if (s2 !== peg$FAILED) {
596
+ s3 = peg$parse_();
597
+ s4 = peg$parsePredicate();
598
+ if (s4 !== peg$FAILED) {
599
+ peg$savedPos = s0;
600
+ s0 = peg$f5(s4);
601
+ } else {
602
+ peg$currPos = s0;
603
+ s0 = peg$FAILED;
604
+ }
605
+ } else {
606
+ peg$currPos = s0;
607
+ s0 = peg$FAILED;
608
+ }
609
+ } else {
610
+ peg$currPos = s0;
611
+ s0 = peg$FAILED;
612
+ }
613
+ if (s0 === peg$FAILED) {
614
+ s0 = peg$currPos;
615
+ s1 = input.substr(peg$currPos, 7);
616
+ if (s1.toLowerCase() === peg$c2) {
617
+ peg$currPos += (7);
618
+ } else {
619
+ s1 = peg$FAILED;
620
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
621
+ }
622
+ if (s1 !== peg$FAILED) {
623
+ s2 = peg$currPos;
624
+ peg$silentFails++;
625
+ s3 = input.charAt(peg$currPos);
626
+ if (peg$r0.test(s3)) {
627
+ peg$currPos++;
628
+ } else {
629
+ s3 = peg$FAILED;
630
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
631
+ }
632
+ peg$silentFails--;
633
+ if (s3 === peg$FAILED) {
634
+ s2 = undefined;
635
+ } else {
636
+ peg$currPos = s2;
637
+ s2 = peg$FAILED;
638
+ }
639
+ if (s2 !== peg$FAILED) {
640
+ s3 = peg$parse_();
641
+ s4 = peg$parsePredicate();
642
+ if (s4 !== peg$FAILED) {
643
+ peg$savedPos = s0;
644
+ s0 = peg$f6(s4);
645
+ } else {
646
+ peg$currPos = s0;
647
+ s0 = peg$FAILED;
648
+ }
649
+ } else {
650
+ peg$currPos = s0;
651
+ s0 = peg$FAILED;
652
+ }
653
+ } else {
654
+ peg$currPos = s0;
655
+ s0 = peg$FAILED;
656
+ }
657
+ }
658
+
659
+ return s0;
660
+ }
661
+
662
+ function peg$parseSelector() {
663
+ let s0;
664
+
665
+ s0 = peg$parseRawSel();
666
+ if (s0 === peg$FAILED) {
667
+ s0 = peg$parseDateSel();
668
+ if (s0 === peg$FAILED) {
669
+ s0 = peg$parseRoleSelFull();
670
+ if (s0 === peg$FAILED) {
671
+ s0 = peg$parseTagSelFull();
672
+ }
673
+ }
674
+ }
675
+
676
+ return s0;
677
+ }
678
+
679
+ function peg$parseRawSel() {
680
+ let s0, s1, s2, s3;
681
+
682
+ s0 = peg$currPos;
683
+ if (input.charCodeAt(peg$currPos) === 96) {
684
+ s1 = peg$c3;
685
+ peg$currPos++;
686
+ } else {
687
+ s1 = peg$FAILED;
688
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
689
+ }
690
+ if (s1 !== peg$FAILED) {
691
+ s2 = peg$parseRawChars();
692
+ if (input.charCodeAt(peg$currPos) === 96) {
693
+ s3 = peg$c3;
694
+ peg$currPos++;
695
+ } else {
696
+ s3 = peg$FAILED;
697
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
698
+ }
699
+ if (s3 !== peg$FAILED) {
700
+ peg$savedPos = s0;
701
+ s0 = peg$f7(s2);
702
+ } else {
703
+ peg$currPos = s0;
704
+ s0 = peg$FAILED;
705
+ }
706
+ } else {
707
+ peg$currPos = s0;
708
+ s0 = peg$FAILED;
709
+ }
710
+
711
+ return s0;
712
+ }
713
+
714
+ function peg$parseRawChars() {
715
+ let s0, s1, s2;
716
+
717
+ s0 = peg$currPos;
718
+ s1 = [];
719
+ s2 = input.charAt(peg$currPos);
720
+ if (peg$r1.test(s2)) {
721
+ peg$currPos++;
722
+ } else {
723
+ s2 = peg$FAILED;
724
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
725
+ }
726
+ while (s2 !== peg$FAILED) {
727
+ s1.push(s2);
728
+ s2 = input.charAt(peg$currPos);
729
+ if (peg$r1.test(s2)) {
730
+ peg$currPos++;
731
+ } else {
732
+ s2 = peg$FAILED;
733
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
734
+ }
735
+ }
736
+ s0 = input.substring(s0, peg$currPos);
737
+
738
+ return s0;
739
+ }
740
+
741
+ function peg$parseRoleSelFull() {
742
+ let s0, s1, s2;
743
+
744
+ s0 = peg$currPos;
745
+ s1 = peg$parseTheOpt();
746
+ if (s1 === peg$FAILED) {
747
+ s1 = null;
748
+ }
749
+ s2 = peg$parseRoleSel();
750
+ if (s2 !== peg$FAILED) {
751
+ peg$savedPos = s0;
752
+ s0 = peg$f8(s2);
753
+ } else {
754
+ peg$currPos = s0;
755
+ s0 = peg$FAILED;
756
+ }
757
+
758
+ return s0;
759
+ }
760
+
761
+ function peg$parseDateSel() {
762
+ let s0, s1, s2, s3, s4;
763
+
764
+ s0 = peg$currPos;
765
+ s1 = input.substr(peg$currPos, 4);
766
+ if (s1.toLowerCase() === peg$c4) {
767
+ peg$currPos += (4);
768
+ } else {
769
+ s1 = peg$FAILED;
770
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
771
+ }
772
+ if (s1 !== peg$FAILED) {
773
+ s2 = peg$parse_();
774
+ s3 = peg$parseOfOpt();
775
+ if (s3 === peg$FAILED) {
776
+ s3 = null;
777
+ }
778
+ s4 = peg$parseDateValue();
779
+ if (s4 !== peg$FAILED) {
780
+ peg$savedPos = s0;
781
+ s0 = peg$f9(s4);
782
+ } else {
783
+ peg$currPos = s0;
784
+ s0 = peg$FAILED;
785
+ }
786
+ } else {
787
+ peg$currPos = s0;
788
+ s0 = peg$FAILED;
789
+ }
790
+
791
+ return s0;
792
+ }
793
+
794
+ function peg$parseOfOpt() {
795
+ let s0, s1, s2, s3;
796
+
797
+ s0 = peg$currPos;
798
+ s1 = input.substr(peg$currPos, 2);
799
+ if (s1.toLowerCase() === peg$c5) {
800
+ peg$currPos += (2);
801
+ } else {
802
+ s1 = peg$FAILED;
803
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
804
+ }
805
+ if (s1 !== peg$FAILED) {
806
+ s2 = peg$currPos;
807
+ peg$silentFails++;
808
+ s3 = input.charAt(peg$currPos);
809
+ if (peg$r0.test(s3)) {
810
+ peg$currPos++;
811
+ } else {
812
+ s3 = peg$FAILED;
813
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
814
+ }
815
+ peg$silentFails--;
816
+ if (s3 === peg$FAILED) {
817
+ s2 = undefined;
818
+ } else {
819
+ peg$currPos = s2;
820
+ s2 = peg$FAILED;
821
+ }
822
+ if (s2 !== peg$FAILED) {
823
+ s3 = peg$parse_();
824
+ s1 = [s1, s2, s3];
825
+ s0 = s1;
826
+ } else {
827
+ peg$currPos = s0;
828
+ s0 = peg$FAILED;
829
+ }
830
+ } else {
831
+ peg$currPos = s0;
832
+ s0 = peg$FAILED;
833
+ }
834
+
835
+ return s0;
836
+ }
837
+
838
+ function peg$parseDateValue() {
839
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8;
840
+
841
+ s0 = peg$currPos;
842
+ s1 = peg$parseStringLit();
843
+ if (s1 !== peg$FAILED) {
844
+ peg$savedPos = s0;
845
+ s1 = peg$f10(s1);
846
+ }
847
+ s0 = s1;
848
+ if (s0 === peg$FAILED) {
849
+ s0 = peg$currPos;
850
+ s1 = [];
851
+ s2 = peg$currPos;
852
+ s3 = peg$currPos;
853
+ peg$silentFails++;
854
+ s4 = peg$currPos;
855
+ s5 = peg$parse_();
856
+ s6 = input.substr(peg$currPos, 6);
857
+ if (s6.toLowerCase() === peg$c0) {
858
+ peg$currPos += (6);
859
+ } else {
860
+ s6 = peg$FAILED;
861
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
862
+ }
863
+ if (s6 !== peg$FAILED) {
864
+ s7 = peg$currPos;
865
+ peg$silentFails++;
866
+ s8 = input.charAt(peg$currPos);
867
+ if (peg$r0.test(s8)) {
868
+ peg$currPos++;
869
+ } else {
870
+ s8 = peg$FAILED;
871
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
872
+ }
873
+ peg$silentFails--;
874
+ if (s8 === peg$FAILED) {
875
+ s7 = undefined;
876
+ } else {
877
+ peg$currPos = s7;
878
+ s7 = peg$FAILED;
879
+ }
880
+ if (s7 !== peg$FAILED) {
881
+ s5 = [s5, s6, s7];
882
+ s4 = s5;
883
+ } else {
884
+ peg$currPos = s4;
885
+ s4 = peg$FAILED;
886
+ }
887
+ } else {
888
+ peg$currPos = s4;
889
+ s4 = peg$FAILED;
890
+ }
891
+ peg$silentFails--;
892
+ if (s4 === peg$FAILED) {
893
+ s3 = undefined;
894
+ } else {
895
+ peg$currPos = s3;
896
+ s3 = peg$FAILED;
897
+ }
898
+ if (s3 !== peg$FAILED) {
899
+ if (input.length > peg$currPos) {
900
+ s4 = input.charAt(peg$currPos);
901
+ peg$currPos++;
902
+ } else {
903
+ s4 = peg$FAILED;
904
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
905
+ }
906
+ if (s4 !== peg$FAILED) {
907
+ s3 = [s3, s4];
908
+ s2 = s3;
909
+ } else {
910
+ peg$currPos = s2;
911
+ s2 = peg$FAILED;
912
+ }
913
+ } else {
914
+ peg$currPos = s2;
915
+ s2 = peg$FAILED;
916
+ }
917
+ if (s2 !== peg$FAILED) {
918
+ while (s2 !== peg$FAILED) {
919
+ s1.push(s2);
920
+ s2 = peg$currPos;
921
+ s3 = peg$currPos;
922
+ peg$silentFails++;
923
+ s4 = peg$currPos;
924
+ s5 = peg$parse_();
925
+ s6 = input.substr(peg$currPos, 6);
926
+ if (s6.toLowerCase() === peg$c0) {
927
+ peg$currPos += (6);
928
+ } else {
929
+ s6 = peg$FAILED;
930
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
931
+ }
932
+ if (s6 !== peg$FAILED) {
933
+ s7 = peg$currPos;
934
+ peg$silentFails++;
935
+ s8 = input.charAt(peg$currPos);
936
+ if (peg$r0.test(s8)) {
937
+ peg$currPos++;
938
+ } else {
939
+ s8 = peg$FAILED;
940
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
941
+ }
942
+ peg$silentFails--;
943
+ if (s8 === peg$FAILED) {
944
+ s7 = undefined;
945
+ } else {
946
+ peg$currPos = s7;
947
+ s7 = peg$FAILED;
948
+ }
949
+ if (s7 !== peg$FAILED) {
950
+ s5 = [s5, s6, s7];
951
+ s4 = s5;
952
+ } else {
953
+ peg$currPos = s4;
954
+ s4 = peg$FAILED;
955
+ }
956
+ } else {
957
+ peg$currPos = s4;
958
+ s4 = peg$FAILED;
959
+ }
960
+ peg$silentFails--;
961
+ if (s4 === peg$FAILED) {
962
+ s3 = undefined;
963
+ } else {
964
+ peg$currPos = s3;
965
+ s3 = peg$FAILED;
966
+ }
967
+ if (s3 !== peg$FAILED) {
968
+ if (input.length > peg$currPos) {
969
+ s4 = input.charAt(peg$currPos);
970
+ peg$currPos++;
971
+ } else {
972
+ s4 = peg$FAILED;
973
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
974
+ }
975
+ if (s4 !== peg$FAILED) {
976
+ s3 = [s3, s4];
977
+ s2 = s3;
978
+ } else {
979
+ peg$currPos = s2;
980
+ s2 = peg$FAILED;
981
+ }
982
+ } else {
983
+ peg$currPos = s2;
984
+ s2 = peg$FAILED;
985
+ }
986
+ }
987
+ } else {
988
+ s1 = peg$FAILED;
989
+ }
990
+ if (s1 !== peg$FAILED) {
991
+ s0 = input.substring(s0, peg$currPos);
992
+ } else {
993
+ s0 = s1;
994
+ }
995
+ }
996
+
997
+ return s0;
998
+ }
999
+
1000
+ function peg$parseRoleSel() {
1001
+ let s0, s1, s2, s3;
1002
+
1003
+ s0 = peg$currPos;
1004
+ s1 = peg$parseKnownRole();
1005
+ if (s1 !== peg$FAILED) {
1006
+ s2 = peg$parse_();
1007
+ s3 = peg$parseStringLit();
1008
+ if (s3 === peg$FAILED) {
1009
+ s3 = null;
1010
+ }
1011
+ peg$savedPos = s0;
1012
+ s0 = peg$f11(s1, s3);
1013
+ } else {
1014
+ peg$currPos = s0;
1015
+ s0 = peg$FAILED;
1016
+ }
1017
+ if (s0 === peg$FAILED) {
1018
+ s0 = peg$currPos;
1019
+ s1 = peg$parseIdent();
1020
+ if (s1 !== peg$FAILED) {
1021
+ s2 = peg$parse_();
1022
+ s3 = peg$parseStringLit();
1023
+ if (s3 !== peg$FAILED) {
1024
+ peg$savedPos = s0;
1025
+ s0 = peg$f12(s1, s3);
1026
+ } else {
1027
+ peg$currPos = s0;
1028
+ s0 = peg$FAILED;
1029
+ }
1030
+ } else {
1031
+ peg$currPos = s0;
1032
+ s0 = peg$FAILED;
1033
+ }
1034
+ }
1035
+
1036
+ return s0;
1037
+ }
1038
+
1039
+ function peg$parseKnownRole() {
1040
+ let s0;
1041
+
1042
+ s0 = input.substr(peg$currPos, 6);
1043
+ if (s0.toLowerCase() === peg$c6) {
1044
+ peg$currPos += (6);
1045
+ } else {
1046
+ s0 = peg$FAILED;
1047
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
1048
+ }
1049
+ if (s0 === peg$FAILED) {
1050
+ s0 = input.substr(peg$currPos, 4);
1051
+ if (s0.toLowerCase() === peg$c7) {
1052
+ peg$currPos += (4);
1053
+ } else {
1054
+ s0 = peg$FAILED;
1055
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1056
+ }
1057
+ if (s0 === peg$FAILED) {
1058
+ s0 = input.substr(peg$currPos, 5);
1059
+ if (s0.toLowerCase() === peg$c8) {
1060
+ peg$currPos += (5);
1061
+ } else {
1062
+ s0 = peg$FAILED;
1063
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1064
+ }
1065
+ if (s0 === peg$FAILED) {
1066
+ s0 = input.substr(peg$currPos, 5);
1067
+ if (s0.toLowerCase() === peg$c9) {
1068
+ peg$currPos += (5);
1069
+ } else {
1070
+ s0 = peg$FAILED;
1071
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1072
+ }
1073
+ if (s0 === peg$FAILED) {
1074
+ s0 = input.substr(peg$currPos, 4);
1075
+ if (s0.toLowerCase() === peg$c10) {
1076
+ peg$currPos += (4);
1077
+ } else {
1078
+ s0 = peg$FAILED;
1079
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1080
+ }
1081
+ if (s0 === peg$FAILED) {
1082
+ s0 = input.substr(peg$currPos, 4);
1083
+ if (s0.toLowerCase() === peg$c4) {
1084
+ peg$currPos += (4);
1085
+ } else {
1086
+ s0 = peg$FAILED;
1087
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
1088
+ }
1089
+ }
1090
+ }
1091
+ }
1092
+ }
1093
+ }
1094
+
1095
+ return s0;
1096
+ }
1097
+
1098
+ function peg$parseTagSelFull() {
1099
+ let s0, s1, s2;
1100
+
1101
+ s0 = peg$currPos;
1102
+ s1 = peg$parseTheOpt();
1103
+ if (s1 === peg$FAILED) {
1104
+ s1 = null;
1105
+ }
1106
+ s2 = peg$parseIdent();
1107
+ if (s2 !== peg$FAILED) {
1108
+ peg$savedPos = s0;
1109
+ s0 = peg$f13(s2);
1110
+ } else {
1111
+ peg$currPos = s0;
1112
+ s0 = peg$FAILED;
1113
+ }
1114
+
1115
+ return s0;
1116
+ }
1117
+
1118
+ function peg$parsePredicate() {
1119
+ let s0, s1;
1120
+
1121
+ s0 = peg$currPos;
1122
+ s1 = peg$parseSelector();
1123
+ if (s1 !== peg$FAILED) {
1124
+ peg$savedPos = s0;
1125
+ s1 = peg$f14(s1);
1126
+ }
1127
+ s0 = s1;
1128
+
1129
+ return s0;
1130
+ }
1131
+
1132
+ function peg$parseTheOpt() {
1133
+ let s0, s1, s2, s3;
1134
+
1135
+ s0 = peg$currPos;
1136
+ s1 = input.substr(peg$currPos, 3);
1137
+ if (s1.toLowerCase() === peg$c11) {
1138
+ peg$currPos += (3);
1139
+ } else {
1140
+ s1 = peg$FAILED;
1141
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1142
+ }
1143
+ if (s1 !== peg$FAILED) {
1144
+ s2 = peg$currPos;
1145
+ peg$silentFails++;
1146
+ s3 = input.charAt(peg$currPos);
1147
+ if (peg$r0.test(s3)) {
1148
+ peg$currPos++;
1149
+ } else {
1150
+ s3 = peg$FAILED;
1151
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1152
+ }
1153
+ peg$silentFails--;
1154
+ if (s3 === peg$FAILED) {
1155
+ s2 = undefined;
1156
+ } else {
1157
+ peg$currPos = s2;
1158
+ s2 = peg$FAILED;
1159
+ }
1160
+ if (s2 !== peg$FAILED) {
1161
+ s3 = peg$parse_();
1162
+ s1 = [s1, s2, s3];
1163
+ s0 = s1;
1164
+ } else {
1165
+ peg$currPos = s0;
1166
+ s0 = peg$FAILED;
1167
+ }
1168
+ } else {
1169
+ peg$currPos = s0;
1170
+ s0 = peg$FAILED;
1171
+ }
1172
+
1173
+ return s0;
1174
+ }
1175
+
1176
+ function peg$parseIdent() {
1177
+ let s0, s1, s2, s3, s4;
1178
+
1179
+ s0 = peg$currPos;
1180
+ s1 = peg$currPos;
1181
+ s2 = input.charAt(peg$currPos);
1182
+ if (peg$r2.test(s2)) {
1183
+ peg$currPos++;
1184
+ } else {
1185
+ s2 = peg$FAILED;
1186
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1187
+ }
1188
+ if (s2 !== peg$FAILED) {
1189
+ s3 = [];
1190
+ s4 = input.charAt(peg$currPos);
1191
+ if (peg$r3.test(s4)) {
1192
+ peg$currPos++;
1193
+ } else {
1194
+ s4 = peg$FAILED;
1195
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1196
+ }
1197
+ while (s4 !== peg$FAILED) {
1198
+ s3.push(s4);
1199
+ s4 = input.charAt(peg$currPos);
1200
+ if (peg$r3.test(s4)) {
1201
+ peg$currPos++;
1202
+ } else {
1203
+ s4 = peg$FAILED;
1204
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1205
+ }
1206
+ }
1207
+ s2 = [s2, s3];
1208
+ s1 = s2;
1209
+ } else {
1210
+ peg$currPos = s1;
1211
+ s1 = peg$FAILED;
1212
+ }
1213
+ if (s1 !== peg$FAILED) {
1214
+ s0 = input.substring(s0, peg$currPos);
1215
+ } else {
1216
+ s0 = s1;
1217
+ }
1218
+
1219
+ return s0;
1220
+ }
1221
+
1222
+ function peg$parseStringLit() {
1223
+ let s0, s1, s2, s3, s4, s5, s6;
1224
+
1225
+ s0 = peg$currPos;
1226
+ if (input.charCodeAt(peg$currPos) === 34) {
1227
+ s1 = peg$c12;
1228
+ peg$currPos++;
1229
+ } else {
1230
+ s1 = peg$FAILED;
1231
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1232
+ }
1233
+ if (s1 !== peg$FAILED) {
1234
+ s2 = peg$currPos;
1235
+ s3 = [];
1236
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1237
+ s4 = peg$c13;
1238
+ peg$currPos += 2;
1239
+ } else {
1240
+ s4 = peg$FAILED;
1241
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1242
+ }
1243
+ if (s4 === peg$FAILED) {
1244
+ s4 = peg$currPos;
1245
+ s5 = peg$currPos;
1246
+ peg$silentFails++;
1247
+ if (input.charCodeAt(peg$currPos) === 34) {
1248
+ s6 = peg$c12;
1249
+ peg$currPos++;
1250
+ } else {
1251
+ s6 = peg$FAILED;
1252
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1253
+ }
1254
+ peg$silentFails--;
1255
+ if (s6 === peg$FAILED) {
1256
+ s5 = undefined;
1257
+ } else {
1258
+ peg$currPos = s5;
1259
+ s5 = peg$FAILED;
1260
+ }
1261
+ if (s5 !== peg$FAILED) {
1262
+ if (input.length > peg$currPos) {
1263
+ s6 = input.charAt(peg$currPos);
1264
+ peg$currPos++;
1265
+ } else {
1266
+ s6 = peg$FAILED;
1267
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
1268
+ }
1269
+ if (s6 !== peg$FAILED) {
1270
+ s5 = [s5, s6];
1271
+ s4 = s5;
1272
+ } else {
1273
+ peg$currPos = s4;
1274
+ s4 = peg$FAILED;
1275
+ }
1276
+ } else {
1277
+ peg$currPos = s4;
1278
+ s4 = peg$FAILED;
1279
+ }
1280
+ }
1281
+ while (s4 !== peg$FAILED) {
1282
+ s3.push(s4);
1283
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1284
+ s4 = peg$c13;
1285
+ peg$currPos += 2;
1286
+ } else {
1287
+ s4 = peg$FAILED;
1288
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1289
+ }
1290
+ if (s4 === peg$FAILED) {
1291
+ s4 = peg$currPos;
1292
+ s5 = peg$currPos;
1293
+ peg$silentFails++;
1294
+ if (input.charCodeAt(peg$currPos) === 34) {
1295
+ s6 = peg$c12;
1296
+ peg$currPos++;
1297
+ } else {
1298
+ s6 = peg$FAILED;
1299
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1300
+ }
1301
+ peg$silentFails--;
1302
+ if (s6 === peg$FAILED) {
1303
+ s5 = undefined;
1304
+ } else {
1305
+ peg$currPos = s5;
1306
+ s5 = peg$FAILED;
1307
+ }
1308
+ if (s5 !== peg$FAILED) {
1309
+ if (input.length > peg$currPos) {
1310
+ s6 = input.charAt(peg$currPos);
1311
+ peg$currPos++;
1312
+ } else {
1313
+ s6 = peg$FAILED;
1314
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
1315
+ }
1316
+ if (s6 !== peg$FAILED) {
1317
+ s5 = [s5, s6];
1318
+ s4 = s5;
1319
+ } else {
1320
+ peg$currPos = s4;
1321
+ s4 = peg$FAILED;
1322
+ }
1323
+ } else {
1324
+ peg$currPos = s4;
1325
+ s4 = peg$FAILED;
1326
+ }
1327
+ }
1328
+ }
1329
+ s2 = input.substring(s2, peg$currPos);
1330
+ if (input.charCodeAt(peg$currPos) === 34) {
1331
+ s3 = peg$c12;
1332
+ peg$currPos++;
1333
+ } else {
1334
+ s3 = peg$FAILED;
1335
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1336
+ }
1337
+ if (s3 !== peg$FAILED) {
1338
+ peg$savedPos = s0;
1339
+ s0 = peg$f15(s2);
1340
+ } else {
1341
+ peg$currPos = s0;
1342
+ s0 = peg$FAILED;
1343
+ }
1344
+ } else {
1345
+ peg$currPos = s0;
1346
+ s0 = peg$FAILED;
1347
+ }
1348
+
1349
+ return s0;
1350
+ }
1351
+
1352
+ function peg$parse_() {
1353
+ let s0, s1;
1354
+
1355
+ s0 = [];
1356
+ s1 = input.charAt(peg$currPos);
1357
+ if (peg$r4.test(s1)) {
1358
+ peg$currPos++;
1359
+ } else {
1360
+ s1 = peg$FAILED;
1361
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1362
+ }
1363
+ while (s1 !== peg$FAILED) {
1364
+ s0.push(s1);
1365
+ s1 = input.charAt(peg$currPos);
1366
+ if (peg$r4.test(s1)) {
1367
+ peg$currPos++;
1368
+ } else {
1369
+ s1 = peg$FAILED;
1370
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1371
+ }
1372
+ }
1373
+
1374
+ return s0;
1375
+ }
1376
+
1377
+ peg$result = peg$startRuleFunction();
1378
+
1379
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
1380
+ function peg$throw() {
1381
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1382
+ peg$fail(peg$endExpectation());
1383
+ }
1384
+
1385
+ throw peg$buildStructuredError(
1386
+ peg$maxFailExpected,
1387
+ peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
1388
+ peg$maxFailPos < input.length
1389
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1390
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1391
+ );
1392
+ }
1393
+ if (options.peg$library) {
1394
+ return /** @type {any} */ ({
1395
+ peg$result,
1396
+ peg$currPos,
1397
+ peg$FAILED,
1398
+ peg$maxFailExpected,
1399
+ peg$maxFailPos,
1400
+ peg$success,
1401
+ peg$throw: peg$success ? undefined : peg$throw,
1402
+ });
1403
+ }
1404
+ if (peg$success) {
1405
+ return peg$result;
1406
+ } else {
1407
+ peg$throw();
1408
+ }
1409
+ }
1410
+
1411
+ const peg$allowedStartRules = [
1412
+ "Start"
1413
+ ];
1414
+
1415
+ export {
1416
+ peg$allowedStartRules as StartRules,
1417
+ peg$SyntaxError as SyntaxError,
1418
+ peg$parse as parse
1419
+ };