@formique/semantq 1.0.7 → 1.0.9

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,1576 @@
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 = "@form:";
168
+ const peg$c1 = ":";
169
+ const peg$c2 = "\"";
170
+ const peg$c3 = "true";
171
+ const peg$c4 = "false";
172
+ const peg$c5 = "-";
173
+ const peg$c6 = ",";
174
+
175
+ const peg$r0 = /^[^s:\r\n]/;
176
+ const peg$r1 = /^[^"]/;
177
+ const peg$r2 = /^[0-9]/;
178
+ const peg$r3 = /^[a-zA-Z0-9_\-]/;
179
+ const peg$r4 = /^[!*]/;
180
+ const peg$r5 = /^[a-zA-Z]/;
181
+ const peg$r6 = /^[^,\r\n]/;
182
+ const peg$r7 = /^[ \t\n\r]/;
183
+ const peg$r8 = /^[a-zA-Z_]/;
184
+
185
+ const peg$e0 = peg$otherExpectation("form directive must be in this format: @form: form-name");
186
+ const peg$e1 = peg$literalExpectation("@form:", false);
187
+ const peg$e2 = peg$literalExpectation(":", false);
188
+ const peg$e3 = peg$classExpectation(["s", ":", "\r", "\n"], true, false, false);
189
+ const peg$e4 = peg$literalExpectation("\"", false);
190
+ const peg$e5 = peg$classExpectation(["\""], true, false, false);
191
+ const peg$e6 = peg$literalExpectation("true", false);
192
+ const peg$e7 = peg$literalExpectation("false", false);
193
+ const peg$e8 = peg$classExpectation([["0", "9"]], false, false, false);
194
+ const peg$e9 = peg$literalExpectation("-", false);
195
+ const peg$e10 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false, false);
196
+ const peg$e11 = peg$classExpectation(["!", "*"], false, false, false);
197
+ const peg$e12 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
198
+ const peg$e13 = peg$literalExpectation(",", false);
199
+ const peg$e14 = peg$classExpectation([",", "\r", "\n"], true, false, false);
200
+ const peg$e15 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false, false);
201
+ const peg$e16 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false);
202
+
203
+ function peg$f0(name, properties) {
204
+ return createNode('FormDirective', location().start, location().end, {
205
+ name: name,
206
+ properties: properties
207
+ })
208
+ }
209
+ function peg$f1(props) {
210
+ const properties = [];
211
+ for (const prop of props) {
212
+ if (prop[0] && prop[0].type) properties.push(prop[0]);
213
+ }
214
+ return createNode('FormProperties', location().start, location().end, {
215
+ properties: properties
216
+ })
217
+ }
218
+ function peg$f2(key, value) {
219
+ return createNode('FormProperty', location().start, location().end, {
220
+ key: key,
221
+ value: value
222
+ })
223
+ }
224
+ function peg$f3() { // Now allows @ symbols
225
+ return createNode('StringLiteral', location().start, location().end, {
226
+ value: text()
227
+ })
228
+ }
229
+ function peg$f4() {
230
+ return createNode('StringLiteral', location().start, location().end, {
231
+ value: text().slice(1, -1)
232
+ })
233
+ }
234
+ function peg$f5() {
235
+ return createNode('BooleanLiteral', location().start, location().end, {
236
+ value: text() === "true"
237
+ })
238
+ }
239
+ function peg$f6() {
240
+ return createNode('NumberLiteral', location().start, location().end, {
241
+ value: parseInt(text(), 10)
242
+ })
243
+ }
244
+ function peg$f7(fields) {
245
+ return createNode('FormFields', location().start, location().end, {
246
+ fields: fields
247
+ })
248
+ }
249
+ function peg$f8(name, attributes) {
250
+ return createNode('FormField', location().start, location().end, {
251
+ name: name,
252
+ attributes: attributes || []
253
+ })
254
+ }
255
+ function peg$f9(markers, name, markers2) {
256
+ return (markers || '') + name + (markers2 || '')
257
+ }
258
+ function peg$f10(name, namePart, name2, type) {
259
+ return (name || '') + namePart.join('') + ':' + type.join('')
260
+ }
261
+ function peg$f11() { return text() }
262
+ function peg$f12() { return text() }
263
+ function peg$f13(attrs) {
264
+ return attrs.map(attr => attr[1])
265
+ }
266
+ function peg$f14(key, value) {
267
+ return createNode('FieldAttribute', location().start, location().end, {
268
+ key: key,
269
+ value: value
270
+ })
271
+ }
272
+ function peg$f15(flag) {
273
+ return createNode('FieldAttribute', location().start, location().end, {
274
+ key: flag,
275
+ value: true
276
+ })
277
+ }
278
+ function peg$f16() { return text() }
279
+ function peg$f17() { return text() }
280
+ function peg$f18(key, values) {
281
+ return createNode('OptionsAttribute', location().start, location().end, {
282
+ values: values
283
+ })
284
+ }
285
+ function peg$f19(head, tail) {
286
+ const options = [head];
287
+ for (const item of tail) {
288
+ options.push(item[3]); // Get the Option from the tail items
289
+ }
290
+ return options;
291
+ }
292
+ function peg$f20(value) {
293
+ return createNode('Option', location().start, location().end, {
294
+ value: value.join(''),
295
+ quoted: true
296
+ })
297
+ }
298
+ function peg$f21(value) {
299
+ return createNode('Option', location().start, location().end, {
300
+ value: text().trim(),
301
+ quoted: false
302
+ })
303
+ }
304
+ function peg$f22() {
305
+ return createNode('Identifier', location().start, location().end, { value: text() })
306
+ }
307
+ let peg$currPos = options.peg$currPos | 0;
308
+ let peg$savedPos = peg$currPos;
309
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
310
+ let peg$maxFailPos = peg$currPos;
311
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
312
+ let peg$silentFails = options.peg$silentFails | 0;
313
+
314
+ let peg$result;
315
+
316
+ if (options.startRule) {
317
+ if (!(options.startRule in peg$startRuleFunctions)) {
318
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
319
+ }
320
+
321
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
322
+ }
323
+
324
+ function text() {
325
+ return input.substring(peg$savedPos, peg$currPos);
326
+ }
327
+
328
+ function offset() {
329
+ return peg$savedPos;
330
+ }
331
+
332
+ function range() {
333
+ return {
334
+ source: peg$source,
335
+ start: peg$savedPos,
336
+ end: peg$currPos,
337
+ };
338
+ }
339
+
340
+ function location() {
341
+ return peg$computeLocation(peg$savedPos, peg$currPos);
342
+ }
343
+
344
+ function expected(description, location) {
345
+ location = location !== undefined
346
+ ? location
347
+ : peg$computeLocation(peg$savedPos, peg$currPos);
348
+
349
+ throw peg$buildStructuredError(
350
+ [peg$otherExpectation(description)],
351
+ input.substring(peg$savedPos, peg$currPos),
352
+ location
353
+ );
354
+ }
355
+
356
+ function error(message, location) {
357
+ location = location !== undefined
358
+ ? location
359
+ : peg$computeLocation(peg$savedPos, peg$currPos);
360
+
361
+ throw peg$buildSimpleError(message, location);
362
+ }
363
+
364
+ function peg$getUnicode(pos = peg$currPos) {
365
+ const cp = input.codePointAt(pos);
366
+ if (cp === undefined) {
367
+ return "";
368
+ }
369
+ return String.fromCodePoint(cp);
370
+ }
371
+
372
+ function peg$literalExpectation(text, ignoreCase) {
373
+ return { type: "literal", text, ignoreCase };
374
+ }
375
+
376
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
377
+ return { type: "class", parts, inverted, ignoreCase, unicode };
378
+ }
379
+
380
+ function peg$anyExpectation() {
381
+ return { type: "any" };
382
+ }
383
+
384
+ function peg$endExpectation() {
385
+ return { type: "end" };
386
+ }
387
+
388
+ function peg$otherExpectation(description) {
389
+ return { type: "other", description };
390
+ }
391
+
392
+ function peg$computePosDetails(pos) {
393
+ let details = peg$posDetailsCache[pos];
394
+ let p;
395
+
396
+ if (details) {
397
+ return details;
398
+ } else {
399
+ if (pos >= peg$posDetailsCache.length) {
400
+ p = peg$posDetailsCache.length - 1;
401
+ } else {
402
+ p = pos;
403
+ while (!peg$posDetailsCache[--p]) {}
404
+ }
405
+
406
+ details = peg$posDetailsCache[p];
407
+ details = {
408
+ line: details.line,
409
+ column: details.column,
410
+ };
411
+
412
+ while (p < pos) {
413
+ if (input.charCodeAt(p) === 10) {
414
+ details.line++;
415
+ details.column = 1;
416
+ } else {
417
+ details.column++;
418
+ }
419
+
420
+ p++;
421
+ }
422
+
423
+ peg$posDetailsCache[pos] = details;
424
+
425
+ return details;
426
+ }
427
+ }
428
+
429
+ function peg$computeLocation(startPos, endPos, offset) {
430
+ const startPosDetails = peg$computePosDetails(startPos);
431
+ const endPosDetails = peg$computePosDetails(endPos);
432
+
433
+ const res = {
434
+ source: peg$source,
435
+ start: {
436
+ offset: startPos,
437
+ line: startPosDetails.line,
438
+ column: startPosDetails.column,
439
+ },
440
+ end: {
441
+ offset: endPos,
442
+ line: endPosDetails.line,
443
+ column: endPosDetails.column,
444
+ },
445
+ };
446
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
447
+ res.start = peg$source.offset(res.start);
448
+ res.end = peg$source.offset(res.end);
449
+ }
450
+ return res;
451
+ }
452
+
453
+ function peg$fail(expected) {
454
+ if (peg$currPos < peg$maxFailPos) { return; }
455
+
456
+ if (peg$currPos > peg$maxFailPos) {
457
+ peg$maxFailPos = peg$currPos;
458
+ peg$maxFailExpected = [];
459
+ }
460
+
461
+ peg$maxFailExpected.push(expected);
462
+ }
463
+
464
+ function peg$buildSimpleError(message, location) {
465
+ return new peg$SyntaxError(message, null, null, location);
466
+ }
467
+
468
+ function peg$buildStructuredError(expected, found, location) {
469
+ return new peg$SyntaxError(
470
+ peg$SyntaxError.buildMessage(expected, found),
471
+ expected,
472
+ found,
473
+ location
474
+ );
475
+ }
476
+
477
+ function peg$parsestart() {
478
+ let s0;
479
+
480
+ s0 = peg$parseformDefinition();
481
+
482
+ return s0;
483
+ }
484
+
485
+ function peg$parseformDefinition() {
486
+ let s0, s1, s2, s3;
487
+
488
+ s0 = peg$currPos;
489
+ s1 = peg$parseformDirective();
490
+ if (s1 !== peg$FAILED) {
491
+ s2 = peg$parse_();
492
+ s3 = peg$parseformFields();
493
+ if (s3 === peg$FAILED) {
494
+ s3 = null;
495
+ }
496
+ s1 = [s1, s2, s3];
497
+ s0 = s1;
498
+ } else {
499
+ peg$currPos = s0;
500
+ s0 = peg$FAILED;
501
+ }
502
+
503
+ return s0;
504
+ }
505
+
506
+ function peg$parseformDirective() {
507
+ let s0, s1, s2, s3, s4, s5;
508
+
509
+ peg$silentFails++;
510
+ s0 = peg$currPos;
511
+ if (input.substr(peg$currPos, 6) === peg$c0) {
512
+ s1 = peg$c0;
513
+ peg$currPos += 6;
514
+ } else {
515
+ s1 = peg$FAILED;
516
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
517
+ }
518
+ if (s1 !== peg$FAILED) {
519
+ s2 = peg$parse_();
520
+ s3 = peg$parseIdentifier();
521
+ if (s3 !== peg$FAILED) {
522
+ s4 = peg$parse_();
523
+ s5 = peg$parseformProperties();
524
+ peg$savedPos = s0;
525
+ s0 = peg$f0(s3, s5);
526
+ } else {
527
+ peg$currPos = s0;
528
+ s0 = peg$FAILED;
529
+ }
530
+ } else {
531
+ peg$currPos = s0;
532
+ s0 = peg$FAILED;
533
+ }
534
+ peg$silentFails--;
535
+ if (s0 === peg$FAILED) {
536
+ s1 = peg$FAILED;
537
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
538
+ }
539
+
540
+ return s0;
541
+ }
542
+
543
+ function peg$parseformProperties() {
544
+ let s0, s1, s2, s3, s4;
545
+
546
+ s0 = peg$currPos;
547
+ s1 = [];
548
+ s2 = peg$currPos;
549
+ s3 = peg$parseformProperty();
550
+ if (s3 !== peg$FAILED) {
551
+ s4 = peg$parse_();
552
+ s3 = [s3, s4];
553
+ s2 = s3;
554
+ } else {
555
+ peg$currPos = s2;
556
+ s2 = peg$FAILED;
557
+ }
558
+ while (s2 !== peg$FAILED) {
559
+ s1.push(s2);
560
+ s2 = peg$currPos;
561
+ s3 = peg$parseformProperty();
562
+ if (s3 !== peg$FAILED) {
563
+ s4 = peg$parse_();
564
+ s3 = [s3, s4];
565
+ s2 = s3;
566
+ } else {
567
+ peg$currPos = s2;
568
+ s2 = peg$FAILED;
569
+ }
570
+ }
571
+ peg$savedPos = s0;
572
+ s1 = peg$f1(s1);
573
+ s0 = s1;
574
+
575
+ return s0;
576
+ }
577
+
578
+ function peg$parseformProperty() {
579
+ let s0, s1, s2, s3, s4;
580
+
581
+ s0 = peg$currPos;
582
+ s1 = peg$parseIdentifier();
583
+ if (s1 !== peg$FAILED) {
584
+ if (input.charCodeAt(peg$currPos) === 58) {
585
+ s2 = peg$c1;
586
+ peg$currPos++;
587
+ } else {
588
+ s2 = peg$FAILED;
589
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
590
+ }
591
+ if (s2 !== peg$FAILED) {
592
+ s3 = peg$parse_();
593
+ s4 = peg$parsePropertyValue();
594
+ if (s4 !== peg$FAILED) {
595
+ peg$savedPos = s0;
596
+ s0 = peg$f2(s1, s4);
597
+ } else {
598
+ peg$currPos = s0;
599
+ s0 = peg$FAILED;
600
+ }
601
+ } else {
602
+ peg$currPos = s0;
603
+ s0 = peg$FAILED;
604
+ }
605
+ } else {
606
+ peg$currPos = s0;
607
+ s0 = peg$FAILED;
608
+ }
609
+
610
+ return s0;
611
+ }
612
+
613
+ function peg$parsePropertyValue() {
614
+ let s0;
615
+
616
+ s0 = peg$parseUnquotedString();
617
+ if (s0 === peg$FAILED) {
618
+ s0 = peg$parseStringLiteral();
619
+ if (s0 === peg$FAILED) {
620
+ s0 = peg$parseBooleanLiteral();
621
+ if (s0 === peg$FAILED) {
622
+ s0 = peg$parseNumberLiteral();
623
+ if (s0 === peg$FAILED) {
624
+ s0 = peg$parseIdentifier();
625
+ }
626
+ }
627
+ }
628
+ }
629
+
630
+ return s0;
631
+ }
632
+
633
+ function peg$parseUnquotedString() {
634
+ let s0, s1, s2;
635
+
636
+ s0 = peg$currPos;
637
+ s1 = [];
638
+ s2 = input.charAt(peg$currPos);
639
+ if (peg$r0.test(s2)) {
640
+ peg$currPos++;
641
+ } else {
642
+ s2 = peg$FAILED;
643
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
644
+ }
645
+ if (s2 !== peg$FAILED) {
646
+ while (s2 !== peg$FAILED) {
647
+ s1.push(s2);
648
+ s2 = input.charAt(peg$currPos);
649
+ if (peg$r0.test(s2)) {
650
+ peg$currPos++;
651
+ } else {
652
+ s2 = peg$FAILED;
653
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
654
+ }
655
+ }
656
+ } else {
657
+ s1 = peg$FAILED;
658
+ }
659
+ if (s1 !== peg$FAILED) {
660
+ peg$savedPos = s0;
661
+ s1 = peg$f3();
662
+ }
663
+ s0 = s1;
664
+
665
+ return s0;
666
+ }
667
+
668
+ function peg$parseStringLiteral() {
669
+ let s0, s1, s2, s3;
670
+
671
+ s0 = peg$currPos;
672
+ if (input.charCodeAt(peg$currPos) === 34) {
673
+ s1 = peg$c2;
674
+ peg$currPos++;
675
+ } else {
676
+ s1 = peg$FAILED;
677
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
678
+ }
679
+ if (s1 !== peg$FAILED) {
680
+ s2 = [];
681
+ s3 = input.charAt(peg$currPos);
682
+ if (peg$r1.test(s3)) {
683
+ peg$currPos++;
684
+ } else {
685
+ s3 = peg$FAILED;
686
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
687
+ }
688
+ while (s3 !== peg$FAILED) {
689
+ s2.push(s3);
690
+ s3 = input.charAt(peg$currPos);
691
+ if (peg$r1.test(s3)) {
692
+ peg$currPos++;
693
+ } else {
694
+ s3 = peg$FAILED;
695
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
696
+ }
697
+ }
698
+ if (input.charCodeAt(peg$currPos) === 34) {
699
+ s3 = peg$c2;
700
+ peg$currPos++;
701
+ } else {
702
+ s3 = peg$FAILED;
703
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
704
+ }
705
+ if (s3 !== peg$FAILED) {
706
+ peg$savedPos = s0;
707
+ s0 = peg$f4();
708
+ } else {
709
+ peg$currPos = s0;
710
+ s0 = peg$FAILED;
711
+ }
712
+ } else {
713
+ peg$currPos = s0;
714
+ s0 = peg$FAILED;
715
+ }
716
+
717
+ return s0;
718
+ }
719
+
720
+ function peg$parseBooleanLiteral() {
721
+ let s0, s1;
722
+
723
+ s0 = peg$currPos;
724
+ if (input.substr(peg$currPos, 4) === peg$c3) {
725
+ s1 = peg$c3;
726
+ peg$currPos += 4;
727
+ } else {
728
+ s1 = peg$FAILED;
729
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
730
+ }
731
+ if (s1 === peg$FAILED) {
732
+ if (input.substr(peg$currPos, 5) === peg$c4) {
733
+ s1 = peg$c4;
734
+ peg$currPos += 5;
735
+ } else {
736
+ s1 = peg$FAILED;
737
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
738
+ }
739
+ }
740
+ if (s1 !== peg$FAILED) {
741
+ peg$savedPos = s0;
742
+ s1 = peg$f5();
743
+ }
744
+ s0 = s1;
745
+
746
+ return s0;
747
+ }
748
+
749
+ function peg$parseNumberLiteral() {
750
+ let s0, s1, s2;
751
+
752
+ s0 = peg$currPos;
753
+ s1 = [];
754
+ s2 = input.charAt(peg$currPos);
755
+ if (peg$r2.test(s2)) {
756
+ peg$currPos++;
757
+ } else {
758
+ s2 = peg$FAILED;
759
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
760
+ }
761
+ if (s2 !== peg$FAILED) {
762
+ while (s2 !== peg$FAILED) {
763
+ s1.push(s2);
764
+ s2 = input.charAt(peg$currPos);
765
+ if (peg$r2.test(s2)) {
766
+ peg$currPos++;
767
+ } else {
768
+ s2 = peg$FAILED;
769
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
770
+ }
771
+ }
772
+ } else {
773
+ s1 = peg$FAILED;
774
+ }
775
+ if (s1 !== peg$FAILED) {
776
+ peg$savedPos = s0;
777
+ s1 = peg$f6();
778
+ }
779
+ s0 = s1;
780
+
781
+ return s0;
782
+ }
783
+
784
+ function peg$parseformFields() {
785
+ let s0, s1, s2, s3;
786
+
787
+ s0 = peg$currPos;
788
+ s1 = peg$parse_();
789
+ s2 = [];
790
+ s3 = peg$parseFormField();
791
+ if (s3 !== peg$FAILED) {
792
+ while (s3 !== peg$FAILED) {
793
+ s2.push(s3);
794
+ s3 = peg$parseFormField();
795
+ }
796
+ } else {
797
+ s2 = peg$FAILED;
798
+ }
799
+ if (s2 !== peg$FAILED) {
800
+ peg$savedPos = s0;
801
+ s0 = peg$f7(s2);
802
+ } else {
803
+ peg$currPos = s0;
804
+ s0 = peg$FAILED;
805
+ }
806
+
807
+ return s0;
808
+ }
809
+
810
+ function peg$parseFormField() {
811
+ let s0, s1, s2, s3, s4, s5;
812
+
813
+ s0 = peg$currPos;
814
+ if (input.charCodeAt(peg$currPos) === 45) {
815
+ s1 = peg$c5;
816
+ peg$currPos++;
817
+ } else {
818
+ s1 = peg$FAILED;
819
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
820
+ }
821
+ if (s1 !== peg$FAILED) {
822
+ s2 = peg$parse_();
823
+ s3 = peg$parseFieldName();
824
+ if (s3 !== peg$FAILED) {
825
+ s4 = peg$parseFieldAttributes();
826
+ s5 = peg$parse_();
827
+ peg$savedPos = s0;
828
+ s0 = peg$f8(s3, s4);
829
+ } else {
830
+ peg$currPos = s0;
831
+ s0 = peg$FAILED;
832
+ }
833
+ } else {
834
+ peg$currPos = s0;
835
+ s0 = peg$FAILED;
836
+ }
837
+
838
+ return s0;
839
+ }
840
+
841
+ function peg$parseFieldName() {
842
+ let s0, s1, s2, s3, s4, s5, s6, s7;
843
+
844
+ s0 = peg$currPos;
845
+ s1 = peg$parse_();
846
+ s2 = peg$parseFieldMarkers();
847
+ if (s2 === peg$FAILED) {
848
+ s2 = null;
849
+ }
850
+ s3 = peg$parse_();
851
+ s4 = peg$parseFieldNameContent();
852
+ if (s4 !== peg$FAILED) {
853
+ s5 = peg$parse_();
854
+ s6 = peg$parseFieldMarkers();
855
+ if (s6 === peg$FAILED) {
856
+ s6 = null;
857
+ }
858
+ s7 = peg$parse_();
859
+ peg$savedPos = s0;
860
+ s0 = peg$f9(s2, s4, s6);
861
+ } else {
862
+ peg$currPos = s0;
863
+ s0 = peg$FAILED;
864
+ }
865
+
866
+ return s0;
867
+ }
868
+
869
+ function peg$parseFieldNameContent() {
870
+ let s0;
871
+
872
+ s0 = peg$parseNameWithType();
873
+ if (s0 === peg$FAILED) {
874
+ s0 = peg$parseSimpleName();
875
+ }
876
+
877
+ return s0;
878
+ }
879
+
880
+ function peg$parseNameWithType() {
881
+ let s0, s1, s2, s3, s4, s5, s6, s7;
882
+
883
+ s0 = peg$currPos;
884
+ s1 = peg$parseFieldMarkers();
885
+ if (s1 === peg$FAILED) {
886
+ s1 = null;
887
+ }
888
+ s2 = [];
889
+ s3 = input.charAt(peg$currPos);
890
+ if (peg$r3.test(s3)) {
891
+ peg$currPos++;
892
+ } else {
893
+ s3 = peg$FAILED;
894
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
895
+ }
896
+ if (s3 !== peg$FAILED) {
897
+ while (s3 !== peg$FAILED) {
898
+ s2.push(s3);
899
+ s3 = input.charAt(peg$currPos);
900
+ if (peg$r3.test(s3)) {
901
+ peg$currPos++;
902
+ } else {
903
+ s3 = peg$FAILED;
904
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
905
+ }
906
+ }
907
+ } else {
908
+ s2 = peg$FAILED;
909
+ }
910
+ if (s2 !== peg$FAILED) {
911
+ s3 = peg$parseFieldMarkers();
912
+ if (s3 === peg$FAILED) {
913
+ s3 = null;
914
+ }
915
+ if (input.charCodeAt(peg$currPos) === 58) {
916
+ s4 = peg$c1;
917
+ peg$currPos++;
918
+ } else {
919
+ s4 = peg$FAILED;
920
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
921
+ }
922
+ if (s4 !== peg$FAILED) {
923
+ s5 = peg$parse_();
924
+ s6 = [];
925
+ s7 = input.charAt(peg$currPos);
926
+ if (peg$r3.test(s7)) {
927
+ peg$currPos++;
928
+ } else {
929
+ s7 = peg$FAILED;
930
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
931
+ }
932
+ if (s7 !== peg$FAILED) {
933
+ while (s7 !== peg$FAILED) {
934
+ s6.push(s7);
935
+ s7 = input.charAt(peg$currPos);
936
+ if (peg$r3.test(s7)) {
937
+ peg$currPos++;
938
+ } else {
939
+ s7 = peg$FAILED;
940
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
941
+ }
942
+ }
943
+ } else {
944
+ s6 = peg$FAILED;
945
+ }
946
+ if (s6 !== peg$FAILED) {
947
+ peg$savedPos = s0;
948
+ s0 = peg$f10(s1, s2, s3, s6);
949
+ } else {
950
+ peg$currPos = s0;
951
+ s0 = peg$FAILED;
952
+ }
953
+ } else {
954
+ peg$currPos = s0;
955
+ s0 = peg$FAILED;
956
+ }
957
+ } else {
958
+ peg$currPos = s0;
959
+ s0 = peg$FAILED;
960
+ }
961
+
962
+ return s0;
963
+ }
964
+
965
+ function peg$parseSimpleName() {
966
+ let s0, s1, s2;
967
+
968
+ s0 = peg$currPos;
969
+ s1 = [];
970
+ s2 = input.charAt(peg$currPos);
971
+ if (peg$r3.test(s2)) {
972
+ peg$currPos++;
973
+ } else {
974
+ s2 = peg$FAILED;
975
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
976
+ }
977
+ if (s2 !== peg$FAILED) {
978
+ while (s2 !== peg$FAILED) {
979
+ s1.push(s2);
980
+ s2 = input.charAt(peg$currPos);
981
+ if (peg$r3.test(s2)) {
982
+ peg$currPos++;
983
+ } else {
984
+ s2 = peg$FAILED;
985
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
986
+ }
987
+ }
988
+ } else {
989
+ s1 = peg$FAILED;
990
+ }
991
+ if (s1 !== peg$FAILED) {
992
+ peg$savedPos = s0;
993
+ s1 = peg$f11();
994
+ }
995
+ s0 = s1;
996
+
997
+ return s0;
998
+ }
999
+
1000
+ function peg$parseFieldMarkers() {
1001
+ let s0, s1, s2;
1002
+
1003
+ s0 = peg$currPos;
1004
+ s1 = [];
1005
+ s2 = input.charAt(peg$currPos);
1006
+ if (peg$r4.test(s2)) {
1007
+ peg$currPos++;
1008
+ } else {
1009
+ s2 = peg$FAILED;
1010
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1011
+ }
1012
+ if (s2 !== peg$FAILED) {
1013
+ while (s2 !== peg$FAILED) {
1014
+ s1.push(s2);
1015
+ s2 = input.charAt(peg$currPos);
1016
+ if (peg$r4.test(s2)) {
1017
+ peg$currPos++;
1018
+ } else {
1019
+ s2 = peg$FAILED;
1020
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1021
+ }
1022
+ }
1023
+ } else {
1024
+ s1 = peg$FAILED;
1025
+ }
1026
+ if (s1 !== peg$FAILED) {
1027
+ peg$savedPos = s0;
1028
+ s1 = peg$f12();
1029
+ }
1030
+ s0 = s1;
1031
+
1032
+ return s0;
1033
+ }
1034
+
1035
+ function peg$parseFieldAttributes() {
1036
+ let s0, s1, s2, s3, s4;
1037
+
1038
+ s0 = peg$currPos;
1039
+ s1 = [];
1040
+ s2 = peg$currPos;
1041
+ s3 = peg$parse_();
1042
+ s4 = peg$parseFieldAttribute();
1043
+ if (s4 !== peg$FAILED) {
1044
+ s3 = [s3, s4];
1045
+ s2 = s3;
1046
+ } else {
1047
+ peg$currPos = s2;
1048
+ s2 = peg$FAILED;
1049
+ }
1050
+ while (s2 !== peg$FAILED) {
1051
+ s1.push(s2);
1052
+ s2 = peg$currPos;
1053
+ s3 = peg$parse_();
1054
+ s4 = peg$parseFieldAttribute();
1055
+ if (s4 !== peg$FAILED) {
1056
+ s3 = [s3, s4];
1057
+ s2 = s3;
1058
+ } else {
1059
+ peg$currPos = s2;
1060
+ s2 = peg$FAILED;
1061
+ }
1062
+ }
1063
+ peg$savedPos = s0;
1064
+ s1 = peg$f13(s1);
1065
+ s0 = s1;
1066
+
1067
+ return s0;
1068
+ }
1069
+
1070
+ function peg$parseFieldAttribute() {
1071
+ let s0;
1072
+
1073
+ s0 = peg$parseOptionsAttribute();
1074
+ if (s0 === peg$FAILED) {
1075
+ s0 = peg$parseRegularAttribute();
1076
+ }
1077
+
1078
+ return s0;
1079
+ }
1080
+
1081
+ function peg$parseRegularAttribute() {
1082
+ let s0, s1, s2, s3, s4;
1083
+
1084
+ s0 = peg$currPos;
1085
+ s1 = peg$parseAttributeKey();
1086
+ if (s1 !== peg$FAILED) {
1087
+ if (input.charCodeAt(peg$currPos) === 58) {
1088
+ s2 = peg$c1;
1089
+ peg$currPos++;
1090
+ } else {
1091
+ s2 = peg$FAILED;
1092
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1093
+ }
1094
+ if (s2 !== peg$FAILED) {
1095
+ s3 = peg$parse_();
1096
+ s4 = peg$parseAttributeValue();
1097
+ if (s4 !== peg$FAILED) {
1098
+ peg$savedPos = s0;
1099
+ s0 = peg$f14(s1, s4);
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
+ if (s0 === peg$FAILED) {
1113
+ s0 = peg$currPos;
1114
+ s1 = peg$parseAttributeFlag();
1115
+ if (s1 !== peg$FAILED) {
1116
+ peg$savedPos = s0;
1117
+ s1 = peg$f15(s1);
1118
+ }
1119
+ s0 = s1;
1120
+ }
1121
+
1122
+ return s0;
1123
+ }
1124
+
1125
+ function peg$parseAttributeKey() {
1126
+ let s0, s1, s2, s3;
1127
+
1128
+ s0 = peg$currPos;
1129
+ s1 = input.charAt(peg$currPos);
1130
+ if (peg$r5.test(s1)) {
1131
+ peg$currPos++;
1132
+ } else {
1133
+ s1 = peg$FAILED;
1134
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1135
+ }
1136
+ if (s1 !== peg$FAILED) {
1137
+ s2 = [];
1138
+ s3 = input.charAt(peg$currPos);
1139
+ if (peg$r3.test(s3)) {
1140
+ peg$currPos++;
1141
+ } else {
1142
+ s3 = peg$FAILED;
1143
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1144
+ }
1145
+ while (s3 !== peg$FAILED) {
1146
+ s2.push(s3);
1147
+ s3 = input.charAt(peg$currPos);
1148
+ if (peg$r3.test(s3)) {
1149
+ peg$currPos++;
1150
+ } else {
1151
+ s3 = peg$FAILED;
1152
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1153
+ }
1154
+ }
1155
+ peg$savedPos = s0;
1156
+ s0 = peg$f16();
1157
+ } else {
1158
+ peg$currPos = s0;
1159
+ s0 = peg$FAILED;
1160
+ }
1161
+
1162
+ return s0;
1163
+ }
1164
+
1165
+ function peg$parseAttributeValue() {
1166
+ let s0;
1167
+
1168
+ s0 = peg$parseStringLiteral();
1169
+ if (s0 === peg$FAILED) {
1170
+ s0 = peg$parseBooleanLiteral();
1171
+ if (s0 === peg$FAILED) {
1172
+ s0 = peg$parseNumberLiteral();
1173
+ if (s0 === peg$FAILED) {
1174
+ s0 = peg$parseIdentifier();
1175
+ if (s0 === peg$FAILED) {
1176
+ s0 = peg$parseUnquotedString();
1177
+ }
1178
+ }
1179
+ }
1180
+ }
1181
+
1182
+ return s0;
1183
+ }
1184
+
1185
+ function peg$parseAttributeFlag() {
1186
+ let s0, s1, s2, s3;
1187
+
1188
+ s0 = peg$currPos;
1189
+ s1 = input.charAt(peg$currPos);
1190
+ if (peg$r5.test(s1)) {
1191
+ peg$currPos++;
1192
+ } else {
1193
+ s1 = peg$FAILED;
1194
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1195
+ }
1196
+ if (s1 !== peg$FAILED) {
1197
+ s2 = [];
1198
+ s3 = input.charAt(peg$currPos);
1199
+ if (peg$r3.test(s3)) {
1200
+ peg$currPos++;
1201
+ } else {
1202
+ s3 = peg$FAILED;
1203
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1204
+ }
1205
+ while (s3 !== peg$FAILED) {
1206
+ s2.push(s3);
1207
+ s3 = input.charAt(peg$currPos);
1208
+ if (peg$r3.test(s3)) {
1209
+ peg$currPos++;
1210
+ } else {
1211
+ s3 = peg$FAILED;
1212
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1213
+ }
1214
+ }
1215
+ peg$savedPos = s0;
1216
+ s0 = peg$f17();
1217
+ } else {
1218
+ peg$currPos = s0;
1219
+ s0 = peg$FAILED;
1220
+ }
1221
+
1222
+ return s0;
1223
+ }
1224
+
1225
+ function peg$parseOptionsAttribute() {
1226
+ let s0, s1, s2, s3, s4;
1227
+
1228
+ s0 = peg$currPos;
1229
+ s1 = peg$parseIdentifier();
1230
+ if (s1 !== peg$FAILED) {
1231
+ if (input.charCodeAt(peg$currPos) === 58) {
1232
+ s2 = peg$c1;
1233
+ peg$currPos++;
1234
+ } else {
1235
+ s2 = peg$FAILED;
1236
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1237
+ }
1238
+ if (s2 !== peg$FAILED) {
1239
+ s3 = peg$parse_();
1240
+ s4 = peg$parseOptionList();
1241
+ if (s4 !== peg$FAILED) {
1242
+ peg$savedPos = s0;
1243
+ s0 = peg$f18(s1, s4);
1244
+ } else {
1245
+ peg$currPos = s0;
1246
+ s0 = peg$FAILED;
1247
+ }
1248
+ } else {
1249
+ peg$currPos = s0;
1250
+ s0 = peg$FAILED;
1251
+ }
1252
+ } else {
1253
+ peg$currPos = s0;
1254
+ s0 = peg$FAILED;
1255
+ }
1256
+
1257
+ return s0;
1258
+ }
1259
+
1260
+ function peg$parseOptionList() {
1261
+ let s0, s1, s2, s3, s4, s5, s6, s7;
1262
+
1263
+ s0 = peg$currPos;
1264
+ s1 = peg$parseOption();
1265
+ if (s1 !== peg$FAILED) {
1266
+ s2 = [];
1267
+ s3 = peg$currPos;
1268
+ s4 = peg$parse_();
1269
+ if (input.charCodeAt(peg$currPos) === 44) {
1270
+ s5 = peg$c6;
1271
+ peg$currPos++;
1272
+ } else {
1273
+ s5 = peg$FAILED;
1274
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1275
+ }
1276
+ if (s5 !== peg$FAILED) {
1277
+ s6 = peg$parse_();
1278
+ s7 = peg$parseOption();
1279
+ if (s7 !== peg$FAILED) {
1280
+ s4 = [s4, s5, s6, s7];
1281
+ s3 = s4;
1282
+ } else {
1283
+ peg$currPos = s3;
1284
+ s3 = peg$FAILED;
1285
+ }
1286
+ } else {
1287
+ peg$currPos = s3;
1288
+ s3 = peg$FAILED;
1289
+ }
1290
+ while (s3 !== peg$FAILED) {
1291
+ s2.push(s3);
1292
+ s3 = peg$currPos;
1293
+ s4 = peg$parse_();
1294
+ if (input.charCodeAt(peg$currPos) === 44) {
1295
+ s5 = peg$c6;
1296
+ peg$currPos++;
1297
+ } else {
1298
+ s5 = peg$FAILED;
1299
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1300
+ }
1301
+ if (s5 !== peg$FAILED) {
1302
+ s6 = peg$parse_();
1303
+ s7 = peg$parseOption();
1304
+ if (s7 !== peg$FAILED) {
1305
+ s4 = [s4, s5, s6, s7];
1306
+ s3 = s4;
1307
+ } else {
1308
+ peg$currPos = s3;
1309
+ s3 = peg$FAILED;
1310
+ }
1311
+ } else {
1312
+ peg$currPos = s3;
1313
+ s3 = peg$FAILED;
1314
+ }
1315
+ }
1316
+ peg$savedPos = s0;
1317
+ s0 = peg$f19(s1, s2);
1318
+ } else {
1319
+ peg$currPos = s0;
1320
+ s0 = peg$FAILED;
1321
+ }
1322
+
1323
+ return s0;
1324
+ }
1325
+
1326
+ function peg$parseOption() {
1327
+ let s0;
1328
+
1329
+ s0 = peg$parseQuotedOption();
1330
+ if (s0 === peg$FAILED) {
1331
+ s0 = peg$parseUnquotedOption();
1332
+ }
1333
+
1334
+ return s0;
1335
+ }
1336
+
1337
+ function peg$parseQuotedOption() {
1338
+ let s0, s1, s2, s3;
1339
+
1340
+ s0 = peg$currPos;
1341
+ if (input.charCodeAt(peg$currPos) === 34) {
1342
+ s1 = peg$c2;
1343
+ peg$currPos++;
1344
+ } else {
1345
+ s1 = peg$FAILED;
1346
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
1347
+ }
1348
+ if (s1 !== peg$FAILED) {
1349
+ s2 = [];
1350
+ s3 = input.charAt(peg$currPos);
1351
+ if (peg$r1.test(s3)) {
1352
+ peg$currPos++;
1353
+ } else {
1354
+ s3 = peg$FAILED;
1355
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
1356
+ }
1357
+ if (s3 !== peg$FAILED) {
1358
+ while (s3 !== peg$FAILED) {
1359
+ s2.push(s3);
1360
+ s3 = input.charAt(peg$currPos);
1361
+ if (peg$r1.test(s3)) {
1362
+ peg$currPos++;
1363
+ } else {
1364
+ s3 = peg$FAILED;
1365
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
1366
+ }
1367
+ }
1368
+ } else {
1369
+ s2 = peg$FAILED;
1370
+ }
1371
+ if (s2 !== peg$FAILED) {
1372
+ if (input.charCodeAt(peg$currPos) === 34) {
1373
+ s3 = peg$c2;
1374
+ peg$currPos++;
1375
+ } else {
1376
+ s3 = peg$FAILED;
1377
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
1378
+ }
1379
+ if (s3 !== peg$FAILED) {
1380
+ peg$savedPos = s0;
1381
+ s0 = peg$f20(s2);
1382
+ } else {
1383
+ peg$currPos = s0;
1384
+ s0 = peg$FAILED;
1385
+ }
1386
+ } else {
1387
+ peg$currPos = s0;
1388
+ s0 = peg$FAILED;
1389
+ }
1390
+ } else {
1391
+ peg$currPos = s0;
1392
+ s0 = peg$FAILED;
1393
+ }
1394
+
1395
+ return s0;
1396
+ }
1397
+
1398
+ function peg$parseUnquotedOption() {
1399
+ let s0, s1, s2;
1400
+
1401
+ s0 = peg$currPos;
1402
+ s1 = [];
1403
+ s2 = input.charAt(peg$currPos);
1404
+ if (peg$r6.test(s2)) {
1405
+ peg$currPos++;
1406
+ } else {
1407
+ s2 = peg$FAILED;
1408
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1409
+ }
1410
+ if (s2 !== peg$FAILED) {
1411
+ while (s2 !== peg$FAILED) {
1412
+ s1.push(s2);
1413
+ s2 = input.charAt(peg$currPos);
1414
+ if (peg$r6.test(s2)) {
1415
+ peg$currPos++;
1416
+ } else {
1417
+ s2 = peg$FAILED;
1418
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1419
+ }
1420
+ }
1421
+ } else {
1422
+ s1 = peg$FAILED;
1423
+ }
1424
+ if (s1 !== peg$FAILED) {
1425
+ peg$savedPos = s0;
1426
+ s1 = peg$f21(s1);
1427
+ }
1428
+ s0 = s1;
1429
+
1430
+ return s0;
1431
+ }
1432
+
1433
+ function peg$parse_() {
1434
+ let s0, s1;
1435
+
1436
+ s0 = [];
1437
+ s1 = input.charAt(peg$currPos);
1438
+ if (peg$r7.test(s1)) {
1439
+ peg$currPos++;
1440
+ } else {
1441
+ s1 = peg$FAILED;
1442
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1443
+ }
1444
+ while (s1 !== peg$FAILED) {
1445
+ s0.push(s1);
1446
+ s1 = input.charAt(peg$currPos);
1447
+ if (peg$r7.test(s1)) {
1448
+ peg$currPos++;
1449
+ } else {
1450
+ s1 = peg$FAILED;
1451
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1452
+ }
1453
+ }
1454
+
1455
+ return s0;
1456
+ }
1457
+
1458
+ function peg$parseIdentifier() {
1459
+ let s0, s1, s2, s3;
1460
+
1461
+ s0 = peg$currPos;
1462
+ s1 = input.charAt(peg$currPos);
1463
+ if (peg$r8.test(s1)) {
1464
+ peg$currPos++;
1465
+ } else {
1466
+ s1 = peg$FAILED;
1467
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1468
+ }
1469
+ if (s1 !== peg$FAILED) {
1470
+ s2 = [];
1471
+ s3 = input.charAt(peg$currPos);
1472
+ if (peg$r3.test(s3)) {
1473
+ peg$currPos++;
1474
+ } else {
1475
+ s3 = peg$FAILED;
1476
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1477
+ }
1478
+ while (s3 !== peg$FAILED) {
1479
+ s2.push(s3);
1480
+ s3 = input.charAt(peg$currPos);
1481
+ if (peg$r3.test(s3)) {
1482
+ peg$currPos++;
1483
+ } else {
1484
+ s3 = peg$FAILED;
1485
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1486
+ }
1487
+ }
1488
+ peg$savedPos = s0;
1489
+ s0 = peg$f22();
1490
+ } else {
1491
+ peg$currPos = s0;
1492
+ s0 = peg$FAILED;
1493
+ }
1494
+
1495
+ return s0;
1496
+ }
1497
+
1498
+
1499
+ function createNode(type, start, end, additionalProps) {
1500
+ const node = {
1501
+ type: type,
1502
+ start: start,
1503
+ end: end,
1504
+ ...additionalProps
1505
+ };
1506
+ if (additionalProps.expression) {
1507
+ node.expression = createNode('Identifier', additionalProps.expression.start, additionalProps.expression.end, {
1508
+ name: additionalProps.expression.value,
1509
+ loc: {
1510
+ start: {
1511
+ line: 1,
1512
+ column: additionalProps.expression.start + 1
1513
+ },
1514
+ end: {
1515
+ line: 1,
1516
+ column: additionalProps.expression.start + 2
1517
+ }
1518
+ }
1519
+ });
1520
+ }
1521
+ return node;
1522
+ }
1523
+
1524
+ peg$result = peg$startRuleFunction();
1525
+
1526
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
1527
+ function peg$throw() {
1528
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1529
+ peg$fail(peg$endExpectation());
1530
+ }
1531
+
1532
+ throw peg$buildStructuredError(
1533
+ peg$maxFailExpected,
1534
+ peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
1535
+ peg$maxFailPos < input.length
1536
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1537
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1538
+ );
1539
+ }
1540
+ if (options.peg$library) {
1541
+ return /** @type {any} */ ({
1542
+ peg$result,
1543
+ peg$currPos,
1544
+ peg$FAILED,
1545
+ peg$maxFailExpected,
1546
+ peg$maxFailPos,
1547
+ peg$success,
1548
+ peg$throw: peg$success ? undefined : peg$throw,
1549
+ });
1550
+ }
1551
+ if (peg$success) {
1552
+ return peg$result;
1553
+ } else {
1554
+ peg$throw();
1555
+ }
1556
+ }
1557
+
1558
+ const peg$allowedStartRules = [
1559
+ "start"
1560
+ ];
1561
+
1562
+ /*
1563
+ export {
1564
+ peg$allowedStartRules as StartRules,
1565
+ peg$SyntaxError as SyntaxError,
1566
+ peg$parse as parse
1567
+ };
1568
+
1569
+ */
1570
+
1571
+ export default {
1572
+ StartRules: ["start"],
1573
+ SyntaxError: peg$SyntaxError,
1574
+ parse: peg$parse
1575
+ };
1576
+