@leafo/lml 0.2.0 → 0.3.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.
package/dist/grammar.js CHANGED
@@ -149,18 +149,19 @@ function peg$parse(input, options) {
149
149
  const peg$c7 = "t";
150
150
  const peg$c8 = "$";
151
151
  const peg$c9 = "|";
152
- const peg$c10 = ".";
153
- const peg$c11 = "@";
154
- const peg$c12 = "ht";
155
- const peg$c13 = "dt";
156
- const peg$c14 = "tt";
157
- const peg$c15 = "m";
158
- const peg$c16 = "{";
159
- const peg$c17 = "}";
160
- const peg$c18 = "\"";
161
- const peg$c19 = "'";
162
- const peg$c20 = "\\";
163
- const peg$c21 = "n";
152
+ const peg$c10 = "*";
153
+ const peg$c11 = ".";
154
+ const peg$c12 = "@";
155
+ const peg$c13 = "ht";
156
+ const peg$c14 = "dt";
157
+ const peg$c15 = "tt";
158
+ const peg$c16 = "m";
159
+ const peg$c17 = "{";
160
+ const peg$c18 = "}";
161
+ const peg$c19 = "\"";
162
+ const peg$c20 = "'";
163
+ const peg$c21 = "\\";
164
+ const peg$c22 = "n";
164
165
  const peg$r0 = /^[ \t]/;
165
166
  const peg$r1 = /^[a-zA-Z_]/;
166
167
  const peg$r2 = /^[a-zA-Z0-9_]/;
@@ -169,7 +170,7 @@ function peg$parse(input, options) {
169
170
  const peg$r5 = /^[gcfGCF]/;
170
171
  const peg$r6 = /^[a-gA-G]/;
171
172
  const peg$r7 = /^[+=\-]/;
172
- const peg$r8 = /^[rR]/;
173
+ const peg$r8 = /^[rR_]/;
173
174
  const peg$r9 = /^[\t\r\n ]/;
174
175
  const peg$r10 = /^["\\]/;
175
176
  const peg$r11 = /^['\\]/;
@@ -191,23 +192,24 @@ function peg$parse(input, options) {
191
192
  const peg$e15 = peg$literalExpectation("|", false);
192
193
  const peg$e16 = peg$classExpectation([["a", "g"], ["A", "G"]], false, false, false);
193
194
  const peg$e17 = peg$classExpectation(["+", "=", "-"], false, false, false);
194
- const peg$e18 = peg$classExpectation(["r", "R"], false, false, false);
195
- const peg$e19 = peg$literalExpectation(".", false);
196
- const peg$e20 = peg$literalExpectation("@", false);
197
- const peg$e21 = peg$literalExpectation("ht", false);
198
- const peg$e22 = peg$literalExpectation("dt", false);
199
- const peg$e23 = peg$literalExpectation("tt", false);
200
- const peg$e24 = peg$literalExpectation("m", false);
201
- const peg$e25 = peg$literalExpectation("{", false);
202
- const peg$e26 = peg$literalExpectation("}", false);
203
- const peg$e27 = peg$classExpectation(["\t", "\r", "\n", " "], false, false, false);
204
- const peg$e28 = peg$literalExpectation("\"", false);
205
- const peg$e29 = peg$literalExpectation("'", false);
206
- const peg$e30 = peg$classExpectation(["\"", "\\"], false, false, false);
207
- const peg$e31 = peg$anyExpectation();
208
- const peg$e32 = peg$literalExpectation("\\", false);
209
- const peg$e33 = peg$classExpectation(["'", "\\"], false, false, false);
210
- const peg$e34 = peg$literalExpectation("n", false);
195
+ const peg$e18 = peg$classExpectation(["r", "R", "_"], false, false, false);
196
+ const peg$e19 = peg$literalExpectation("*", false);
197
+ const peg$e20 = peg$literalExpectation(".", false);
198
+ const peg$e21 = peg$literalExpectation("@", false);
199
+ const peg$e22 = peg$literalExpectation("ht", false);
200
+ const peg$e23 = peg$literalExpectation("dt", false);
201
+ const peg$e24 = peg$literalExpectation("tt", false);
202
+ const peg$e25 = peg$literalExpectation("m", false);
203
+ const peg$e26 = peg$literalExpectation("{", false);
204
+ const peg$e27 = peg$literalExpectation("}", false);
205
+ const peg$e28 = peg$classExpectation(["\t", "\r", "\n", " "], false, false, false);
206
+ const peg$e29 = peg$literalExpectation("\"", false);
207
+ const peg$e30 = peg$literalExpectation("'", false);
208
+ const peg$e31 = peg$classExpectation(["\"", "\\"], false, false, false);
209
+ const peg$e32 = peg$anyExpectation();
210
+ const peg$e33 = peg$literalExpectation("\\", false);
211
+ const peg$e34 = peg$classExpectation(["'", "\\"], false, false, false);
212
+ const peg$e35 = peg$literalExpectation("n", false);
211
213
  function peg$f0(frontmatter, commands) {
212
214
  return frontmatter.concat(commands);
213
215
  }
@@ -221,7 +223,8 @@ function peg$parse(input, options) {
221
223
  return [];
222
224
  }
223
225
  function peg$f4(mod) {
224
- return ["keySignature", +mod];
226
+ let loc = location();
227
+ return ["keySignature", +mod, [loc.start.offset, loc.end.offset]];
225
228
  }
226
229
  function peg$f5(upper, lower) {
227
230
  return ["timeSignature", +upper, +lower];
@@ -264,48 +267,54 @@ function peg$parse(input, options) {
264
267
  }
265
268
  function peg$f12(d) { return +d; }
266
269
  function peg$f13(d) { return 1 / +d; }
267
- function peg$f14(duration, s) { return +s; }
268
- function peg$f15(duration, start) { return duration !== null || start !== null; }
269
- function peg$f16(duration, start) {
270
+ function peg$f14(duration, dots, s) { return +s; }
271
+ function peg$f15(duration, dots, start) { return duration !== null || dots || start !== null; }
272
+ function peg$f16(duration, dots, start) {
270
273
  let timing = {};
271
274
  if (duration !== null)
272
275
  timing.duration = duration;
276
+ if (dots)
277
+ timing.dots = dots.length;
273
278
  if (start !== null)
274
279
  timing.start = start;
275
280
  return timing;
276
281
  }
277
- function peg$f17(duration, s) { return +s; }
278
- function peg$f18(duration, start) {
279
- let timing = { duration: +duration };
282
+ function peg$f17(d) { return +d; }
283
+ function peg$f18(d) { return 1 / +d; }
284
+ function peg$f19(duration, dots, s) { return +s; }
285
+ function peg$f20(duration, dots, start) { return duration !== null || dots || start !== null; }
286
+ function peg$f21(duration, dots, start) {
287
+ let timing = {};
288
+ if (duration !== null)
289
+ timing.duration = duration;
290
+ if (dots)
291
+ timing.dots = dots.length;
280
292
  if (start !== null)
281
293
  timing.start = start;
282
294
  return timing;
283
295
  }
284
- function peg$f19(start) {
285
- return { start: +start };
286
- }
287
- function peg$f20(count) { return count ? ["halfTime", +count] : ["halfTime"]; }
288
- function peg$f21(count) { return count ? ["doubleTime", +count] : ["doubleTime"]; }
289
- function peg$f22(count) { return count ? ["tripleTime", +count] : ["tripleTime"]; }
290
- function peg$f23(measure) { return ["measure", +measure]; }
291
- function peg$f24() { return ["measure"]; }
292
- function peg$f25(commands) {
296
+ function peg$f22(count) { return count ? ["halfTime", +count] : ["halfTime"]; }
297
+ function peg$f23(count) { return count ? ["doubleTime", +count] : ["doubleTime"]; }
298
+ function peg$f24(count) { return count ? ["tripleTime", +count] : ["tripleTime"]; }
299
+ function peg$f25(measure) { return ["measure", +measure]; }
300
+ function peg$f26() { return ["measure"]; }
301
+ function peg$f27(commands) {
293
302
  return ["block", commands];
294
303
  }
295
- function peg$f26(chars) {
304
+ function peg$f28(chars) {
296
305
  return ["string", chars.join("")];
297
306
  }
298
- function peg$f27(chars) {
307
+ function peg$f29(chars) {
299
308
  return ["string", chars.join("")];
300
309
  }
301
- function peg$f28(char) { return char; }
302
- function peg$f29(escape) { return escape; }
303
310
  function peg$f30(char) { return char; }
304
311
  function peg$f31(escape) { return escape; }
305
- function peg$f32() { return '"'; }
306
- function peg$f33() { return "'"; }
307
- function peg$f34() { return "\\"; }
308
- function peg$f35() { return "\n"; }
312
+ function peg$f32(char) { return char; }
313
+ function peg$f33(escape) { return escape; }
314
+ function peg$f34() { return '"'; }
315
+ function peg$f35() { return "'"; }
316
+ function peg$f36() { return "\\"; }
317
+ function peg$f37() { return "\n"; }
309
318
  let peg$currPos = options.peg$currPos | 0;
310
319
  let peg$savedPos = peg$currPos;
311
320
  const peg$posDetailsCache = [{ line: 1, column: 1 }];
@@ -1232,10 +1241,10 @@ function peg$parse(input, options) {
1232
1241
  return s0;
1233
1242
  }
1234
1243
  function peg$parsenoteTiming() {
1235
- let s0, s1, s2, s3, s4, s5, s6;
1244
+ let s0, s1, s2, s3, s4, s5, s6, s7;
1236
1245
  s0 = peg$currPos;
1237
1246
  s1 = peg$currPos;
1238
- if (input.charCodeAt(peg$currPos) === 46) {
1247
+ if (input.charCodeAt(peg$currPos) === 42) {
1239
1248
  s2 = peg$c10;
1240
1249
  peg$currPos++;
1241
1250
  }
@@ -1378,38 +1387,77 @@ function peg$parse(input, options) {
1378
1387
  s1 = null;
1379
1388
  }
1380
1389
  s2 = peg$currPos;
1381
- if (input.charCodeAt(peg$currPos) === 64) {
1382
- s3 = peg$c11;
1390
+ s3 = [];
1391
+ if (input.charCodeAt(peg$currPos) === 46) {
1392
+ s4 = peg$c11;
1383
1393
  peg$currPos++;
1384
1394
  }
1385
1395
  else {
1386
- s3 = peg$FAILED;
1396
+ s4 = peg$FAILED;
1387
1397
  if (peg$silentFails === 0) {
1388
1398
  peg$fail(peg$e20);
1389
1399
  }
1390
1400
  }
1401
+ if (s4 !== peg$FAILED) {
1402
+ while (s4 !== peg$FAILED) {
1403
+ s3.push(s4);
1404
+ if (input.charCodeAt(peg$currPos) === 46) {
1405
+ s4 = peg$c11;
1406
+ peg$currPos++;
1407
+ }
1408
+ else {
1409
+ s4 = peg$FAILED;
1410
+ if (peg$silentFails === 0) {
1411
+ peg$fail(peg$e20);
1412
+ }
1413
+ }
1414
+ }
1415
+ }
1416
+ else {
1417
+ s3 = peg$FAILED;
1418
+ }
1391
1419
  if (s3 !== peg$FAILED) {
1392
- s4 = peg$currPos;
1393
- s5 = [];
1394
- s6 = input.charAt(peg$currPos);
1395
- if (peg$r4.test(s6)) {
1420
+ s2 = input.substring(s2, peg$currPos);
1421
+ }
1422
+ else {
1423
+ s2 = s3;
1424
+ }
1425
+ if (s2 === peg$FAILED) {
1426
+ s2 = null;
1427
+ }
1428
+ s3 = peg$currPos;
1429
+ if (input.charCodeAt(peg$currPos) === 64) {
1430
+ s4 = peg$c12;
1431
+ peg$currPos++;
1432
+ }
1433
+ else {
1434
+ s4 = peg$FAILED;
1435
+ if (peg$silentFails === 0) {
1436
+ peg$fail(peg$e21);
1437
+ }
1438
+ }
1439
+ if (s4 !== peg$FAILED) {
1440
+ s5 = peg$currPos;
1441
+ s6 = [];
1442
+ s7 = input.charAt(peg$currPos);
1443
+ if (peg$r4.test(s7)) {
1396
1444
  peg$currPos++;
1397
1445
  }
1398
1446
  else {
1399
- s6 = peg$FAILED;
1447
+ s7 = peg$FAILED;
1400
1448
  if (peg$silentFails === 0) {
1401
1449
  peg$fail(peg$e9);
1402
1450
  }
1403
1451
  }
1404
- if (s6 !== peg$FAILED) {
1405
- while (s6 !== peg$FAILED) {
1406
- s5.push(s6);
1407
- s6 = input.charAt(peg$currPos);
1408
- if (peg$r4.test(s6)) {
1452
+ if (s7 !== peg$FAILED) {
1453
+ while (s7 !== peg$FAILED) {
1454
+ s6.push(s7);
1455
+ s7 = input.charAt(peg$currPos);
1456
+ if (peg$r4.test(s7)) {
1409
1457
  peg$currPos++;
1410
1458
  }
1411
1459
  else {
1412
- s6 = peg$FAILED;
1460
+ s7 = peg$FAILED;
1413
1461
  if (peg$silentFails === 0) {
1414
1462
  peg$fail(peg$e9);
1415
1463
  }
@@ -1417,41 +1465,41 @@ function peg$parse(input, options) {
1417
1465
  }
1418
1466
  }
1419
1467
  else {
1420
- s5 = peg$FAILED;
1468
+ s6 = peg$FAILED;
1421
1469
  }
1422
- if (s5 !== peg$FAILED) {
1423
- s4 = input.substring(s4, peg$currPos);
1470
+ if (s6 !== peg$FAILED) {
1471
+ s5 = input.substring(s5, peg$currPos);
1424
1472
  }
1425
1473
  else {
1426
- s4 = s5;
1474
+ s5 = s6;
1427
1475
  }
1428
- if (s4 !== peg$FAILED) {
1429
- peg$savedPos = s2;
1430
- s2 = peg$f14(s1, s4);
1476
+ if (s5 !== peg$FAILED) {
1477
+ peg$savedPos = s3;
1478
+ s3 = peg$f14(s1, s2, s5);
1431
1479
  }
1432
1480
  else {
1433
- peg$currPos = s2;
1434
- s2 = peg$FAILED;
1481
+ peg$currPos = s3;
1482
+ s3 = peg$FAILED;
1435
1483
  }
1436
1484
  }
1437
1485
  else {
1438
- peg$currPos = s2;
1439
- s2 = peg$FAILED;
1486
+ peg$currPos = s3;
1487
+ s3 = peg$FAILED;
1440
1488
  }
1441
- if (s2 === peg$FAILED) {
1442
- s2 = null;
1489
+ if (s3 === peg$FAILED) {
1490
+ s3 = null;
1443
1491
  }
1444
1492
  peg$savedPos = peg$currPos;
1445
- s3 = peg$f15(s1, s2);
1446
- if (s3) {
1447
- s3 = undefined;
1493
+ s4 = peg$f15(s1, s2, s3);
1494
+ if (s4) {
1495
+ s4 = undefined;
1448
1496
  }
1449
1497
  else {
1450
- s3 = peg$FAILED;
1498
+ s4 = peg$FAILED;
1451
1499
  }
1452
- if (s3 !== peg$FAILED) {
1500
+ if (s4 !== peg$FAILED) {
1453
1501
  peg$savedPos = s0;
1454
- s0 = peg$f16(s1, s2);
1502
+ s0 = peg$f16(s1, s2, s3);
1455
1503
  }
1456
1504
  else {
1457
1505
  peg$currPos = s0;
@@ -1460,65 +1508,88 @@ function peg$parse(input, options) {
1460
1508
  return s0;
1461
1509
  }
1462
1510
  function peg$parserestTiming() {
1463
- let s0, s1, s2, s3, s4, s5, s6;
1511
+ let s0, s1, s2, s3, s4, s5, s6, s7;
1464
1512
  s0 = peg$currPos;
1465
1513
  s1 = peg$currPos;
1466
- s2 = peg$currPos;
1467
- s3 = [];
1468
- s4 = input.charAt(peg$currPos);
1469
- if (peg$r4.test(s4)) {
1514
+ if (input.charCodeAt(peg$currPos) === 42) {
1515
+ s2 = peg$c10;
1470
1516
  peg$currPos++;
1471
1517
  }
1472
1518
  else {
1473
- s4 = peg$FAILED;
1519
+ s2 = peg$FAILED;
1520
+ if (peg$silentFails === 0) {
1521
+ peg$fail(peg$e19);
1522
+ }
1523
+ }
1524
+ if (s2 === peg$FAILED) {
1525
+ s2 = null;
1526
+ }
1527
+ s3 = peg$currPos;
1528
+ s4 = peg$currPos;
1529
+ s5 = [];
1530
+ s6 = input.charAt(peg$currPos);
1531
+ if (peg$r4.test(s6)) {
1532
+ peg$currPos++;
1533
+ }
1534
+ else {
1535
+ s6 = peg$FAILED;
1474
1536
  if (peg$silentFails === 0) {
1475
1537
  peg$fail(peg$e9);
1476
1538
  }
1477
1539
  }
1478
- while (s4 !== peg$FAILED) {
1479
- s3.push(s4);
1480
- if (s3.length >= 3) {
1481
- s4 = peg$FAILED;
1540
+ while (s6 !== peg$FAILED) {
1541
+ s5.push(s6);
1542
+ if (s5.length >= 3) {
1543
+ s6 = peg$FAILED;
1482
1544
  }
1483
1545
  else {
1484
- s4 = input.charAt(peg$currPos);
1485
- if (peg$r4.test(s4)) {
1546
+ s6 = input.charAt(peg$currPos);
1547
+ if (peg$r4.test(s6)) {
1486
1548
  peg$currPos++;
1487
1549
  }
1488
1550
  else {
1489
- s4 = peg$FAILED;
1551
+ s6 = peg$FAILED;
1490
1552
  if (peg$silentFails === 0) {
1491
1553
  peg$fail(peg$e9);
1492
1554
  }
1493
1555
  }
1494
1556
  }
1495
1557
  }
1496
- if (s3.length < 1) {
1497
- peg$currPos = s2;
1498
- s2 = peg$FAILED;
1558
+ if (s5.length < 1) {
1559
+ peg$currPos = s4;
1560
+ s4 = peg$FAILED;
1499
1561
  }
1500
1562
  else {
1501
- s2 = s3;
1563
+ s4 = s5;
1502
1564
  }
1503
- if (s2 !== peg$FAILED) {
1504
- s1 = input.substring(s1, peg$currPos);
1565
+ if (s4 !== peg$FAILED) {
1566
+ s3 = input.substring(s3, peg$currPos);
1505
1567
  }
1506
1568
  else {
1507
- s1 = s2;
1569
+ s3 = s4;
1508
1570
  }
1509
- if (s1 !== peg$FAILED) {
1510
- s2 = peg$currPos;
1511
- if (input.charCodeAt(peg$currPos) === 64) {
1512
- s3 = peg$c11;
1571
+ if (s3 !== peg$FAILED) {
1572
+ peg$savedPos = s1;
1573
+ s1 = peg$f17(s3);
1574
+ }
1575
+ else {
1576
+ peg$currPos = s1;
1577
+ s1 = peg$FAILED;
1578
+ }
1579
+ if (s1 === peg$FAILED) {
1580
+ s1 = peg$currPos;
1581
+ if (input.charCodeAt(peg$currPos) === 47) {
1582
+ s2 = peg$c6;
1513
1583
  peg$currPos++;
1514
1584
  }
1515
1585
  else {
1516
- s3 = peg$FAILED;
1586
+ s2 = peg$FAILED;
1517
1587
  if (peg$silentFails === 0) {
1518
- peg$fail(peg$e20);
1588
+ peg$fail(peg$e11);
1519
1589
  }
1520
1590
  }
1521
- if (s3 !== peg$FAILED) {
1591
+ if (s2 !== peg$FAILED) {
1592
+ s3 = peg$currPos;
1522
1593
  s4 = peg$currPos;
1523
1594
  s5 = [];
1524
1595
  s6 = input.charAt(peg$currPos);
@@ -1531,9 +1602,12 @@ function peg$parse(input, options) {
1531
1602
  peg$fail(peg$e9);
1532
1603
  }
1533
1604
  }
1534
- if (s6 !== peg$FAILED) {
1535
- while (s6 !== peg$FAILED) {
1536
- s5.push(s6);
1605
+ while (s6 !== peg$FAILED) {
1606
+ s5.push(s6);
1607
+ if (s5.length >= 3) {
1608
+ s6 = peg$FAILED;
1609
+ }
1610
+ else {
1537
1611
  s6 = input.charAt(peg$currPos);
1538
1612
  if (peg$r4.test(s6)) {
1539
1613
  peg$currPos++;
@@ -1546,114 +1620,168 @@ function peg$parse(input, options) {
1546
1620
  }
1547
1621
  }
1548
1622
  }
1549
- else {
1550
- s5 = peg$FAILED;
1551
- }
1552
- if (s5 !== peg$FAILED) {
1553
- s4 = input.substring(s4, peg$currPos);
1623
+ if (s5.length < 1) {
1624
+ peg$currPos = s4;
1625
+ s4 = peg$FAILED;
1554
1626
  }
1555
1627
  else {
1556
1628
  s4 = s5;
1557
1629
  }
1558
1630
  if (s4 !== peg$FAILED) {
1559
- peg$savedPos = s2;
1560
- s2 = peg$f17(s1, s4);
1631
+ s3 = input.substring(s3, peg$currPos);
1561
1632
  }
1562
1633
  else {
1563
- peg$currPos = s2;
1564
- s2 = peg$FAILED;
1634
+ s3 = s4;
1635
+ }
1636
+ if (s3 !== peg$FAILED) {
1637
+ peg$savedPos = s1;
1638
+ s1 = peg$f18(s3);
1639
+ }
1640
+ else {
1641
+ peg$currPos = s1;
1642
+ s1 = peg$FAILED;
1565
1643
  }
1566
1644
  }
1567
1645
  else {
1568
- peg$currPos = s2;
1569
- s2 = peg$FAILED;
1646
+ peg$currPos = s1;
1647
+ s1 = peg$FAILED;
1570
1648
  }
1571
- if (s2 === peg$FAILED) {
1572
- s2 = null;
1649
+ }
1650
+ if (s1 === peg$FAILED) {
1651
+ s1 = null;
1652
+ }
1653
+ s2 = peg$currPos;
1654
+ s3 = [];
1655
+ if (input.charCodeAt(peg$currPos) === 46) {
1656
+ s4 = peg$c11;
1657
+ peg$currPos++;
1658
+ }
1659
+ else {
1660
+ s4 = peg$FAILED;
1661
+ if (peg$silentFails === 0) {
1662
+ peg$fail(peg$e20);
1663
+ }
1664
+ }
1665
+ if (s4 !== peg$FAILED) {
1666
+ while (s4 !== peg$FAILED) {
1667
+ s3.push(s4);
1668
+ if (input.charCodeAt(peg$currPos) === 46) {
1669
+ s4 = peg$c11;
1670
+ peg$currPos++;
1671
+ }
1672
+ else {
1673
+ s4 = peg$FAILED;
1674
+ if (peg$silentFails === 0) {
1675
+ peg$fail(peg$e20);
1676
+ }
1677
+ }
1573
1678
  }
1574
- peg$savedPos = s0;
1575
- s0 = peg$f18(s1, s2);
1576
1679
  }
1577
1680
  else {
1578
- peg$currPos = s0;
1579
- s0 = peg$FAILED;
1681
+ s3 = peg$FAILED;
1580
1682
  }
1581
- if (s0 === peg$FAILED) {
1582
- s0 = peg$currPos;
1583
- if (input.charCodeAt(peg$currPos) === 64) {
1584
- s1 = peg$c11;
1683
+ if (s3 !== peg$FAILED) {
1684
+ s2 = input.substring(s2, peg$currPos);
1685
+ }
1686
+ else {
1687
+ s2 = s3;
1688
+ }
1689
+ if (s2 === peg$FAILED) {
1690
+ s2 = null;
1691
+ }
1692
+ s3 = peg$currPos;
1693
+ if (input.charCodeAt(peg$currPos) === 64) {
1694
+ s4 = peg$c12;
1695
+ peg$currPos++;
1696
+ }
1697
+ else {
1698
+ s4 = peg$FAILED;
1699
+ if (peg$silentFails === 0) {
1700
+ peg$fail(peg$e21);
1701
+ }
1702
+ }
1703
+ if (s4 !== peg$FAILED) {
1704
+ s5 = peg$currPos;
1705
+ s6 = [];
1706
+ s7 = input.charAt(peg$currPos);
1707
+ if (peg$r4.test(s7)) {
1585
1708
  peg$currPos++;
1586
1709
  }
1587
1710
  else {
1588
- s1 = peg$FAILED;
1711
+ s7 = peg$FAILED;
1589
1712
  if (peg$silentFails === 0) {
1590
- peg$fail(peg$e20);
1713
+ peg$fail(peg$e9);
1591
1714
  }
1592
1715
  }
1593
- if (s1 !== peg$FAILED) {
1594
- s2 = peg$currPos;
1595
- s3 = [];
1596
- s4 = input.charAt(peg$currPos);
1597
- if (peg$r4.test(s4)) {
1598
- peg$currPos++;
1599
- }
1600
- else {
1601
- s4 = peg$FAILED;
1602
- if (peg$silentFails === 0) {
1603
- peg$fail(peg$e9);
1716
+ if (s7 !== peg$FAILED) {
1717
+ while (s7 !== peg$FAILED) {
1718
+ s6.push(s7);
1719
+ s7 = input.charAt(peg$currPos);
1720
+ if (peg$r4.test(s7)) {
1721
+ peg$currPos++;
1604
1722
  }
1605
- }
1606
- if (s4 !== peg$FAILED) {
1607
- while (s4 !== peg$FAILED) {
1608
- s3.push(s4);
1609
- s4 = input.charAt(peg$currPos);
1610
- if (peg$r4.test(s4)) {
1611
- peg$currPos++;
1612
- }
1613
- else {
1614
- s4 = peg$FAILED;
1615
- if (peg$silentFails === 0) {
1616
- peg$fail(peg$e9);
1617
- }
1723
+ else {
1724
+ s7 = peg$FAILED;
1725
+ if (peg$silentFails === 0) {
1726
+ peg$fail(peg$e9);
1618
1727
  }
1619
1728
  }
1620
1729
  }
1621
- else {
1622
- s3 = peg$FAILED;
1623
- }
1624
- if (s3 !== peg$FAILED) {
1625
- s2 = input.substring(s2, peg$currPos);
1626
- }
1627
- else {
1628
- s2 = s3;
1629
- }
1630
- if (s2 !== peg$FAILED) {
1631
- peg$savedPos = s0;
1632
- s0 = peg$f19(s2);
1633
- }
1634
- else {
1635
- peg$currPos = s0;
1636
- s0 = peg$FAILED;
1637
- }
1638
1730
  }
1639
1731
  else {
1640
- peg$currPos = s0;
1641
- s0 = peg$FAILED;
1732
+ s6 = peg$FAILED;
1733
+ }
1734
+ if (s6 !== peg$FAILED) {
1735
+ s5 = input.substring(s5, peg$currPos);
1736
+ }
1737
+ else {
1738
+ s5 = s6;
1739
+ }
1740
+ if (s5 !== peg$FAILED) {
1741
+ peg$savedPos = s3;
1742
+ s3 = peg$f19(s1, s2, s5);
1642
1743
  }
1744
+ else {
1745
+ peg$currPos = s3;
1746
+ s3 = peg$FAILED;
1747
+ }
1748
+ }
1749
+ else {
1750
+ peg$currPos = s3;
1751
+ s3 = peg$FAILED;
1752
+ }
1753
+ if (s3 === peg$FAILED) {
1754
+ s3 = null;
1755
+ }
1756
+ peg$savedPos = peg$currPos;
1757
+ s4 = peg$f20(s1, s2, s3);
1758
+ if (s4) {
1759
+ s4 = undefined;
1760
+ }
1761
+ else {
1762
+ s4 = peg$FAILED;
1763
+ }
1764
+ if (s4 !== peg$FAILED) {
1765
+ peg$savedPos = s0;
1766
+ s0 = peg$f21(s1, s2, s3);
1767
+ }
1768
+ else {
1769
+ peg$currPos = s0;
1770
+ s0 = peg$FAILED;
1643
1771
  }
1644
1772
  return s0;
1645
1773
  }
1646
1774
  function peg$parsehalfTime() {
1647
1775
  let s0, s1, s2, s3, s4;
1648
1776
  s0 = peg$currPos;
1649
- if (input.substr(peg$currPos, 2) === peg$c12) {
1650
- s1 = peg$c12;
1777
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1778
+ s1 = peg$c13;
1651
1779
  peg$currPos += 2;
1652
1780
  }
1653
1781
  else {
1654
1782
  s1 = peg$FAILED;
1655
1783
  if (peg$silentFails === 0) {
1656
- peg$fail(peg$e21);
1784
+ peg$fail(peg$e22);
1657
1785
  }
1658
1786
  }
1659
1787
  if (s1 !== peg$FAILED) {
@@ -1684,7 +1812,7 @@ function peg$parse(input, options) {
1684
1812
  }
1685
1813
  s2 = input.substring(s2, peg$currPos);
1686
1814
  peg$savedPos = s0;
1687
- s0 = peg$f20(s2);
1815
+ s0 = peg$f22(s2);
1688
1816
  }
1689
1817
  else {
1690
1818
  peg$currPos = s0;
@@ -1695,14 +1823,14 @@ function peg$parse(input, options) {
1695
1823
  function peg$parsedoubleTime() {
1696
1824
  let s0, s1, s2, s3, s4;
1697
1825
  s0 = peg$currPos;
1698
- if (input.substr(peg$currPos, 2) === peg$c13) {
1699
- s1 = peg$c13;
1826
+ if (input.substr(peg$currPos, 2) === peg$c14) {
1827
+ s1 = peg$c14;
1700
1828
  peg$currPos += 2;
1701
1829
  }
1702
1830
  else {
1703
1831
  s1 = peg$FAILED;
1704
1832
  if (peg$silentFails === 0) {
1705
- peg$fail(peg$e22);
1833
+ peg$fail(peg$e23);
1706
1834
  }
1707
1835
  }
1708
1836
  if (s1 !== peg$FAILED) {
@@ -1733,7 +1861,7 @@ function peg$parse(input, options) {
1733
1861
  }
1734
1862
  s2 = input.substring(s2, peg$currPos);
1735
1863
  peg$savedPos = s0;
1736
- s0 = peg$f21(s2);
1864
+ s0 = peg$f23(s2);
1737
1865
  }
1738
1866
  else {
1739
1867
  peg$currPos = s0;
@@ -1744,14 +1872,14 @@ function peg$parse(input, options) {
1744
1872
  function peg$parsetripleTime() {
1745
1873
  let s0, s1, s2, s3, s4;
1746
1874
  s0 = peg$currPos;
1747
- if (input.substr(peg$currPos, 2) === peg$c14) {
1748
- s1 = peg$c14;
1875
+ if (input.substr(peg$currPos, 2) === peg$c15) {
1876
+ s1 = peg$c15;
1749
1877
  peg$currPos += 2;
1750
1878
  }
1751
1879
  else {
1752
1880
  s1 = peg$FAILED;
1753
1881
  if (peg$silentFails === 0) {
1754
- peg$fail(peg$e23);
1882
+ peg$fail(peg$e24);
1755
1883
  }
1756
1884
  }
1757
1885
  if (s1 !== peg$FAILED) {
@@ -1782,7 +1910,7 @@ function peg$parse(input, options) {
1782
1910
  }
1783
1911
  s2 = input.substring(s2, peg$currPos);
1784
1912
  peg$savedPos = s0;
1785
- s0 = peg$f22(s2);
1913
+ s0 = peg$f24(s2);
1786
1914
  }
1787
1915
  else {
1788
1916
  peg$currPos = s0;
@@ -1794,13 +1922,13 @@ function peg$parse(input, options) {
1794
1922
  let s0, s1, s2, s3, s4;
1795
1923
  s0 = peg$currPos;
1796
1924
  if (input.charCodeAt(peg$currPos) === 109) {
1797
- s1 = peg$c15;
1925
+ s1 = peg$c16;
1798
1926
  peg$currPos++;
1799
1927
  }
1800
1928
  else {
1801
1929
  s1 = peg$FAILED;
1802
1930
  if (peg$silentFails === 0) {
1803
- peg$fail(peg$e24);
1931
+ peg$fail(peg$e25);
1804
1932
  }
1805
1933
  }
1806
1934
  if (s1 !== peg$FAILED) {
@@ -1842,7 +1970,7 @@ function peg$parse(input, options) {
1842
1970
  }
1843
1971
  if (s2 !== peg$FAILED) {
1844
1972
  peg$savedPos = s0;
1845
- s0 = peg$f23(s2);
1973
+ s0 = peg$f25(s2);
1846
1974
  }
1847
1975
  else {
1848
1976
  peg$currPos = s0;
@@ -1856,18 +1984,18 @@ function peg$parse(input, options) {
1856
1984
  if (s0 === peg$FAILED) {
1857
1985
  s0 = peg$currPos;
1858
1986
  if (input.charCodeAt(peg$currPos) === 109) {
1859
- s1 = peg$c15;
1987
+ s1 = peg$c16;
1860
1988
  peg$currPos++;
1861
1989
  }
1862
1990
  else {
1863
1991
  s1 = peg$FAILED;
1864
1992
  if (peg$silentFails === 0) {
1865
- peg$fail(peg$e24);
1993
+ peg$fail(peg$e25);
1866
1994
  }
1867
1995
  }
1868
1996
  if (s1 !== peg$FAILED) {
1869
1997
  peg$savedPos = s0;
1870
- s1 = peg$f24();
1998
+ s1 = peg$f26();
1871
1999
  }
1872
2000
  s0 = s1;
1873
2001
  }
@@ -1877,31 +2005,31 @@ function peg$parse(input, options) {
1877
2005
  let s0, s1, s2, s3;
1878
2006
  s0 = peg$currPos;
1879
2007
  if (input.charCodeAt(peg$currPos) === 123) {
1880
- s1 = peg$c16;
2008
+ s1 = peg$c17;
1881
2009
  peg$currPos++;
1882
2010
  }
1883
2011
  else {
1884
2012
  s1 = peg$FAILED;
1885
2013
  if (peg$silentFails === 0) {
1886
- peg$fail(peg$e25);
2014
+ peg$fail(peg$e26);
1887
2015
  }
1888
2016
  }
1889
2017
  if (s1 !== peg$FAILED) {
1890
2018
  s2 = peg$parsecommands();
1891
2019
  if (s2 !== peg$FAILED) {
1892
2020
  if (input.charCodeAt(peg$currPos) === 125) {
1893
- s3 = peg$c17;
2021
+ s3 = peg$c18;
1894
2022
  peg$currPos++;
1895
2023
  }
1896
2024
  else {
1897
2025
  s3 = peg$FAILED;
1898
2026
  if (peg$silentFails === 0) {
1899
- peg$fail(peg$e26);
2027
+ peg$fail(peg$e27);
1900
2028
  }
1901
2029
  }
1902
2030
  if (s3 !== peg$FAILED) {
1903
2031
  peg$savedPos = s0;
1904
- s0 = peg$f25(s2);
2032
+ s0 = peg$f27(s2);
1905
2033
  }
1906
2034
  else {
1907
2035
  peg$currPos = s0;
@@ -1988,7 +2116,7 @@ function peg$parse(input, options) {
1988
2116
  else {
1989
2117
  s2 = peg$FAILED;
1990
2118
  if (peg$silentFails === 0) {
1991
- peg$fail(peg$e27);
2119
+ peg$fail(peg$e28);
1992
2120
  }
1993
2121
  }
1994
2122
  if (s2 !== peg$FAILED) {
@@ -2001,7 +2129,7 @@ function peg$parse(input, options) {
2001
2129
  else {
2002
2130
  s2 = peg$FAILED;
2003
2131
  if (peg$silentFails === 0) {
2004
- peg$fail(peg$e27);
2132
+ peg$fail(peg$e28);
2005
2133
  }
2006
2134
  }
2007
2135
  }
@@ -2023,7 +2151,7 @@ function peg$parse(input, options) {
2023
2151
  else {
2024
2152
  s2 = peg$FAILED;
2025
2153
  if (peg$silentFails === 0) {
2026
- peg$fail(peg$e27);
2154
+ peg$fail(peg$e28);
2027
2155
  }
2028
2156
  }
2029
2157
  if (s2 !== peg$FAILED) {
@@ -2036,7 +2164,7 @@ function peg$parse(input, options) {
2036
2164
  else {
2037
2165
  s2 = peg$FAILED;
2038
2166
  if (peg$silentFails === 0) {
2039
- peg$fail(peg$e27);
2167
+ peg$fail(peg$e28);
2040
2168
  }
2041
2169
  }
2042
2170
  }
@@ -2058,13 +2186,13 @@ function peg$parse(input, options) {
2058
2186
  let s0, s1, s2, s3;
2059
2187
  s0 = peg$currPos;
2060
2188
  if (input.charCodeAt(peg$currPos) === 34) {
2061
- s1 = peg$c18;
2189
+ s1 = peg$c19;
2062
2190
  peg$currPos++;
2063
2191
  }
2064
2192
  else {
2065
2193
  s1 = peg$FAILED;
2066
2194
  if (peg$silentFails === 0) {
2067
- peg$fail(peg$e28);
2195
+ peg$fail(peg$e29);
2068
2196
  }
2069
2197
  }
2070
2198
  if (s1 !== peg$FAILED) {
@@ -2075,18 +2203,18 @@ function peg$parse(input, options) {
2075
2203
  s3 = peg$parsedoubleStringChar();
2076
2204
  }
2077
2205
  if (input.charCodeAt(peg$currPos) === 34) {
2078
- s3 = peg$c18;
2206
+ s3 = peg$c19;
2079
2207
  peg$currPos++;
2080
2208
  }
2081
2209
  else {
2082
2210
  s3 = peg$FAILED;
2083
2211
  if (peg$silentFails === 0) {
2084
- peg$fail(peg$e28);
2212
+ peg$fail(peg$e29);
2085
2213
  }
2086
2214
  }
2087
2215
  if (s3 !== peg$FAILED) {
2088
2216
  peg$savedPos = s0;
2089
- s0 = peg$f26(s2);
2217
+ s0 = peg$f28(s2);
2090
2218
  }
2091
2219
  else {
2092
2220
  peg$currPos = s0;
@@ -2100,13 +2228,13 @@ function peg$parse(input, options) {
2100
2228
  if (s0 === peg$FAILED) {
2101
2229
  s0 = peg$currPos;
2102
2230
  if (input.charCodeAt(peg$currPos) === 39) {
2103
- s1 = peg$c19;
2231
+ s1 = peg$c20;
2104
2232
  peg$currPos++;
2105
2233
  }
2106
2234
  else {
2107
2235
  s1 = peg$FAILED;
2108
2236
  if (peg$silentFails === 0) {
2109
- peg$fail(peg$e29);
2237
+ peg$fail(peg$e30);
2110
2238
  }
2111
2239
  }
2112
2240
  if (s1 !== peg$FAILED) {
@@ -2117,18 +2245,18 @@ function peg$parse(input, options) {
2117
2245
  s3 = peg$parsesingleStringChar();
2118
2246
  }
2119
2247
  if (input.charCodeAt(peg$currPos) === 39) {
2120
- s3 = peg$c19;
2248
+ s3 = peg$c20;
2121
2249
  peg$currPos++;
2122
2250
  }
2123
2251
  else {
2124
2252
  s3 = peg$FAILED;
2125
2253
  if (peg$silentFails === 0) {
2126
- peg$fail(peg$e29);
2254
+ peg$fail(peg$e30);
2127
2255
  }
2128
2256
  }
2129
2257
  if (s3 !== peg$FAILED) {
2130
2258
  peg$savedPos = s0;
2131
- s0 = peg$f27(s2);
2259
+ s0 = peg$f29(s2);
2132
2260
  }
2133
2261
  else {
2134
2262
  peg$currPos = s0;
@@ -2154,7 +2282,7 @@ function peg$parse(input, options) {
2154
2282
  else {
2155
2283
  s2 = peg$FAILED;
2156
2284
  if (peg$silentFails === 0) {
2157
- peg$fail(peg$e30);
2285
+ peg$fail(peg$e31);
2158
2286
  }
2159
2287
  }
2160
2288
  peg$silentFails--;
@@ -2173,12 +2301,12 @@ function peg$parse(input, options) {
2173
2301
  else {
2174
2302
  s2 = peg$FAILED;
2175
2303
  if (peg$silentFails === 0) {
2176
- peg$fail(peg$e31);
2304
+ peg$fail(peg$e32);
2177
2305
  }
2178
2306
  }
2179
2307
  if (s2 !== peg$FAILED) {
2180
2308
  peg$savedPos = s0;
2181
- s0 = peg$f28(s2);
2309
+ s0 = peg$f30(s2);
2182
2310
  }
2183
2311
  else {
2184
2312
  peg$currPos = s0;
@@ -2192,20 +2320,20 @@ function peg$parse(input, options) {
2192
2320
  if (s0 === peg$FAILED) {
2193
2321
  s0 = peg$currPos;
2194
2322
  if (input.charCodeAt(peg$currPos) === 92) {
2195
- s1 = peg$c20;
2323
+ s1 = peg$c21;
2196
2324
  peg$currPos++;
2197
2325
  }
2198
2326
  else {
2199
2327
  s1 = peg$FAILED;
2200
2328
  if (peg$silentFails === 0) {
2201
- peg$fail(peg$e32);
2329
+ peg$fail(peg$e33);
2202
2330
  }
2203
2331
  }
2204
2332
  if (s1 !== peg$FAILED) {
2205
2333
  s2 = peg$parseescapeChar();
2206
2334
  if (s2 !== peg$FAILED) {
2207
2335
  peg$savedPos = s0;
2208
- s0 = peg$f29(s2);
2336
+ s0 = peg$f31(s2);
2209
2337
  }
2210
2338
  else {
2211
2339
  peg$currPos = s0;
@@ -2231,7 +2359,7 @@ function peg$parse(input, options) {
2231
2359
  else {
2232
2360
  s2 = peg$FAILED;
2233
2361
  if (peg$silentFails === 0) {
2234
- peg$fail(peg$e33);
2362
+ peg$fail(peg$e34);
2235
2363
  }
2236
2364
  }
2237
2365
  peg$silentFails--;
@@ -2250,12 +2378,12 @@ function peg$parse(input, options) {
2250
2378
  else {
2251
2379
  s2 = peg$FAILED;
2252
2380
  if (peg$silentFails === 0) {
2253
- peg$fail(peg$e31);
2381
+ peg$fail(peg$e32);
2254
2382
  }
2255
2383
  }
2256
2384
  if (s2 !== peg$FAILED) {
2257
2385
  peg$savedPos = s0;
2258
- s0 = peg$f30(s2);
2386
+ s0 = peg$f32(s2);
2259
2387
  }
2260
2388
  else {
2261
2389
  peg$currPos = s0;
@@ -2269,20 +2397,20 @@ function peg$parse(input, options) {
2269
2397
  if (s0 === peg$FAILED) {
2270
2398
  s0 = peg$currPos;
2271
2399
  if (input.charCodeAt(peg$currPos) === 92) {
2272
- s1 = peg$c20;
2400
+ s1 = peg$c21;
2273
2401
  peg$currPos++;
2274
2402
  }
2275
2403
  else {
2276
2404
  s1 = peg$FAILED;
2277
2405
  if (peg$silentFails === 0) {
2278
- peg$fail(peg$e32);
2406
+ peg$fail(peg$e33);
2279
2407
  }
2280
2408
  }
2281
2409
  if (s1 !== peg$FAILED) {
2282
2410
  s2 = peg$parseescapeChar();
2283
2411
  if (s2 !== peg$FAILED) {
2284
2412
  peg$savedPos = s0;
2285
- s0 = peg$f31(s2);
2413
+ s0 = peg$f33(s2);
2286
2414
  }
2287
2415
  else {
2288
2416
  peg$currPos = s0;
@@ -2300,69 +2428,69 @@ function peg$parse(input, options) {
2300
2428
  let s0, s1;
2301
2429
  s0 = peg$currPos;
2302
2430
  if (input.charCodeAt(peg$currPos) === 34) {
2303
- s1 = peg$c18;
2431
+ s1 = peg$c19;
2304
2432
  peg$currPos++;
2305
2433
  }
2306
2434
  else {
2307
2435
  s1 = peg$FAILED;
2308
2436
  if (peg$silentFails === 0) {
2309
- peg$fail(peg$e28);
2437
+ peg$fail(peg$e29);
2310
2438
  }
2311
2439
  }
2312
2440
  if (s1 !== peg$FAILED) {
2313
2441
  peg$savedPos = s0;
2314
- s1 = peg$f32();
2442
+ s1 = peg$f34();
2315
2443
  }
2316
2444
  s0 = s1;
2317
2445
  if (s0 === peg$FAILED) {
2318
2446
  s0 = peg$currPos;
2319
2447
  if (input.charCodeAt(peg$currPos) === 39) {
2320
- s1 = peg$c19;
2448
+ s1 = peg$c20;
2321
2449
  peg$currPos++;
2322
2450
  }
2323
2451
  else {
2324
2452
  s1 = peg$FAILED;
2325
2453
  if (peg$silentFails === 0) {
2326
- peg$fail(peg$e29);
2454
+ peg$fail(peg$e30);
2327
2455
  }
2328
2456
  }
2329
2457
  if (s1 !== peg$FAILED) {
2330
2458
  peg$savedPos = s0;
2331
- s1 = peg$f33();
2459
+ s1 = peg$f35();
2332
2460
  }
2333
2461
  s0 = s1;
2334
2462
  if (s0 === peg$FAILED) {
2335
2463
  s0 = peg$currPos;
2336
2464
  if (input.charCodeAt(peg$currPos) === 92) {
2337
- s1 = peg$c20;
2465
+ s1 = peg$c21;
2338
2466
  peg$currPos++;
2339
2467
  }
2340
2468
  else {
2341
2469
  s1 = peg$FAILED;
2342
2470
  if (peg$silentFails === 0) {
2343
- peg$fail(peg$e32);
2471
+ peg$fail(peg$e33);
2344
2472
  }
2345
2473
  }
2346
2474
  if (s1 !== peg$FAILED) {
2347
2475
  peg$savedPos = s0;
2348
- s1 = peg$f34();
2476
+ s1 = peg$f36();
2349
2477
  }
2350
2478
  s0 = s1;
2351
2479
  if (s0 === peg$FAILED) {
2352
2480
  s0 = peg$currPos;
2353
2481
  if (input.charCodeAt(peg$currPos) === 110) {
2354
- s1 = peg$c21;
2482
+ s1 = peg$c22;
2355
2483
  peg$currPos++;
2356
2484
  }
2357
2485
  else {
2358
2486
  s1 = peg$FAILED;
2359
2487
  if (peg$silentFails === 0) {
2360
- peg$fail(peg$e34);
2488
+ peg$fail(peg$e35);
2361
2489
  }
2362
2490
  }
2363
2491
  if (s1 !== peg$FAILED) {
2364
2492
  peg$savedPos = s0;
2365
- s1 = peg$f35();
2493
+ s1 = peg$f37();
2366
2494
  }
2367
2495
  s0 = s1;
2368
2496
  }