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