@formique/semantq 1.0.8 → 1.0.10

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