@rohal12/spindle 0.64.11 → 0.64.13

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.
@@ -286,11 +286,14 @@ var peg$SyntaxError = class extends SyntaxError {
286
286
  if (nonPrintable) return s.replace(nonPrintable, (ch) => "\\u{" + hex(ch) + "}");
287
287
  return s;
288
288
  }
289
+ function escape(s, special) {
290
+ return unicodeEscape(s.replace(special, "\\$&").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
291
+ }
289
292
  function literalEscape(s) {
290
- return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
293
+ return escape(s, /[\\"]/g);
291
294
  }
292
295
  function classEscape(s) {
293
- return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
296
+ return escape(s, /[\\\]^-]/g);
294
297
  }
295
298
  const DESCRIBE_EXPECTATION_FNS = {
296
299
  literal(expectation) {
@@ -364,28 +367,6 @@ function peg$parse(input, options) {
364
367
  const peg$c16 = "=";
365
368
  const peg$c17 = "\"";
366
369
  const peg$c18 = "'";
367
- const peg$r0 = /^[^\\{[<]/;
368
- const peg$r1 = /^[{}]/;
369
- const peg$r2 = /^[$_@%(!\/a-zA-Z]/;
370
- const peg$r3 = /^[.#]/;
371
- const peg$r4 = /^[a-zA-Z0-9_\-]/;
372
- const peg$r5 = /^[$_@%]/;
373
- const peg$r6 = /^[a-zA-Z0-9_.]/;
374
- const peg$r7 = /^[$_@%(!]/;
375
- const peg$r8 = /^[a-zA-Z]/;
376
- const peg$r9 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF}]/;
377
- const peg$r10 = /^[a-zA-Z0-9.!#$%&'*+\/=?\^_`|~\-]/;
378
- const peg$r11 = /^[a-zA-Z0-9.\-]/;
379
- const peg$r12 = /^[a-zA-Z0-9+.\-]/;
380
- const peg$r13 = /^[^\0- \x7F<>{}]/;
381
- const peg$r14 = /^[\t-\r \/>\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
382
- const peg$r15 = /^[a-zA-Z0-9\-]/;
383
- const peg$r16 = /^[\t-\r "'\/<->{}\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
384
- const peg$r17 = /^[^"]/;
385
- const peg$r18 = /^[^']/;
386
- const peg$r19 = /^["']/;
387
- const peg$r20 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF>]/;
388
- const peg$r21 = /^[ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;
389
370
  const peg$e0 = peg$anyExpectation();
390
371
  const peg$e1 = peg$classExpectation([
391
372
  "\\",
@@ -950,6 +931,7 @@ function peg$parse(input, options) {
950
931
  let peg$maxFailExpected = options.peg$maxFailExpected || [];
951
932
  let peg$silentFails = options.peg$silentFails | 0;
952
933
  let peg$result;
934
+ let peg$charCode;
953
935
  if (options.startRule) {
954
936
  if (!(options.startRule in peg$startRuleFunctions)) throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
955
937
  peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
@@ -1057,10 +1039,10 @@ function peg$parse(input, options) {
1057
1039
  let s0, s1, s2;
1058
1040
  s0 = peg$currPos;
1059
1041
  s1 = [];
1060
- s2 = peg$parseTokenItem();
1061
- while (s2 !== peg$FAILED) {
1062
- s1.push(s2);
1042
+ for (;;) {
1063
1043
  s2 = peg$parseTokenItem();
1044
+ if (s2 === peg$FAILED) break;
1045
+ s1.push(s2);
1064
1046
  }
1065
1047
  peg$savedPos = s0;
1066
1048
  s1 = peg$f0(s1);
@@ -1345,15 +1327,7 @@ function peg$parse(input, options) {
1345
1327
  if (s1 !== peg$FAILED) {
1346
1328
  s2 = peg$currPos;
1347
1329
  s3 = [];
1348
- if (input.length > peg$currPos) {
1349
- s4 = input.charAt(peg$currPos);
1350
- peg$currPos++;
1351
- } else {
1352
- s4 = peg$FAILED;
1353
- if (peg$silentFails === 0) peg$fail(peg$e0);
1354
- }
1355
- while (s4 !== peg$FAILED) {
1356
- s3.push(s4);
1330
+ for (;;) {
1357
1331
  if (input.length > peg$currPos) {
1358
1332
  s4 = input.charAt(peg$currPos);
1359
1333
  peg$currPos++;
@@ -1361,6 +1335,8 @@ function peg$parse(input, options) {
1361
1335
  s4 = peg$FAILED;
1362
1336
  if (peg$silentFails === 0) peg$fail(peg$e0);
1363
1337
  }
1338
+ if (s4 === peg$FAILED) break;
1339
+ s3.push(s4);
1364
1340
  }
1365
1341
  s2 = input.substring(s2, peg$currPos);
1366
1342
  peg$savedPos = s0;
@@ -1386,22 +1362,17 @@ function peg$parse(input, options) {
1386
1362
  s0 = peg$currPos;
1387
1363
  s1 = peg$currPos;
1388
1364
  s2 = [];
1389
- s3 = input.charAt(peg$currPos);
1390
- if (peg$r0.test(s3)) peg$currPos++;
1391
- else {
1392
- s3 = peg$FAILED;
1393
- if (peg$silentFails === 0) peg$fail(peg$e1);
1394
- }
1395
- if (s3 !== peg$FAILED) while (s3 !== peg$FAILED) {
1396
- s2.push(s3);
1365
+ for (;;) {
1397
1366
  s3 = input.charAt(peg$currPos);
1398
- if (peg$r0.test(s3)) peg$currPos++;
1367
+ if (s3 !== "" && !(peg$charCode = s3.charCodeAt(0), peg$charCode === 92 || peg$charCode === 123 || peg$charCode === 91 || peg$charCode === 60)) peg$currPos++;
1399
1368
  else {
1400
1369
  s3 = peg$FAILED;
1401
1370
  if (peg$silentFails === 0) peg$fail(peg$e1);
1402
1371
  }
1372
+ if (s3 === peg$FAILED) break;
1373
+ s2.push(s3);
1403
1374
  }
1404
- else s2 = peg$FAILED;
1375
+ if (s2.length < 1) s2 = peg$FAILED;
1405
1376
  if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
1406
1377
  else s1 = s2;
1407
1378
  if (s1 !== peg$FAILED) {
@@ -1447,43 +1418,7 @@ function peg$parse(input, options) {
1447
1418
  else s5 = peg$FAILED;
1448
1419
  if (s5 !== peg$FAILED) {
1449
1420
  s6 = [];
1450
- s7 = peg$currPos;
1451
- s8 = peg$currPos;
1452
- peg$silentFails++;
1453
- if (input.substr(peg$currPos, 3) === peg$c3) {
1454
- s9 = peg$c3;
1455
- peg$currPos += 3;
1456
- } else {
1457
- s9 = peg$FAILED;
1458
- if (peg$silentFails === 0) peg$fail(peg$e5);
1459
- }
1460
- peg$silentFails--;
1461
- if (s9 === peg$FAILED) s8 = void 0;
1462
- else {
1463
- peg$currPos = s8;
1464
- s8 = peg$FAILED;
1465
- }
1466
- if (s8 !== peg$FAILED) {
1467
- if (input.length > peg$currPos) {
1468
- s9 = input.charAt(peg$currPos);
1469
- peg$currPos++;
1470
- } else {
1471
- s9 = peg$FAILED;
1472
- if (peg$silentFails === 0) peg$fail(peg$e0);
1473
- }
1474
- if (s9 !== peg$FAILED) {
1475
- s8 = [s8, s9];
1476
- s7 = s8;
1477
- } else {
1478
- peg$currPos = s7;
1479
- s7 = peg$FAILED;
1480
- }
1481
- } else {
1482
- peg$currPos = s7;
1483
- s7 = peg$FAILED;
1484
- }
1485
- while (s7 !== peg$FAILED) {
1486
- s6.push(s7);
1421
+ for (;;) {
1487
1422
  s7 = peg$currPos;
1488
1423
  s8 = peg$currPos;
1489
1424
  peg$silentFails++;
@@ -1519,6 +1454,8 @@ function peg$parse(input, options) {
1519
1454
  peg$currPos = s7;
1520
1455
  s7 = peg$FAILED;
1521
1456
  }
1457
+ if (s7 === peg$FAILED) break;
1458
+ s6.push(s7);
1522
1459
  }
1523
1460
  if (input.substr(peg$currPos, 3) === peg$c3) {
1524
1461
  s7 = peg$c3;
@@ -1570,15 +1507,7 @@ function peg$parse(input, options) {
1570
1507
  s0 = peg$currPos;
1571
1508
  s1 = peg$currPos;
1572
1509
  s2 = [];
1573
- if (input.charCodeAt(peg$currPos) === 92) {
1574
- s3 = peg$c4;
1575
- peg$currPos++;
1576
- } else {
1577
- s3 = peg$FAILED;
1578
- if (peg$silentFails === 0) peg$fail(peg$e6);
1579
- }
1580
- if (s3 !== peg$FAILED) while (s3 !== peg$FAILED) {
1581
- s2.push(s3);
1510
+ for (;;) {
1582
1511
  if (input.charCodeAt(peg$currPos) === 92) {
1583
1512
  s3 = peg$c4;
1584
1513
  peg$currPos++;
@@ -1586,8 +1515,10 @@ function peg$parse(input, options) {
1586
1515
  s3 = peg$FAILED;
1587
1516
  if (peg$silentFails === 0) peg$fail(peg$e6);
1588
1517
  }
1518
+ if (s3 === peg$FAILED) break;
1519
+ s2.push(s3);
1589
1520
  }
1590
- else s2 = peg$FAILED;
1521
+ if (s2.length < 1) s2 = peg$FAILED;
1591
1522
  if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
1592
1523
  else s1 = s2;
1593
1524
  if (s1 !== peg$FAILED) {
@@ -1598,7 +1529,7 @@ function peg$parse(input, options) {
1598
1529
  else s3 = peg$FAILED;
1599
1530
  if (s3 !== peg$FAILED) {
1600
1531
  s4 = input.charAt(peg$currPos);
1601
- if (peg$r1.test(s4)) peg$currPos++;
1532
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 123 || peg$charCode === 125) peg$currPos++;
1602
1533
  else {
1603
1534
  s4 = peg$FAILED;
1604
1535
  if (peg$silentFails === 0) peg$fail(peg$e7);
@@ -1640,7 +1571,7 @@ function peg$parse(input, options) {
1640
1571
  s4 = peg$parseSelectors();
1641
1572
  if (s4 !== peg$FAILED) {
1642
1573
  s5 = input.charAt(peg$currPos);
1643
- if (peg$r2.test(s5)) peg$currPos++;
1574
+ if (peg$charCode = s5.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33 || peg$charCode === 47 || peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
1644
1575
  else {
1645
1576
  s5 = peg$FAILED;
1646
1577
  if (peg$silentFails === 0) peg$fail(peg$e9);
@@ -1819,52 +1750,7 @@ function peg$parse(input, options) {
1819
1750
  function peg$parseLinkText() {
1820
1751
  let s0, s1, s2, s3;
1821
1752
  s0 = [];
1822
- s1 = peg$currPos;
1823
- s2 = peg$currPos;
1824
- peg$silentFails++;
1825
- if (input.substr(peg$currPos, 2) === peg$c9) {
1826
- s3 = peg$c9;
1827
- peg$currPos += 2;
1828
- } else {
1829
- s3 = peg$FAILED;
1830
- if (peg$silentFails === 0) peg$fail(peg$e13);
1831
- }
1832
- if (s3 === peg$FAILED) {
1833
- if (input.substr(peg$currPos, 2) === peg$c8) {
1834
- s3 = peg$c8;
1835
- peg$currPos += 2;
1836
- } else {
1837
- s3 = peg$FAILED;
1838
- if (peg$silentFails === 0) peg$fail(peg$e12);
1839
- }
1840
- }
1841
- peg$silentFails--;
1842
- if (s3 === peg$FAILED) s2 = void 0;
1843
- else {
1844
- peg$currPos = s2;
1845
- s2 = peg$FAILED;
1846
- }
1847
- if (s2 !== peg$FAILED) {
1848
- if (input.length > peg$currPos) {
1849
- s3 = input.charAt(peg$currPos);
1850
- peg$currPos++;
1851
- } else {
1852
- s3 = peg$FAILED;
1853
- if (peg$silentFails === 0) peg$fail(peg$e0);
1854
- }
1855
- if (s3 !== peg$FAILED) {
1856
- s2 = [s2, s3];
1857
- s1 = s2;
1858
- } else {
1859
- peg$currPos = s1;
1860
- s1 = peg$FAILED;
1861
- }
1862
- } else {
1863
- peg$currPos = s1;
1864
- s1 = peg$FAILED;
1865
- }
1866
- while (s1 !== peg$FAILED) {
1867
- s0.push(s1);
1753
+ for (;;) {
1868
1754
  s1 = peg$currPos;
1869
1755
  s2 = peg$currPos;
1870
1756
  peg$silentFails++;
@@ -1909,6 +1795,8 @@ function peg$parse(input, options) {
1909
1795
  peg$currPos = s1;
1910
1796
  s1 = peg$FAILED;
1911
1797
  }
1798
+ if (s1 === peg$FAILED) break;
1799
+ s0.push(s1);
1912
1800
  }
1913
1801
  return s0;
1914
1802
  }
@@ -1916,12 +1804,12 @@ function peg$parse(input, options) {
1916
1804
  let s0, s1, s2;
1917
1805
  s0 = peg$currPos;
1918
1806
  s1 = [];
1919
- s2 = peg$parseSelectorPart();
1920
- if (s2 !== peg$FAILED) while (s2 !== peg$FAILED) {
1921
- s1.push(s2);
1807
+ for (;;) {
1922
1808
  s2 = peg$parseSelectorPart();
1809
+ if (s2 === peg$FAILED) break;
1810
+ s1.push(s2);
1923
1811
  }
1924
- else s1 = peg$FAILED;
1812
+ if (s1.length < 1) s1 = peg$FAILED;
1925
1813
  if (s1 !== peg$FAILED) {
1926
1814
  if (input.charCodeAt(peg$currPos) === 32) {
1927
1815
  s2 = peg$c10;
@@ -1953,15 +1841,7 @@ function peg$parse(input, options) {
1953
1841
  if (s1 !== peg$FAILED) {
1954
1842
  s2 = peg$parseHere();
1955
1843
  s3 = [];
1956
- if (input.length > peg$currPos) {
1957
- s4 = input.charAt(peg$currPos);
1958
- peg$currPos++;
1959
- } else {
1960
- s4 = peg$FAILED;
1961
- if (peg$silentFails === 0) peg$fail(peg$e0);
1962
- }
1963
- while (s4 !== peg$FAILED) {
1964
- s3.push(s4);
1844
+ for (;;) {
1965
1845
  if (input.length > peg$currPos) {
1966
1846
  s4 = input.charAt(peg$currPos);
1967
1847
  peg$currPos++;
@@ -1969,6 +1849,8 @@ function peg$parse(input, options) {
1969
1849
  s4 = peg$FAILED;
1970
1850
  if (peg$silentFails === 0) peg$fail(peg$e0);
1971
1851
  }
1852
+ if (s4 === peg$FAILED) break;
1853
+ s3.push(s4);
1972
1854
  }
1973
1855
  peg$savedPos = s0;
1974
1856
  s0 = peg$f39(s1, s2);
@@ -1982,7 +1864,7 @@ function peg$parse(input, options) {
1982
1864
  let s0, s1, s2, s3, s4;
1983
1865
  s0 = peg$currPos;
1984
1866
  s1 = input.charAt(peg$currPos);
1985
- if (peg$r3.test(s1)) peg$currPos++;
1867
+ if (peg$charCode = s1.charCodeAt(0), peg$charCode === 46 || peg$charCode === 35) peg$currPos++;
1986
1868
  else {
1987
1869
  s1 = peg$FAILED;
1988
1870
  if (peg$silentFails === 0) peg$fail(peg$e15);
@@ -1990,10 +1872,10 @@ function peg$parse(input, options) {
1990
1872
  if (s1 !== peg$FAILED) {
1991
1873
  s2 = peg$currPos;
1992
1874
  s3 = [];
1993
- s4 = peg$parseSelectorChar();
1994
- while (s4 !== peg$FAILED) {
1995
- s3.push(s4);
1875
+ for (;;) {
1996
1876
  s4 = peg$parseSelectorChar();
1877
+ if (s4 === peg$FAILED) break;
1878
+ s3.push(s4);
1997
1879
  }
1998
1880
  s2 = input.substring(s2, peg$currPos);
1999
1881
  peg$savedPos = s0;
@@ -2007,7 +1889,7 @@ function peg$parse(input, options) {
2007
1889
  function peg$parseSelectorChar() {
2008
1890
  let s0, s1, s2, s3, s4;
2009
1891
  s0 = input.charAt(peg$currPos);
2010
- if (peg$r4.test(s0)) peg$currPos++;
1892
+ if (peg$charCode = s0.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 45) peg$currPos++;
2011
1893
  else {
2012
1894
  s0 = peg$FAILED;
2013
1895
  if (peg$silentFails === 0) peg$fail(peg$e16);
@@ -2023,27 +1905,22 @@ function peg$parse(input, options) {
2023
1905
  }
2024
1906
  if (s1 !== peg$FAILED) {
2025
1907
  s2 = input.charAt(peg$currPos);
2026
- if (peg$r5.test(s2)) peg$currPos++;
1908
+ if (peg$charCode = s2.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
2027
1909
  else {
2028
1910
  s2 = peg$FAILED;
2029
1911
  if (peg$silentFails === 0) peg$fail(peg$e17);
2030
1912
  }
2031
1913
  if (s2 !== peg$FAILED) {
2032
1914
  s3 = [];
2033
- s4 = input.charAt(peg$currPos);
2034
- if (peg$r6.test(s4)) peg$currPos++;
2035
- else {
2036
- s4 = peg$FAILED;
2037
- if (peg$silentFails === 0) peg$fail(peg$e18);
2038
- }
2039
- while (s4 !== peg$FAILED) {
2040
- s3.push(s4);
1915
+ for (;;) {
2041
1916
  s4 = input.charAt(peg$currPos);
2042
- if (peg$r6.test(s4)) peg$currPos++;
1917
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
2043
1918
  else {
2044
1919
  s4 = peg$FAILED;
2045
1920
  if (peg$silentFails === 0) peg$fail(peg$e18);
2046
1921
  }
1922
+ if (s4 === peg$FAILED) break;
1923
+ s3.push(s4);
2047
1924
  }
2048
1925
  if (input.charCodeAt(peg$currPos) === 125) {
2049
1926
  s4 = peg$c11;
@@ -2090,7 +1967,7 @@ function peg$parse(input, options) {
2090
1967
  s3 = peg$parseSelectors();
2091
1968
  if (s3 !== peg$FAILED) {
2092
1969
  s4 = input.charAt(peg$currPos);
2093
- if (peg$r5.test(s4)) peg$currPos++;
1970
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
2094
1971
  else {
2095
1972
  s4 = peg$FAILED;
2096
1973
  if (peg$silentFails === 0) peg$fail(peg$e17);
@@ -2099,20 +1976,15 @@ function peg$parse(input, options) {
2099
1976
  s5 = peg$parseHere();
2100
1977
  s6 = peg$currPos;
2101
1978
  s7 = [];
2102
- s8 = input.charAt(peg$currPos);
2103
- if (peg$r6.test(s8)) peg$currPos++;
2104
- else {
2105
- s8 = peg$FAILED;
2106
- if (peg$silentFails === 0) peg$fail(peg$e18);
2107
- }
2108
- while (s8 !== peg$FAILED) {
2109
- s7.push(s8);
1979
+ for (;;) {
2110
1980
  s8 = input.charAt(peg$currPos);
2111
- if (peg$r6.test(s8)) peg$currPos++;
1981
+ if (peg$charCode = s8.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
2112
1982
  else {
2113
1983
  s8 = peg$FAILED;
2114
1984
  if (peg$silentFails === 0) peg$fail(peg$e18);
2115
1985
  }
1986
+ if (s8 === peg$FAILED) break;
1987
+ s7.push(s8);
2116
1988
  }
2117
1989
  s6 = input.substring(s6, peg$currPos);
2118
1990
  s7 = peg$parseBraceEnd();
@@ -2152,7 +2024,7 @@ function peg$parse(input, options) {
2152
2024
  s5 = peg$currPos;
2153
2025
  peg$silentFails++;
2154
2026
  s6 = input.charAt(peg$currPos);
2155
- if (peg$r7.test(s6)) peg$currPos++;
2027
+ if (peg$charCode = s6.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
2156
2028
  else {
2157
2029
  s6 = peg$FAILED;
2158
2030
  if (peg$silentFails === 0) peg$fail(peg$e20);
@@ -2204,7 +2076,7 @@ function peg$parse(input, options) {
2204
2076
  s3 = peg$currPos;
2205
2077
  peg$silentFails++;
2206
2078
  s4 = input.charAt(peg$currPos);
2207
- if (peg$r7.test(s4)) peg$currPos++;
2079
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
2208
2080
  else {
2209
2081
  s4 = peg$FAILED;
2210
2082
  if (peg$silentFails === 0) peg$fail(peg$e20);
@@ -2469,27 +2341,22 @@ function peg$parse(input, options) {
2469
2341
  s0 = peg$currPos;
2470
2342
  s1 = peg$currPos;
2471
2343
  s2 = input.charAt(peg$currPos);
2472
- if (peg$r8.test(s2)) peg$currPos++;
2344
+ if (peg$charCode = s2.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
2473
2345
  else {
2474
2346
  s2 = peg$FAILED;
2475
2347
  if (peg$silentFails === 0) peg$fail(peg$e22);
2476
2348
  }
2477
2349
  if (s2 !== peg$FAILED) {
2478
2350
  s3 = [];
2479
- s4 = input.charAt(peg$currPos);
2480
- if (peg$r9.test(s4)) peg$currPos++;
2481
- else {
2482
- s4 = peg$FAILED;
2483
- if (peg$silentFails === 0) peg$fail(peg$e23);
2484
- }
2485
- while (s4 !== peg$FAILED) {
2486
- s3.push(s4);
2351
+ for (;;) {
2487
2352
  s4 = input.charAt(peg$currPos);
2488
- if (peg$r9.test(s4)) peg$currPos++;
2353
+ if (s4 !== "" && !(peg$charCode = s4.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279 || peg$charCode === 125)) peg$currPos++;
2489
2354
  else {
2490
2355
  s4 = peg$FAILED;
2491
2356
  if (peg$silentFails === 0) peg$fail(peg$e23);
2492
2357
  }
2358
+ if (s4 === peg$FAILED) break;
2359
+ s3.push(s4);
2493
2360
  }
2494
2361
  s2 = [s2, s3];
2495
2362
  s1 = s2;
@@ -2515,22 +2382,17 @@ function peg$parse(input, options) {
2515
2382
  }
2516
2383
  if (s3 !== peg$FAILED) {
2517
2384
  s4 = [];
2518
- s5 = input.charAt(peg$currPos);
2519
- if (peg$r10.test(s5)) peg$currPos++;
2520
- else {
2521
- s5 = peg$FAILED;
2522
- if (peg$silentFails === 0) peg$fail(peg$e24);
2523
- }
2524
- if (s5 !== peg$FAILED) while (s5 !== peg$FAILED) {
2525
- s4.push(s5);
2385
+ for (;;) {
2526
2386
  s5 = input.charAt(peg$currPos);
2527
- if (peg$r10.test(s5)) peg$currPos++;
2387
+ if (peg$charCode = s5.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 46 || peg$charCode === 33 || peg$charCode === 35 || peg$charCode === 36 || peg$charCode === 37 || peg$charCode === 38 || peg$charCode === 39 || peg$charCode === 42 || peg$charCode === 43 || peg$charCode === 47 || peg$charCode === 61 || peg$charCode === 63 || peg$charCode === 94 || peg$charCode === 95 || peg$charCode === 96 || peg$charCode === 124 || peg$charCode === 126 || peg$charCode === 45) peg$currPos++;
2528
2388
  else {
2529
2389
  s5 = peg$FAILED;
2530
2390
  if (peg$silentFails === 0) peg$fail(peg$e24);
2531
2391
  }
2392
+ if (s5 === peg$FAILED) break;
2393
+ s4.push(s5);
2532
2394
  }
2533
- else s4 = peg$FAILED;
2395
+ if (s4.length < 1) s4 = peg$FAILED;
2534
2396
  if (s4 !== peg$FAILED) {
2535
2397
  if (input.charCodeAt(peg$currPos) === 64) {
2536
2398
  s5 = peg$c13;
@@ -2541,22 +2403,17 @@ function peg$parse(input, options) {
2541
2403
  }
2542
2404
  if (s5 !== peg$FAILED) {
2543
2405
  s6 = [];
2544
- s7 = input.charAt(peg$currPos);
2545
- if (peg$r11.test(s7)) peg$currPos++;
2546
- else {
2547
- s7 = peg$FAILED;
2548
- if (peg$silentFails === 0) peg$fail(peg$e26);
2549
- }
2550
- if (s7 !== peg$FAILED) while (s7 !== peg$FAILED) {
2551
- s6.push(s7);
2406
+ for (;;) {
2552
2407
  s7 = input.charAt(peg$currPos);
2553
- if (peg$r11.test(s7)) peg$currPos++;
2408
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
2554
2409
  else {
2555
2410
  s7 = peg$FAILED;
2556
2411
  if (peg$silentFails === 0) peg$fail(peg$e26);
2557
2412
  }
2413
+ if (s7 === peg$FAILED) break;
2414
+ s6.push(s7);
2558
2415
  }
2559
- else s6 = peg$FAILED;
2416
+ if (s6.length < 1) s6 = peg$FAILED;
2560
2417
  if (s6 !== peg$FAILED) {
2561
2418
  if (input.charCodeAt(peg$currPos) === 62) {
2562
2419
  s7 = peg$c1;
@@ -2628,7 +2485,7 @@ function peg$parse(input, options) {
2628
2485
  }
2629
2486
  if (s3 !== peg$FAILED) {
2630
2487
  s4 = input.charAt(peg$currPos);
2631
- if (peg$r8.test(s4)) peg$currPos++;
2488
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
2632
2489
  else {
2633
2490
  s4 = peg$FAILED;
2634
2491
  if (peg$silentFails === 0) peg$fail(peg$e22);
@@ -2637,7 +2494,7 @@ function peg$parse(input, options) {
2637
2494
  s5 = peg$currPos;
2638
2495
  s6 = [];
2639
2496
  s7 = input.charAt(peg$currPos);
2640
- if (peg$r12.test(s7)) peg$currPos++;
2497
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 43 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
2641
2498
  else {
2642
2499
  s7 = peg$FAILED;
2643
2500
  if (peg$silentFails === 0) peg$fail(peg$e27);
@@ -2647,7 +2504,7 @@ function peg$parse(input, options) {
2647
2504
  if (s6.length >= 31) s7 = peg$FAILED;
2648
2505
  else {
2649
2506
  s7 = input.charAt(peg$currPos);
2650
- if (peg$r12.test(s7)) peg$currPos++;
2507
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 43 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
2651
2508
  else {
2652
2509
  s7 = peg$FAILED;
2653
2510
  if (peg$silentFails === 0) peg$fail(peg$e27);
@@ -2668,42 +2525,7 @@ function peg$parse(input, options) {
2668
2525
  }
2669
2526
  if (s6 !== peg$FAILED) {
2670
2527
  s7 = [];
2671
- s8 = peg$currPos;
2672
- s9 = peg$currPos;
2673
- peg$silentFails++;
2674
- if (input.substr(peg$currPos, 2) === peg$c8) {
2675
- s10 = peg$c8;
2676
- peg$currPos += 2;
2677
- } else {
2678
- s10 = peg$FAILED;
2679
- if (peg$silentFails === 0) peg$fail(peg$e12);
2680
- }
2681
- peg$silentFails--;
2682
- if (s10 === peg$FAILED) s9 = void 0;
2683
- else {
2684
- peg$currPos = s9;
2685
- s9 = peg$FAILED;
2686
- }
2687
- if (s9 !== peg$FAILED) {
2688
- s10 = input.charAt(peg$currPos);
2689
- if (peg$r13.test(s10)) peg$currPos++;
2690
- else {
2691
- s10 = peg$FAILED;
2692
- if (peg$silentFails === 0) peg$fail(peg$e29);
2693
- }
2694
- if (s10 !== peg$FAILED) {
2695
- s9 = [s9, s10];
2696
- s8 = s9;
2697
- } else {
2698
- peg$currPos = s8;
2699
- s8 = peg$FAILED;
2700
- }
2701
- } else {
2702
- peg$currPos = s8;
2703
- s8 = peg$FAILED;
2704
- }
2705
- while (s8 !== peg$FAILED) {
2706
- s7.push(s8);
2528
+ for (;;) {
2707
2529
  s8 = peg$currPos;
2708
2530
  s9 = peg$currPos;
2709
2531
  peg$silentFails++;
@@ -2722,7 +2544,7 @@ function peg$parse(input, options) {
2722
2544
  }
2723
2545
  if (s9 !== peg$FAILED) {
2724
2546
  s10 = input.charAt(peg$currPos);
2725
- if (peg$r13.test(s10)) peg$currPos++;
2547
+ if (s10 !== "" && !(peg$charCode = s10.charCodeAt(0), peg$charCode >= 0 && peg$charCode <= 32 || peg$charCode === 127 || peg$charCode === 60 || peg$charCode === 62 || peg$charCode === 123 || peg$charCode === 125)) peg$currPos++;
2726
2548
  else {
2727
2549
  s10 = peg$FAILED;
2728
2550
  if (peg$silentFails === 0) peg$fail(peg$e29);
@@ -2738,6 +2560,8 @@ function peg$parse(input, options) {
2738
2560
  peg$currPos = s8;
2739
2561
  s8 = peg$FAILED;
2740
2562
  }
2563
+ if (s8 === peg$FAILED) break;
2564
+ s7.push(s8);
2741
2565
  }
2742
2566
  if (input.charCodeAt(peg$currPos) === 62) {
2743
2567
  s8 = peg$c1;
@@ -2800,10 +2624,10 @@ function peg$parse(input, options) {
2800
2624
  s3 = peg$parseTagName();
2801
2625
  if (s3 !== peg$FAILED) {
2802
2626
  s4 = [];
2803
- s5 = peg$parseAttribute();
2804
- while (s5 !== peg$FAILED) {
2805
- s4.push(s5);
2627
+ for (;;) {
2806
2628
  s5 = peg$parseAttribute();
2629
+ if (s5 === peg$FAILED) break;
2630
+ s4.push(s5);
2807
2631
  }
2808
2632
  s5 = peg$parse_();
2809
2633
  if (input.charCodeAt(peg$currPos) === 47) {
@@ -2852,7 +2676,7 @@ function peg$parse(input, options) {
2852
2676
  s3 = peg$currPos;
2853
2677
  peg$silentFails++;
2854
2678
  s4 = input.charAt(peg$currPos);
2855
- if (peg$r14.test(s4)) peg$currPos++;
2679
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 9 && peg$charCode <= 13 || peg$charCode === 32 || peg$charCode === 47 || peg$charCode === 62 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode >= 8232 && peg$charCode <= 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
2856
2680
  else {
2857
2681
  s4 = peg$FAILED;
2858
2682
  if (peg$silentFails === 0) peg$fail(peg$e30);
@@ -2881,10 +2705,10 @@ function peg$parse(input, options) {
2881
2705
  } else s3 = peg$FAILED;
2882
2706
  if (s3 !== peg$FAILED) {
2883
2707
  s4 = [];
2884
- s5 = peg$parseAttribute();
2885
- while (s5 !== peg$FAILED) {
2886
- s4.push(s5);
2708
+ for (;;) {
2887
2709
  s5 = peg$parseAttribute();
2710
+ if (s5 === peg$FAILED) break;
2711
+ s4.push(s5);
2888
2712
  }
2889
2713
  s5 = peg$parse_();
2890
2714
  s6 = peg$parseHere();
@@ -2949,27 +2773,22 @@ function peg$parse(input, options) {
2949
2773
  s0 = peg$currPos;
2950
2774
  s1 = peg$currPos;
2951
2775
  s2 = input.charAt(peg$currPos);
2952
- if (peg$r8.test(s2)) peg$currPos++;
2776
+ if (peg$charCode = s2.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
2953
2777
  else {
2954
2778
  s2 = peg$FAILED;
2955
2779
  if (peg$silentFails === 0) peg$fail(peg$e22);
2956
2780
  }
2957
2781
  if (s2 !== peg$FAILED) {
2958
2782
  s3 = [];
2959
- s4 = input.charAt(peg$currPos);
2960
- if (peg$r15.test(s4)) peg$currPos++;
2961
- else {
2962
- s4 = peg$FAILED;
2963
- if (peg$silentFails === 0) peg$fail(peg$e32);
2964
- }
2965
- while (s4 !== peg$FAILED) {
2966
- s3.push(s4);
2783
+ for (;;) {
2967
2784
  s4 = input.charAt(peg$currPos);
2968
- if (peg$r15.test(s4)) peg$currPos++;
2785
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 45) peg$currPos++;
2969
2786
  else {
2970
2787
  s4 = peg$FAILED;
2971
2788
  if (peg$silentFails === 0) peg$fail(peg$e32);
2972
2789
  }
2790
+ if (s4 === peg$FAILED) break;
2791
+ s3.push(s4);
2973
2792
  }
2974
2793
  s2 = [s2, s3];
2975
2794
  s1 = s2;
@@ -2988,47 +2807,12 @@ function peg$parse(input, options) {
2988
2807
  s2 = peg$parseHere();
2989
2808
  s3 = peg$currPos;
2990
2809
  s4 = [];
2991
- s5 = peg$currPos;
2992
- s6 = peg$currPos;
2993
- peg$silentFails++;
2994
- s7 = input.charAt(peg$currPos);
2995
- if (peg$r16.test(s7)) peg$currPos++;
2996
- else {
2997
- s7 = peg$FAILED;
2998
- if (peg$silentFails === 0) peg$fail(peg$e33);
2999
- }
3000
- peg$silentFails--;
3001
- if (s7 === peg$FAILED) s6 = void 0;
3002
- else {
3003
- peg$currPos = s6;
3004
- s6 = peg$FAILED;
3005
- }
3006
- if (s6 !== peg$FAILED) {
3007
- if (input.length > peg$currPos) {
3008
- s7 = input.charAt(peg$currPos);
3009
- peg$currPos++;
3010
- } else {
3011
- s7 = peg$FAILED;
3012
- if (peg$silentFails === 0) peg$fail(peg$e0);
3013
- }
3014
- if (s7 !== peg$FAILED) {
3015
- s6 = [s6, s7];
3016
- s5 = s6;
3017
- } else {
3018
- peg$currPos = s5;
3019
- s5 = peg$FAILED;
3020
- }
3021
- } else {
3022
- peg$currPos = s5;
3023
- s5 = peg$FAILED;
3024
- }
3025
- if (s5 !== peg$FAILED) while (s5 !== peg$FAILED) {
3026
- s4.push(s5);
2810
+ for (;;) {
3027
2811
  s5 = peg$currPos;
3028
2812
  s6 = peg$currPos;
3029
2813
  peg$silentFails++;
3030
2814
  s7 = input.charAt(peg$currPos);
3031
- if (peg$r16.test(s7)) peg$currPos++;
2815
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 9 && peg$charCode <= 13 || peg$charCode === 32 || peg$charCode === 34 || peg$charCode === 39 || peg$charCode === 47 || peg$charCode >= 60 && peg$charCode <= 62 || peg$charCode === 123 || peg$charCode === 125 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode >= 8232 && peg$charCode <= 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
3032
2816
  else {
3033
2817
  s7 = peg$FAILED;
3034
2818
  if (peg$silentFails === 0) peg$fail(peg$e33);
@@ -3058,8 +2842,10 @@ function peg$parse(input, options) {
3058
2842
  peg$currPos = s5;
3059
2843
  s5 = peg$FAILED;
3060
2844
  }
2845
+ if (s5 === peg$FAILED) break;
2846
+ s4.push(s5);
3061
2847
  }
3062
- else s4 = peg$FAILED;
2848
+ if (s4.length < 1) s4 = peg$FAILED;
3063
2849
  if (s4 !== peg$FAILED) s3 = input.substring(s3, peg$currPos);
3064
2850
  else s3 = s4;
3065
2851
  if (s3 !== peg$FAILED) {
@@ -3118,26 +2904,18 @@ function peg$parse(input, options) {
3118
2904
  s2 = peg$parseHere();
3119
2905
  s3 = peg$currPos;
3120
2906
  s4 = [];
3121
- s5 = peg$parseValuePart();
3122
- if (s5 === peg$FAILED) {
3123
- s5 = input.charAt(peg$currPos);
3124
- if (peg$r17.test(s5)) peg$currPos++;
3125
- else {
3126
- s5 = peg$FAILED;
3127
- if (peg$silentFails === 0) peg$fail(peg$e36);
3128
- }
3129
- }
3130
- while (s5 !== peg$FAILED) {
3131
- s4.push(s5);
2907
+ for (;;) {
3132
2908
  s5 = peg$parseValuePart();
3133
2909
  if (s5 === peg$FAILED) {
3134
2910
  s5 = input.charAt(peg$currPos);
3135
- if (peg$r17.test(s5)) peg$currPos++;
2911
+ if (s5 !== "" && !(peg$charCode = s5.charCodeAt(0), peg$charCode === 34)) peg$currPos++;
3136
2912
  else {
3137
2913
  s5 = peg$FAILED;
3138
2914
  if (peg$silentFails === 0) peg$fail(peg$e36);
3139
2915
  }
3140
2916
  }
2917
+ if (s5 === peg$FAILED) break;
2918
+ s4.push(s5);
3141
2919
  }
3142
2920
  s3 = input.substring(s3, peg$currPos);
3143
2921
  s4 = peg$parseHere();
@@ -3173,26 +2951,18 @@ function peg$parse(input, options) {
3173
2951
  s2 = peg$parseHere();
3174
2952
  s3 = peg$currPos;
3175
2953
  s4 = [];
3176
- s5 = peg$parseValuePart();
3177
- if (s5 === peg$FAILED) {
3178
- s5 = input.charAt(peg$currPos);
3179
- if (peg$r18.test(s5)) peg$currPos++;
3180
- else {
3181
- s5 = peg$FAILED;
3182
- if (peg$silentFails === 0) peg$fail(peg$e38);
3183
- }
3184
- }
3185
- while (s5 !== peg$FAILED) {
3186
- s4.push(s5);
2954
+ for (;;) {
3187
2955
  s5 = peg$parseValuePart();
3188
2956
  if (s5 === peg$FAILED) {
3189
2957
  s5 = input.charAt(peg$currPos);
3190
- if (peg$r18.test(s5)) peg$currPos++;
2958
+ if (s5 !== "" && !(peg$charCode = s5.charCodeAt(0), peg$charCode === 39)) peg$currPos++;
3191
2959
  else {
3192
2960
  s5 = peg$FAILED;
3193
2961
  if (peg$silentFails === 0) peg$fail(peg$e38);
3194
2962
  }
3195
2963
  }
2964
+ if (s5 === peg$FAILED) break;
2965
+ s4.push(s5);
3196
2966
  }
3197
2967
  s3 = input.substring(s3, peg$currPos);
3198
2968
  s4 = peg$parseHere();
@@ -3218,7 +2988,7 @@ function peg$parse(input, options) {
3218
2988
  if (s0 === peg$FAILED) {
3219
2989
  s0 = peg$currPos;
3220
2990
  s1 = input.charAt(peg$currPos);
3221
- if (peg$r19.test(s1)) peg$currPos++;
2991
+ if (peg$charCode = s1.charCodeAt(0), peg$charCode === 34 || peg$charCode === 39) peg$currPos++;
3222
2992
  else {
3223
2993
  s1 = peg$FAILED;
3224
2994
  if (peg$silentFails === 0) peg$fail(peg$e39);
@@ -3233,20 +3003,15 @@ function peg$parse(input, options) {
3233
3003
  s1 = peg$parseHere();
3234
3004
  s2 = peg$currPos;
3235
3005
  s3 = [];
3236
- s4 = input.charAt(peg$currPos);
3237
- if (peg$r20.test(s4)) peg$currPos++;
3238
- else {
3239
- s4 = peg$FAILED;
3240
- if (peg$silentFails === 0) peg$fail(peg$e40);
3241
- }
3242
- while (s4 !== peg$FAILED) {
3243
- s3.push(s4);
3006
+ for (;;) {
3244
3007
  s4 = input.charAt(peg$currPos);
3245
- if (peg$r20.test(s4)) peg$currPos++;
3008
+ if (s4 !== "" && !(peg$charCode = s4.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279 || peg$charCode === 62)) peg$currPos++;
3246
3009
  else {
3247
3010
  s4 = peg$FAILED;
3248
3011
  if (peg$silentFails === 0) peg$fail(peg$e40);
3249
3012
  }
3013
+ if (s4 === peg$FAILED) break;
3014
+ s3.push(s4);
3250
3015
  }
3251
3016
  s2 = input.substring(s2, peg$currPos);
3252
3017
  s3 = peg$parseHere();
@@ -3267,15 +3032,7 @@ function peg$parse(input, options) {
3267
3032
  if (s1 !== peg$FAILED) {
3268
3033
  s2 = peg$currPos;
3269
3034
  s3 = [];
3270
- if (input.charCodeAt(peg$currPos) === 92) {
3271
- s4 = peg$c4;
3272
- peg$currPos++;
3273
- } else {
3274
- s4 = peg$FAILED;
3275
- if (peg$silentFails === 0) peg$fail(peg$e6);
3276
- }
3277
- if (s4 !== peg$FAILED) while (s4 !== peg$FAILED) {
3278
- s3.push(s4);
3035
+ for (;;) {
3279
3036
  if (input.charCodeAt(peg$currPos) === 92) {
3280
3037
  s4 = peg$c4;
3281
3038
  peg$currPos++;
@@ -3283,8 +3040,10 @@ function peg$parse(input, options) {
3283
3040
  s4 = peg$FAILED;
3284
3041
  if (peg$silentFails === 0) peg$fail(peg$e6);
3285
3042
  }
3043
+ if (s4 === peg$FAILED) break;
3044
+ s3.push(s4);
3286
3045
  }
3287
- else s3 = peg$FAILED;
3046
+ if (s3.length < 1) s3 = peg$FAILED;
3288
3047
  if (s3 !== peg$FAILED) s2 = input.substring(s2, peg$currPos);
3289
3048
  else s2 = s3;
3290
3049
  if (s2 !== peg$FAILED) {
@@ -3295,7 +3054,7 @@ function peg$parse(input, options) {
3295
3054
  else s4 = peg$FAILED;
3296
3055
  if (s4 !== peg$FAILED) {
3297
3056
  s5 = input.charAt(peg$currPos);
3298
- if (peg$r1.test(s5)) peg$currPos++;
3057
+ if (peg$charCode = s5.charCodeAt(0), peg$charCode === 123 || peg$charCode === 125) peg$currPos++;
3299
3058
  else {
3300
3059
  s5 = peg$FAILED;
3301
3060
  if (peg$silentFails === 0) peg$fail(peg$e7);
@@ -3463,7 +3222,7 @@ function peg$parse(input, options) {
3463
3222
  }
3464
3223
  if (s6 === peg$FAILED) s6 = null;
3465
3224
  s7 = input.charAt(peg$currPos);
3466
- if (peg$r8.test(s7)) peg$currPos++;
3225
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
3467
3226
  else {
3468
3227
  s7 = peg$FAILED;
3469
3228
  if (peg$silentFails === 0) peg$fail(peg$e22);
@@ -3537,7 +3296,7 @@ function peg$parse(input, options) {
3537
3296
  s3 = peg$currPos;
3538
3297
  peg$silentFails++;
3539
3298
  s4 = input.charAt(peg$currPos);
3540
- if (peg$r5.test(s4)) peg$currPos++;
3299
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
3541
3300
  else {
3542
3301
  s4 = peg$FAILED;
3543
3302
  if (peg$silentFails === 0) peg$fail(peg$e17);
@@ -3588,17 +3347,17 @@ function peg$parse(input, options) {
3588
3347
  function peg$parse_() {
3589
3348
  let s0, s1;
3590
3349
  s0 = [];
3591
- s1 = peg$parse_c();
3592
- while (s1 !== peg$FAILED) {
3593
- s0.push(s1);
3350
+ for (;;) {
3594
3351
  s1 = peg$parse_c();
3352
+ if (s1 === peg$FAILED) break;
3353
+ s0.push(s1);
3595
3354
  }
3596
3355
  return s0;
3597
3356
  }
3598
3357
  function peg$parse_c() {
3599
3358
  let s0;
3600
3359
  s0 = input.charAt(peg$currPos);
3601
- if (peg$r21.test(s0)) peg$currPos++;
3360
+ if (peg$charCode = s0.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
3602
3361
  else {
3603
3362
  s0 = peg$FAILED;
3604
3363
  if (peg$silentFails === 0) peg$fail(peg$e41);
@@ -9600,10 +9359,14 @@ var CLOSERS$1 = /* @__PURE__ */ new Set([
9600
9359
  * After an operand, a `/` divides.
9601
9360
  */
9602
9361
  function tokenizerAt(src, start, goal, { onComment, afterOperand = false } = {}) {
9603
- const p = new SigilParser(onComment ? {
9362
+ const p = new SigilParser({
9604
9363
  ...OPTIONS,
9364
+ startLocation: {
9365
+ line: 1,
9366
+ column: 0
9367
+ },
9605
9368
  onComment
9606
- } : OPTIONS, src, start);
9369
+ }, src, start);
9607
9370
  if (goal === "expression") p.type = types$1.parenL;
9608
9371
  if (afterOperand) p.exprAllowed = false;
9609
9372
  return p;
@@ -12477,7 +12240,7 @@ function widgetDefinitions$1(passages, parametersOf = registeredParameters) {
12477
12240
  });
12478
12241
  }
12479
12242
  } else if (open.length > 0 && (token.type === "variable" && token.scope === "local" && token.name === "children" || tokenTextContainsChildren(token, parametersOf, passage.content, hooks, budget))) open[open.length - 1].isBlock = true;
12480
- done.push(...open);
12243
+ for (const def of open) done.push(def);
12481
12244
  const defs = [];
12482
12245
  for (const { token, isBlock, closeStart } of done) try {
12483
12246
  const [from, to] = nameSpan(token.rawArgs);
@@ -12492,7 +12255,8 @@ function widgetDefinitions$1(passages, parametersOf = registeredParameters) {
12492
12255
  ...closeStart === void 0 ? {} : { closeStart }
12493
12256
  });
12494
12257
  } catch {}
12495
- found.push(...defs.sort((a, b) => a.start - b.start));
12258
+ defs.sort((a, b) => a.start - b.start);
12259
+ for (const def of defs) found.push(def);
12496
12260
  }
12497
12261
  return found;
12498
12262
  };
@@ -14475,23 +14239,13 @@ function discoverMacros(source) {
14475
14239
  }
14476
14240
  return found;
14477
14241
  }
14242
+ // src/format/source-lines.ts
14243
+ /** Index a source once; locate zero-based lines without rescanning its prefixes. */
14244
+ function sourceLines(source) {
14245
+ const position = sourcePositions(source);
14246
+ return (offset) => position(offset).line - 1;
14247
+ }
14478
14248
  // src/format/segment.ts
14479
- var VOID_ELEMENTS = /* @__PURE__ */ new Set([
14480
- "area",
14481
- "base",
14482
- "br",
14483
- "col",
14484
- "embed",
14485
- "hr",
14486
- "img",
14487
- "input",
14488
- "link",
14489
- "meta",
14490
- "param",
14491
- "source",
14492
- "track",
14493
- "wbr"
14494
- ]);
14495
14249
  /**
14496
14250
  * Segment a passage body into regions: spindle (markdown/macros), html blocks, script blocks.
14497
14251
  */
@@ -14499,6 +14253,16 @@ function segmentRegions(body) {
14499
14253
  const lines = body.split("\n");
14500
14254
  if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
14501
14255
  if (lines.length === 0) return [];
14256
+ const tags = lines.map(() => []);
14257
+ const tagEndLines = lines.map((_, line) => line);
14258
+ const lineAt = sourceLines(body);
14259
+ for (const token of tokenizeMarkupTolerant$1(body).tokens) {
14260
+ if (token.type !== "html") continue;
14261
+ const line = lineAt(token.start);
14262
+ tags[line].push(token);
14263
+ tagEndLines[line] = Math.max(tagEndLines[line], lineAt(token.end - 1));
14264
+ }
14265
+ const depthOnLine = (line, name) => tags[line].reduce((depth, token) => token.tag.toLowerCase() === name && !token.isSelfClose ? depth + (token.isClose ? -1 : 1) : depth, 0);
14502
14266
  const regions = [];
14503
14267
  let i = 0;
14504
14268
  while (i < lines.length) {
@@ -14524,24 +14288,19 @@ function segmentRegions(body) {
14524
14288
  }
14525
14289
  if (/^<([a-zA-Z][\w-]*)/.test(trimmed)) {
14526
14290
  const tagName = trimmed.match(/^<([a-zA-Z][\w-]*)/)[1].toLowerCase();
14527
- if (VOID_ELEMENTS.has(tagName) && !lines[i + 1]?.trim().startsWith("<")) {
14528
- pushSpindleLine(regions, line);
14529
- i++;
14530
- continue;
14531
- }
14532
- if (new RegExp(`</${tagName}\\s*>`, "i").test(trimmed)) {
14291
+ let depth = depthOnLine(i, tagName);
14292
+ let endLine = tagEndLines[i];
14293
+ if (depth <= 0 && endLine === i) {
14533
14294
  pushSpindleLine(regions, line);
14534
14295
  i++;
14535
14296
  continue;
14536
14297
  }
14537
14298
  const htmlLines = [line];
14538
- let depth = 1;
14539
14299
  i++;
14540
- while (i < lines.length && depth > 0) {
14300
+ while (i < lines.length && (depth > 0 || i <= endLine)) {
14541
14301
  htmlLines.push(lines[i]);
14542
- const opens = (lines[i].match(new RegExp(`<${tagName}(?:[\\s>]|$)`, "gi")) ?? []).length;
14543
- const closes = (lines[i].match(new RegExp(`</${tagName}\\s*>`, "gi")) ?? []).length;
14544
- depth += opens - closes;
14302
+ endLine = Math.max(endLine, tagEndLines[i]);
14303
+ depth += depthOnLine(i, tagName);
14545
14304
  i++;
14546
14305
  }
14547
14306
  regions.push({
@@ -25418,12 +25177,6 @@ function unclosedHtml(text) {
25418
25177
  }
25419
25178
  } } };
25420
25179
  }
25421
- // src/format/source-lines.ts
25422
- /** Index a source once; locate zero-based lines without rescanning its prefixes. */
25423
- function sourceLines(source) {
25424
- const position = sourcePositions(source);
25425
- return (offset) => position(offset).line - 1;
25426
- }
25427
25180
  // src/format/markdown-lines.ts
25428
25181
  /** Source lines belonging to the given constructs in runtime Markdown documents. */
25429
25182
  function markdownLines(source, isBlock, types) {
@@ -25851,13 +25604,13 @@ async function formatLf(text, options) {
25851
25604
  if (region.type !== "spindle") region.lines = region.lines.map((l) => replaceAll(l, sentinel, "\n"));
25852
25605
  if (region.type === "script") {
25853
25606
  if (region.lines.length === 1) {
25854
- lines.push(...region.lines);
25607
+ for (const line of region.lines) lines.push(line);
25855
25608
  continue;
25856
25609
  }
25857
25610
  const innerCode = region.lines.slice(1, -1).join("\n");
25858
25611
  const formatted = await formatJS(innerCode.trim(), prettier, prettierOptions);
25859
25612
  if (formatted === void 0 || !sameSpindleTokens(innerCode, formatted)) {
25860
- lines.push(...region.lines);
25613
+ for (const line of region.lines) lines.push(line);
25861
25614
  continue;
25862
25615
  }
25863
25616
  lines.push(region.lines[0]);
@@ -25866,25 +25619,25 @@ async function formatLf(text, options) {
25866
25619
  continue;
25867
25620
  }
25868
25621
  if (region.type === "svg") {
25869
- lines.push(...region.lines);
25622
+ for (const line of region.lines) lines.push(line);
25870
25623
  continue;
25871
25624
  }
25872
25625
  if (region.type === "html") {
25873
25626
  const htmlText = region.lines.join("\n");
25874
25627
  if (WHITESPACE_AS_WRITTEN.test(htmlText) || region.lines.some((line) => literalLines.has(line.trim())) || hasMarkdownBoundaries(htmlText, isBlock)) {
25875
25628
  for (let i = 0; i < region.lines.length; i++) preservedLines.add(lines.length + i);
25876
- lines.push(...region.lines);
25629
+ for (const line of region.lines) lines.push(line);
25877
25630
  continue;
25878
25631
  }
25879
25632
  const { text: svgPlaceholdered, tokens: svgTokens } = replaceSvgBlocks(htmlText);
25880
25633
  if (!placeholdersIntact(svgPlaceholdered, svgTokens, SVG_PLACEHOLDERS)) {
25881
- lines.push(...region.lines);
25634
+ for (const line of region.lines) lines.push(line);
25882
25635
  continue;
25883
25636
  }
25884
25637
  const { text: placeholdered, tokens } = replaceSpindleTokens(svgPlaceholdered);
25885
25638
  const formatted = await formatHTML(placeholdered, prettier, prettierOptions);
25886
25639
  if (formatted === void 0 || !placeholdersIntact(formatted, tokens, SPINDLE_PLACEHOLDERS) || !placeholdersIntact(formatted, svgTokens, SVG_PLACEHOLDERS)) {
25887
- lines.push(...region.lines);
25640
+ for (const line of region.lines) lines.push(line);
25888
25641
  continue;
25889
25642
  }
25890
25643
  const restored = restoreHtmlTokens(formatted.trim(), tokens.map((t) => replaceAll(t, "\n", sentinel)), svgTokens);
@@ -26137,7 +25890,7 @@ function wrapLines(lines, maxLen, literalLines, isBlock) {
26137
25890
  continue;
26138
25891
  }
26139
25892
  if (line.endsWith(" ")) wrapped[wrapped.length - 1] += " ";
26140
- result.push(...wrapped);
25893
+ for (const line of wrapped) result.push(line);
26141
25894
  }
26142
25895
  return result;
26143
25896
  }