@player-ui/check-path-plugin 0.8.0-next.0 → 0.8.0-next.2
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/CheckPathPlugin.native.js +151 -3768
- package/dist/CheckPathPlugin.native.js.map +1 -1
- package/package.json +3 -3
|
@@ -453,8 +453,8 @@ var CheckPathPlugin = function() {
|
|
|
453
453
|
try {
|
|
454
454
|
for(var _iterator = Array.from(pairs)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
455
455
|
var entry = _step.value;
|
|
456
|
-
var _entry = _sliced_to_array(entry, 2),
|
|
457
|
-
if (dlv_es_default(searchObj,
|
|
456
|
+
var _entry = _sliced_to_array(entry, 2), path = _entry[0], value = _entry[1];
|
|
457
|
+
if (dlv_es_default(searchObj, path) !== value) {
|
|
458
458
|
return false;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
@@ -1030,17 +1030,17 @@ var CheckPathPlugin = function() {
|
|
|
1030
1030
|
break;
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
|
-
var
|
|
1034
|
-
if (Object.prototype.hasOwnProperty.call(literals,
|
|
1033
|
+
var identifier = expr.slice(start, index);
|
|
1034
|
+
if (Object.prototype.hasOwnProperty.call(literals, identifier)) {
|
|
1035
1035
|
return {
|
|
1036
1036
|
__id: ExpNodeOpaqueIdentifier,
|
|
1037
1037
|
type: "Literal",
|
|
1038
|
-
value: literals[
|
|
1039
|
-
raw:
|
|
1038
|
+
value: literals[identifier],
|
|
1039
|
+
raw: identifier,
|
|
1040
1040
|
location: getLocation(start)
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
|
-
if (
|
|
1043
|
+
if (identifier === thisStr) {
|
|
1044
1044
|
return {
|
|
1045
1045
|
__id: ExpNodeOpaqueIdentifier,
|
|
1046
1046
|
type: "ThisExpression",
|
|
@@ -1050,7 +1050,7 @@ var CheckPathPlugin = function() {
|
|
|
1050
1050
|
return {
|
|
1051
1051
|
__id: ExpNodeOpaqueIdentifier,
|
|
1052
1052
|
type: "Identifier",
|
|
1053
|
-
name:
|
|
1053
|
+
name: identifier,
|
|
1054
1054
|
location: getLocation(start)
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
@@ -1190,19 +1190,19 @@ var CheckPathPlugin = function() {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
|
|
1192
1192
|
};
|
|
1193
|
-
var
|
|
1193
|
+
var parse2 = function parse2(schema) {
|
|
1194
1194
|
var _loop = function() {
|
|
1195
1195
|
var next = parseQueue.shift();
|
|
1196
1196
|
if (!next) {
|
|
1197
1197
|
return "break";
|
|
1198
1198
|
}
|
|
1199
|
-
var node = next.node,
|
|
1199
|
+
var node = next.node, path = next.path, visited = next.visited;
|
|
1200
1200
|
Object.entries(node).forEach(function(param) {
|
|
1201
1201
|
var _param = _sliced_to_array(param, 2), prop = _param[0], type = _param[1];
|
|
1202
|
-
var
|
|
1202
|
+
var nestedPath = _to_consumable_array(path).concat([
|
|
1203
1203
|
prop
|
|
1204
1204
|
]);
|
|
1205
|
-
var nestedPathStr =
|
|
1205
|
+
var nestedPathStr = nestedPath.join(".");
|
|
1206
1206
|
if (expandedPaths.has(nestedPathStr)) {
|
|
1207
1207
|
throw new Error("Path has already been processed. There's either a loop somewhere or a bug");
|
|
1208
1208
|
}
|
|
@@ -1211,14 +1211,14 @@ var CheckPathPlugin = function() {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
expandedPaths.set(nestedPathStr, type);
|
|
1213
1213
|
if (type.isArray) {
|
|
1214
|
-
|
|
1214
|
+
nestedPath.push("[]");
|
|
1215
1215
|
}
|
|
1216
1216
|
if (type.isRecord) {
|
|
1217
|
-
|
|
1217
|
+
nestedPath.push("{}");
|
|
1218
1218
|
}
|
|
1219
1219
|
if (type.type && schema[type.type]) {
|
|
1220
1220
|
parseQueue.push({
|
|
1221
|
-
path:
|
|
1221
|
+
path: nestedPath,
|
|
1222
1222
|
node: schema[type.type],
|
|
1223
1223
|
visited: /* @__PURE__ */ new Set(_to_consumable_array(visited).concat([
|
|
1224
1224
|
type.type
|
|
@@ -1444,7 +1444,7 @@ var CheckPathPlugin = function() {
|
|
|
1444
1444
|
};
|
|
1445
1445
|
};
|
|
1446
1446
|
var objectToBatchSet = function objectToBatchSet(obj) {
|
|
1447
|
-
var flattenedObj =
|
|
1447
|
+
var flattenedObj = flatten(obj);
|
|
1448
1448
|
var batchTxn = [];
|
|
1449
1449
|
Object.keys(flattenedObj).forEach(function(key) {
|
|
1450
1450
|
batchTxn.push([
|
|
@@ -1644,3588 +1644,6 @@ var CheckPathPlugin = function() {
|
|
|
1644
1644
|
exports.toError = toError;
|
|
1645
1645
|
}
|
|
1646
1646
|
});
|
|
1647
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/arr-flatten@1.1.0/node_modules/arr-flatten/index.js
|
|
1648
|
-
var require_arr_flatten = __commonJS({
|
|
1649
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/arr-flatten@1.1.0/node_modules/arr-flatten/index.js": function(exports, module) {
|
|
1650
|
-
"use strict";
|
|
1651
|
-
module.exports = function(arr) {
|
|
1652
|
-
return flat(arr, []);
|
|
1653
|
-
};
|
|
1654
|
-
function flat(arr, res) {
|
|
1655
|
-
var i = 0, cur;
|
|
1656
|
-
var len = arr.length;
|
|
1657
|
-
for(; i < len; i++){
|
|
1658
|
-
cur = arr[i];
|
|
1659
|
-
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
|
|
1660
|
-
}
|
|
1661
|
-
return res;
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
});
|
|
1665
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/parsimmon@1.18.1/node_modules/parsimmon/src/parsimmon.js
|
|
1666
|
-
var require_parsimmon = __commonJS({
|
|
1667
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/parsimmon@1.18.1/node_modules/parsimmon/src/parsimmon.js": function(exports, module) {
|
|
1668
|
-
"use strict";
|
|
1669
|
-
function Parsimmon(action) {
|
|
1670
|
-
if (!_instanceof(this, Parsimmon)) {
|
|
1671
|
-
return new Parsimmon(action);
|
|
1672
|
-
}
|
|
1673
|
-
this._ = action;
|
|
1674
|
-
}
|
|
1675
|
-
var _ = Parsimmon.prototype;
|
|
1676
|
-
function times(n, f) {
|
|
1677
|
-
var i = 0;
|
|
1678
|
-
for(i; i < n; i++){
|
|
1679
|
-
f(i);
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
function forEach(f, arr) {
|
|
1683
|
-
times(arr.length, function(i) {
|
|
1684
|
-
f(arr[i], i, arr);
|
|
1685
|
-
});
|
|
1686
|
-
}
|
|
1687
|
-
function reduce(f, seed, arr) {
|
|
1688
|
-
forEach(function(elem, i, arr2) {
|
|
1689
|
-
seed = f(seed, elem, i, arr2);
|
|
1690
|
-
}, arr);
|
|
1691
|
-
return seed;
|
|
1692
|
-
}
|
|
1693
|
-
function map(f, arr) {
|
|
1694
|
-
return reduce(function(acc, elem, i, a) {
|
|
1695
|
-
return acc.concat([
|
|
1696
|
-
f(elem, i, a)
|
|
1697
|
-
]);
|
|
1698
|
-
}, [], arr);
|
|
1699
|
-
}
|
|
1700
|
-
function lshiftBuffer(input) {
|
|
1701
|
-
var asTwoBytes = reduce(function(a, v, i, b) {
|
|
1702
|
-
return a.concat(i === b.length - 1 ? Buffer.from([
|
|
1703
|
-
v,
|
|
1704
|
-
0
|
|
1705
|
-
]).readUInt16BE(0) : b.readUInt16BE(i));
|
|
1706
|
-
}, [], input);
|
|
1707
|
-
return Buffer.from(map(function(x) {
|
|
1708
|
-
return (x << 1 & 65535) >> 8;
|
|
1709
|
-
}, asTwoBytes));
|
|
1710
|
-
}
|
|
1711
|
-
function consumeBitsFromBuffer(n, input) {
|
|
1712
|
-
var state = {
|
|
1713
|
-
v: 0,
|
|
1714
|
-
buf: input
|
|
1715
|
-
};
|
|
1716
|
-
times(n, function() {
|
|
1717
|
-
state = {
|
|
1718
|
-
v: state.v << 1 | bitPeekBuffer(state.buf),
|
|
1719
|
-
buf: lshiftBuffer(state.buf)
|
|
1720
|
-
};
|
|
1721
|
-
});
|
|
1722
|
-
return state;
|
|
1723
|
-
}
|
|
1724
|
-
function bitPeekBuffer(input) {
|
|
1725
|
-
return input[0] >> 7;
|
|
1726
|
-
}
|
|
1727
|
-
function sum(numArr) {
|
|
1728
|
-
return reduce(function(x, y) {
|
|
1729
|
-
return x + y;
|
|
1730
|
-
}, 0, numArr);
|
|
1731
|
-
}
|
|
1732
|
-
function find2(pred, arr) {
|
|
1733
|
-
return reduce(function(found, elem) {
|
|
1734
|
-
return found || (pred(elem) ? elem : found);
|
|
1735
|
-
}, null, arr);
|
|
1736
|
-
}
|
|
1737
|
-
function bufferExists() {
|
|
1738
|
-
return typeof Buffer !== "undefined";
|
|
1739
|
-
}
|
|
1740
|
-
function setExists() {
|
|
1741
|
-
if (Parsimmon._supportsSet !== void 0) {
|
|
1742
|
-
return Parsimmon._supportsSet;
|
|
1743
|
-
}
|
|
1744
|
-
var exists = typeof Set !== "undefined";
|
|
1745
|
-
Parsimmon._supportsSet = exists;
|
|
1746
|
-
return exists;
|
|
1747
|
-
}
|
|
1748
|
-
function ensureBuffer() {
|
|
1749
|
-
if (!bufferExists()) {
|
|
1750
|
-
throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.");
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
function bitSeq(alignments) {
|
|
1754
|
-
ensureBuffer();
|
|
1755
|
-
var totalBits = sum(alignments);
|
|
1756
|
-
if (totalBits % 8 !== 0) {
|
|
1757
|
-
throw new Error("The bits [" + alignments.join(", ") + "] add up to " + totalBits + " which is not an even number of bytes; the total should be divisible by 8");
|
|
1758
|
-
}
|
|
1759
|
-
var bytes = totalBits / 8;
|
|
1760
|
-
var tooBigRange = find2(function(x) {
|
|
1761
|
-
return x > 48;
|
|
1762
|
-
}, alignments);
|
|
1763
|
-
if (tooBigRange) {
|
|
1764
|
-
throw new Error(tooBigRange + " bit range requested exceeds 48 bit (6 byte) Number max.");
|
|
1765
|
-
}
|
|
1766
|
-
return new Parsimmon(function(input, i) {
|
|
1767
|
-
var newPos = bytes + i;
|
|
1768
|
-
if (newPos > input.length) {
|
|
1769
|
-
return makeFailure(i, bytes.toString() + " bytes");
|
|
1770
|
-
}
|
|
1771
|
-
return makeSuccess(newPos, reduce(function(acc, bits) {
|
|
1772
|
-
var state = consumeBitsFromBuffer(bits, acc.buf);
|
|
1773
|
-
return {
|
|
1774
|
-
coll: acc.coll.concat(state.v),
|
|
1775
|
-
buf: state.buf
|
|
1776
|
-
};
|
|
1777
|
-
}, {
|
|
1778
|
-
coll: [],
|
|
1779
|
-
buf: input.slice(i, newPos)
|
|
1780
|
-
}, alignments).coll);
|
|
1781
|
-
});
|
|
1782
|
-
}
|
|
1783
|
-
function bitSeqObj(namedAlignments) {
|
|
1784
|
-
ensureBuffer();
|
|
1785
|
-
var seenKeys = {};
|
|
1786
|
-
var totalKeys = 0;
|
|
1787
|
-
var fullAlignments = map(function(item) {
|
|
1788
|
-
if (isArray(item)) {
|
|
1789
|
-
var pair = item;
|
|
1790
|
-
if (pair.length !== 2) {
|
|
1791
|
-
throw new Error("[" + pair.join(", ") + "] should be length 2, got length " + pair.length);
|
|
1792
|
-
}
|
|
1793
|
-
assertString(pair[0]);
|
|
1794
|
-
assertNumber(pair[1]);
|
|
1795
|
-
if (Object.prototype.hasOwnProperty.call(seenKeys, pair[0])) {
|
|
1796
|
-
throw new Error("duplicate key in bitSeqObj: " + pair[0]);
|
|
1797
|
-
}
|
|
1798
|
-
seenKeys[pair[0]] = true;
|
|
1799
|
-
totalKeys++;
|
|
1800
|
-
return pair;
|
|
1801
|
-
} else {
|
|
1802
|
-
assertNumber(item);
|
|
1803
|
-
return [
|
|
1804
|
-
null,
|
|
1805
|
-
item
|
|
1806
|
-
];
|
|
1807
|
-
}
|
|
1808
|
-
}, namedAlignments);
|
|
1809
|
-
if (totalKeys < 1) {
|
|
1810
|
-
throw new Error("bitSeqObj expects at least one named pair, got [" + namedAlignments.join(", ") + "]");
|
|
1811
|
-
}
|
|
1812
|
-
var namesOnly = map(function(pair) {
|
|
1813
|
-
return pair[0];
|
|
1814
|
-
}, fullAlignments);
|
|
1815
|
-
var alignmentsOnly = map(function(pair) {
|
|
1816
|
-
return pair[1];
|
|
1817
|
-
}, fullAlignments);
|
|
1818
|
-
return bitSeq(alignmentsOnly).map(function(parsed) {
|
|
1819
|
-
var namedParsed = map(function(name, i) {
|
|
1820
|
-
return [
|
|
1821
|
-
name,
|
|
1822
|
-
parsed[i]
|
|
1823
|
-
];
|
|
1824
|
-
}, namesOnly);
|
|
1825
|
-
return reduce(function(obj, kv) {
|
|
1826
|
-
if (kv[0] !== null) {
|
|
1827
|
-
obj[kv[0]] = kv[1];
|
|
1828
|
-
}
|
|
1829
|
-
return obj;
|
|
1830
|
-
}, {}, namedParsed);
|
|
1831
|
-
});
|
|
1832
|
-
}
|
|
1833
|
-
function parseBufferFor(other, length) {
|
|
1834
|
-
return new Parsimmon(function(input, i) {
|
|
1835
|
-
ensureBuffer();
|
|
1836
|
-
if (i + length > input.length) {
|
|
1837
|
-
return makeFailure(i, length + " bytes for " + other);
|
|
1838
|
-
}
|
|
1839
|
-
return makeSuccess(i + length, input.slice(i, i + length));
|
|
1840
|
-
});
|
|
1841
|
-
}
|
|
1842
|
-
function parseBuffer(length) {
|
|
1843
|
-
return parseBufferFor("buffer", length).map(function(unsafe) {
|
|
1844
|
-
return Buffer.from(unsafe);
|
|
1845
|
-
});
|
|
1846
|
-
}
|
|
1847
|
-
function encodedString(encoding, length) {
|
|
1848
|
-
return parseBufferFor("string", length).map(function(buff) {
|
|
1849
|
-
return buff.toString(encoding);
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
|
-
function isInteger(value) {
|
|
1853
|
-
return typeof value === "number" && Math.floor(value) === value;
|
|
1854
|
-
}
|
|
1855
|
-
function assertValidIntegerByteLengthFor(who, length) {
|
|
1856
|
-
if (!isInteger(length) || length < 0 || length > 6) {
|
|
1857
|
-
throw new Error(who + " requires integer length in range [0, 6].");
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
function uintBE(length) {
|
|
1861
|
-
assertValidIntegerByteLengthFor("uintBE", length);
|
|
1862
|
-
return parseBufferFor("uintBE(" + length + ")", length).map(function(buff) {
|
|
1863
|
-
return buff.readUIntBE(0, length);
|
|
1864
|
-
});
|
|
1865
|
-
}
|
|
1866
|
-
function uintLE(length) {
|
|
1867
|
-
assertValidIntegerByteLengthFor("uintLE", length);
|
|
1868
|
-
return parseBufferFor("uintLE(" + length + ")", length).map(function(buff) {
|
|
1869
|
-
return buff.readUIntLE(0, length);
|
|
1870
|
-
});
|
|
1871
|
-
}
|
|
1872
|
-
function intBE(length) {
|
|
1873
|
-
assertValidIntegerByteLengthFor("intBE", length);
|
|
1874
|
-
return parseBufferFor("intBE(" + length + ")", length).map(function(buff) {
|
|
1875
|
-
return buff.readIntBE(0, length);
|
|
1876
|
-
});
|
|
1877
|
-
}
|
|
1878
|
-
function intLE(length) {
|
|
1879
|
-
assertValidIntegerByteLengthFor("intLE", length);
|
|
1880
|
-
return parseBufferFor("intLE(" + length + ")", length).map(function(buff) {
|
|
1881
|
-
return buff.readIntLE(0, length);
|
|
1882
|
-
});
|
|
1883
|
-
}
|
|
1884
|
-
function floatBE() {
|
|
1885
|
-
return parseBufferFor("floatBE", 4).map(function(buff) {
|
|
1886
|
-
return buff.readFloatBE(0);
|
|
1887
|
-
});
|
|
1888
|
-
}
|
|
1889
|
-
function floatLE() {
|
|
1890
|
-
return parseBufferFor("floatLE", 4).map(function(buff) {
|
|
1891
|
-
return buff.readFloatLE(0);
|
|
1892
|
-
});
|
|
1893
|
-
}
|
|
1894
|
-
function doubleBE() {
|
|
1895
|
-
return parseBufferFor("doubleBE", 8).map(function(buff) {
|
|
1896
|
-
return buff.readDoubleBE(0);
|
|
1897
|
-
});
|
|
1898
|
-
}
|
|
1899
|
-
function doubleLE() {
|
|
1900
|
-
return parseBufferFor("doubleLE", 8).map(function(buff) {
|
|
1901
|
-
return buff.readDoubleLE(0);
|
|
1902
|
-
});
|
|
1903
|
-
}
|
|
1904
|
-
function toArray(arrLike) {
|
|
1905
|
-
return Array.prototype.slice.call(arrLike);
|
|
1906
|
-
}
|
|
1907
|
-
function isParser(obj) {
|
|
1908
|
-
return _instanceof(obj, Parsimmon);
|
|
1909
|
-
}
|
|
1910
|
-
function isArray(x) {
|
|
1911
|
-
return ({}).toString.call(x) === "[object Array]";
|
|
1912
|
-
}
|
|
1913
|
-
function isBuffer(x) {
|
|
1914
|
-
return bufferExists() && Buffer.isBuffer(x);
|
|
1915
|
-
}
|
|
1916
|
-
function makeSuccess(index2, value) {
|
|
1917
|
-
return {
|
|
1918
|
-
status: true,
|
|
1919
|
-
index: index2,
|
|
1920
|
-
value: value,
|
|
1921
|
-
furthest: -1,
|
|
1922
|
-
expected: []
|
|
1923
|
-
};
|
|
1924
|
-
}
|
|
1925
|
-
function makeFailure(index2, expected) {
|
|
1926
|
-
if (!isArray(expected)) {
|
|
1927
|
-
expected = [
|
|
1928
|
-
expected
|
|
1929
|
-
];
|
|
1930
|
-
}
|
|
1931
|
-
return {
|
|
1932
|
-
status: false,
|
|
1933
|
-
index: -1,
|
|
1934
|
-
value: null,
|
|
1935
|
-
furthest: index2,
|
|
1936
|
-
expected: expected
|
|
1937
|
-
};
|
|
1938
|
-
}
|
|
1939
|
-
function mergeReplies(result, last) {
|
|
1940
|
-
if (!last) {
|
|
1941
|
-
return result;
|
|
1942
|
-
}
|
|
1943
|
-
if (result.furthest > last.furthest) {
|
|
1944
|
-
return result;
|
|
1945
|
-
}
|
|
1946
|
-
var expected = result.furthest === last.furthest ? union(result.expected, last.expected) : last.expected;
|
|
1947
|
-
return {
|
|
1948
|
-
status: result.status,
|
|
1949
|
-
index: result.index,
|
|
1950
|
-
value: result.value,
|
|
1951
|
-
furthest: last.furthest,
|
|
1952
|
-
expected: expected
|
|
1953
|
-
};
|
|
1954
|
-
}
|
|
1955
|
-
var lineColumnIndex = {};
|
|
1956
|
-
function makeLineColumnIndex(input, i) {
|
|
1957
|
-
if (isBuffer(input)) {
|
|
1958
|
-
return {
|
|
1959
|
-
offset: i,
|
|
1960
|
-
line: -1,
|
|
1961
|
-
column: -1
|
|
1962
|
-
};
|
|
1963
|
-
}
|
|
1964
|
-
if (!(input in lineColumnIndex)) {
|
|
1965
|
-
lineColumnIndex[input] = {};
|
|
1966
|
-
}
|
|
1967
|
-
var inputIndex = lineColumnIndex[input];
|
|
1968
|
-
var prevLine = 0;
|
|
1969
|
-
var newLines = 0;
|
|
1970
|
-
var lineStart = 0;
|
|
1971
|
-
var j = i;
|
|
1972
|
-
while(j >= 0){
|
|
1973
|
-
if (j in inputIndex) {
|
|
1974
|
-
prevLine = inputIndex[j].line;
|
|
1975
|
-
if (lineStart === 0) {
|
|
1976
|
-
lineStart = inputIndex[j].lineStart;
|
|
1977
|
-
}
|
|
1978
|
-
break;
|
|
1979
|
-
}
|
|
1980
|
-
if (// Unix LF (\n) or Windows CRLF (\r\n) line ending
|
|
1981
|
-
input.charAt(j) === "\n" || // Old Mac CR (\r) line ending
|
|
1982
|
-
input.charAt(j) === "\r" && input.charAt(j + 1) !== "\n") {
|
|
1983
|
-
newLines++;
|
|
1984
|
-
if (lineStart === 0) {
|
|
1985
|
-
lineStart = j + 1;
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
j--;
|
|
1989
|
-
}
|
|
1990
|
-
var lineWeAreUpTo = prevLine + newLines;
|
|
1991
|
-
var columnWeAreUpTo = i - lineStart;
|
|
1992
|
-
inputIndex[i] = {
|
|
1993
|
-
line: lineWeAreUpTo,
|
|
1994
|
-
lineStart: lineStart
|
|
1995
|
-
};
|
|
1996
|
-
return {
|
|
1997
|
-
offset: i,
|
|
1998
|
-
line: lineWeAreUpTo + 1,
|
|
1999
|
-
column: columnWeAreUpTo + 1
|
|
2000
|
-
};
|
|
2001
|
-
}
|
|
2002
|
-
function union(xs, ys) {
|
|
2003
|
-
if (setExists() && Array.from) {
|
|
2004
|
-
var set2 = new Set(xs);
|
|
2005
|
-
for(var y = 0; y < ys.length; y++){
|
|
2006
|
-
set2.add(ys[y]);
|
|
2007
|
-
}
|
|
2008
|
-
var arr = Array.from(set2);
|
|
2009
|
-
arr.sort();
|
|
2010
|
-
return arr;
|
|
2011
|
-
}
|
|
2012
|
-
var obj = {};
|
|
2013
|
-
for(var i = 0; i < xs.length; i++){
|
|
2014
|
-
obj[xs[i]] = true;
|
|
2015
|
-
}
|
|
2016
|
-
for(var j = 0; j < ys.length; j++){
|
|
2017
|
-
obj[ys[j]] = true;
|
|
2018
|
-
}
|
|
2019
|
-
var keys = [];
|
|
2020
|
-
for(var k in obj){
|
|
2021
|
-
if (({}).hasOwnProperty.call(obj, k)) {
|
|
2022
|
-
keys.push(k);
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
keys.sort();
|
|
2026
|
-
return keys;
|
|
2027
|
-
}
|
|
2028
|
-
function assertParser(p) {
|
|
2029
|
-
if (!isParser(p)) {
|
|
2030
|
-
throw new Error("not a parser: " + p);
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
function get(input, i) {
|
|
2034
|
-
if (typeof input === "string") {
|
|
2035
|
-
return input.charAt(i);
|
|
2036
|
-
}
|
|
2037
|
-
return input[i];
|
|
2038
|
-
}
|
|
2039
|
-
function assertArray(x) {
|
|
2040
|
-
if (!isArray(x)) {
|
|
2041
|
-
throw new Error("not an array: " + x);
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
function assertNumber(x) {
|
|
2045
|
-
if (typeof x !== "number") {
|
|
2046
|
-
throw new Error("not a number: " + x);
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
function assertRegexp(x) {
|
|
2050
|
-
if (!_instanceof(x, RegExp)) {
|
|
2051
|
-
throw new Error("not a regexp: " + x);
|
|
2052
|
-
}
|
|
2053
|
-
var f = flags(x);
|
|
2054
|
-
for(var i = 0; i < f.length; i++){
|
|
2055
|
-
var c = f.charAt(i);
|
|
2056
|
-
if (c !== "i" && c !== "m" && c !== "u" && c !== "s") {
|
|
2057
|
-
throw new Error('unsupported regexp flag "' + c + '": ' + x);
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
function assertFunction(x) {
|
|
2062
|
-
if (typeof x !== "function") {
|
|
2063
|
-
throw new Error("not a function: " + x);
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
function assertString(x) {
|
|
2067
|
-
if (typeof x !== "string") {
|
|
2068
|
-
throw new Error("not a string: " + x);
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
var linesBeforeStringError = 2;
|
|
2072
|
-
var linesAfterStringError = 3;
|
|
2073
|
-
var bytesPerLine = 8;
|
|
2074
|
-
var bytesBefore = bytesPerLine * 5;
|
|
2075
|
-
var bytesAfter = bytesPerLine * 4;
|
|
2076
|
-
var defaultLinePrefix = " ";
|
|
2077
|
-
function repeat(string2, amount) {
|
|
2078
|
-
return new Array(amount + 1).join(string2);
|
|
2079
|
-
}
|
|
2080
|
-
function formatExpected(expected) {
|
|
2081
|
-
if (expected.length === 1) {
|
|
2082
|
-
return "Expected:\n\n" + expected[0];
|
|
2083
|
-
}
|
|
2084
|
-
return "Expected one of the following: \n\n" + expected.join(", ");
|
|
2085
|
-
}
|
|
2086
|
-
function leftPad(str, pad, char) {
|
|
2087
|
-
var add = pad - str.length;
|
|
2088
|
-
if (add <= 0) {
|
|
2089
|
-
return str;
|
|
2090
|
-
}
|
|
2091
|
-
return repeat(char, add) + str;
|
|
2092
|
-
}
|
|
2093
|
-
function toChunks(arr, chunkSize) {
|
|
2094
|
-
var length = arr.length;
|
|
2095
|
-
var chunks = [];
|
|
2096
|
-
var chunkIndex = 0;
|
|
2097
|
-
if (length <= chunkSize) {
|
|
2098
|
-
return [
|
|
2099
|
-
arr.slice()
|
|
2100
|
-
];
|
|
2101
|
-
}
|
|
2102
|
-
for(var i = 0; i < length; i++){
|
|
2103
|
-
if (!chunks[chunkIndex]) {
|
|
2104
|
-
chunks.push([]);
|
|
2105
|
-
}
|
|
2106
|
-
chunks[chunkIndex].push(arr[i]);
|
|
2107
|
-
if ((i + 1) % chunkSize === 0) {
|
|
2108
|
-
chunkIndex++;
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
return chunks;
|
|
2112
|
-
}
|
|
2113
|
-
function rangeFromIndexAndOffsets(i, before, after, length) {
|
|
2114
|
-
return {
|
|
2115
|
-
// Guard against the negative upper bound for lines included in the output.
|
|
2116
|
-
from: i - before > 0 ? i - before : 0,
|
|
2117
|
-
to: i + after > length ? length : i + after
|
|
2118
|
-
};
|
|
2119
|
-
}
|
|
2120
|
-
function byteRangeToRange(byteRange) {
|
|
2121
|
-
if (byteRange.from === 0 && byteRange.to === 1) {
|
|
2122
|
-
return {
|
|
2123
|
-
from: byteRange.from,
|
|
2124
|
-
to: byteRange.to
|
|
2125
|
-
};
|
|
2126
|
-
}
|
|
2127
|
-
return {
|
|
2128
|
-
from: byteRange.from / bytesPerLine,
|
|
2129
|
-
// Round `to`, so we don't get float if the amount of bytes is not divisible by `bytesPerLine`
|
|
2130
|
-
to: Math.floor(byteRange.to / bytesPerLine)
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
function formatGot(input, error) {
|
|
2134
|
-
var index2 = error.index;
|
|
2135
|
-
var i = index2.offset;
|
|
2136
|
-
var verticalMarkerLength = 1;
|
|
2137
|
-
var column;
|
|
2138
|
-
var lineWithErrorIndex;
|
|
2139
|
-
var lines;
|
|
2140
|
-
var lineRange;
|
|
2141
|
-
var lastLineNumberLabelLength;
|
|
2142
|
-
if (i === input.length) {
|
|
2143
|
-
return "Got the end of the input";
|
|
2144
|
-
}
|
|
2145
|
-
if (isBuffer(input)) {
|
|
2146
|
-
var byteLineWithErrorIndex = i - i % bytesPerLine;
|
|
2147
|
-
var columnByteIndex = i - byteLineWithErrorIndex;
|
|
2148
|
-
var byteRange = rangeFromIndexAndOffsets(byteLineWithErrorIndex, bytesBefore, bytesAfter + bytesPerLine, input.length);
|
|
2149
|
-
var bytes = input.slice(byteRange.from, byteRange.to);
|
|
2150
|
-
var bytesInChunks = toChunks(bytes.toJSON().data, bytesPerLine);
|
|
2151
|
-
var byteLines = map(function(byteRow) {
|
|
2152
|
-
return map(function(byteValue) {
|
|
2153
|
-
return leftPad(byteValue.toString(16), 2, "0");
|
|
2154
|
-
}, byteRow);
|
|
2155
|
-
}, bytesInChunks);
|
|
2156
|
-
lineRange = byteRangeToRange(byteRange);
|
|
2157
|
-
lineWithErrorIndex = byteLineWithErrorIndex / bytesPerLine;
|
|
2158
|
-
column = columnByteIndex * 3;
|
|
2159
|
-
if (columnByteIndex >= 4) {
|
|
2160
|
-
column += 1;
|
|
2161
|
-
}
|
|
2162
|
-
verticalMarkerLength = 2;
|
|
2163
|
-
lines = map(function(byteLine) {
|
|
2164
|
-
return byteLine.length <= 4 ? byteLine.join(" ") : byteLine.slice(0, 4).join(" ") + " " + byteLine.slice(4).join(" ");
|
|
2165
|
-
}, byteLines);
|
|
2166
|
-
lastLineNumberLabelLength = ((lineRange.to > 0 ? lineRange.to - 1 : lineRange.to) * 8).toString(16).length;
|
|
2167
|
-
if (lastLineNumberLabelLength < 2) {
|
|
2168
|
-
lastLineNumberLabelLength = 2;
|
|
2169
|
-
}
|
|
2170
|
-
} else {
|
|
2171
|
-
var inputLines = input.split(/\r\n|[\n\r\u2028\u2029]/);
|
|
2172
|
-
column = index2.column - 1;
|
|
2173
|
-
lineWithErrorIndex = index2.line - 1;
|
|
2174
|
-
lineRange = rangeFromIndexAndOffsets(lineWithErrorIndex, linesBeforeStringError, linesAfterStringError, inputLines.length);
|
|
2175
|
-
lines = inputLines.slice(lineRange.from, lineRange.to);
|
|
2176
|
-
lastLineNumberLabelLength = lineRange.to.toString().length;
|
|
2177
|
-
}
|
|
2178
|
-
var lineWithErrorCurrentIndex = lineWithErrorIndex - lineRange.from;
|
|
2179
|
-
if (isBuffer(input)) {
|
|
2180
|
-
lastLineNumberLabelLength = ((lineRange.to > 0 ? lineRange.to - 1 : lineRange.to) * 8).toString(16).length;
|
|
2181
|
-
if (lastLineNumberLabelLength < 2) {
|
|
2182
|
-
lastLineNumberLabelLength = 2;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
var linesWithLineNumbers = reduce(function(acc, lineSource, index3) {
|
|
2186
|
-
var isLineWithError = index3 === lineWithErrorCurrentIndex;
|
|
2187
|
-
var prefix = isLineWithError ? "> " : defaultLinePrefix;
|
|
2188
|
-
var lineNumberLabel;
|
|
2189
|
-
if (isBuffer(input)) {
|
|
2190
|
-
lineNumberLabel = leftPad(((lineRange.from + index3) * 8).toString(16), lastLineNumberLabelLength, "0");
|
|
2191
|
-
} else {
|
|
2192
|
-
lineNumberLabel = leftPad((lineRange.from + index3 + 1).toString(), lastLineNumberLabelLength, " ");
|
|
2193
|
-
}
|
|
2194
|
-
return [].concat(acc, [
|
|
2195
|
-
prefix + lineNumberLabel + " | " + lineSource
|
|
2196
|
-
], isLineWithError ? [
|
|
2197
|
-
defaultLinePrefix + repeat(" ", lastLineNumberLabelLength) + " | " + leftPad("", column, " ") + repeat("^", verticalMarkerLength)
|
|
2198
|
-
] : []);
|
|
2199
|
-
}, [], lines);
|
|
2200
|
-
return linesWithLineNumbers.join("\n");
|
|
2201
|
-
}
|
|
2202
|
-
function formatError(input, error) {
|
|
2203
|
-
return [
|
|
2204
|
-
"\n",
|
|
2205
|
-
"-- PARSING FAILED " + repeat("-", 50),
|
|
2206
|
-
"\n\n",
|
|
2207
|
-
formatGot(input, error),
|
|
2208
|
-
"\n\n",
|
|
2209
|
-
formatExpected(error.expected),
|
|
2210
|
-
"\n"
|
|
2211
|
-
].join("");
|
|
2212
|
-
}
|
|
2213
|
-
function flags(re) {
|
|
2214
|
-
if (re.flags !== void 0) {
|
|
2215
|
-
return re.flags;
|
|
2216
|
-
}
|
|
2217
|
-
return [
|
|
2218
|
-
re.global ? "g" : "",
|
|
2219
|
-
re.ignoreCase ? "i" : "",
|
|
2220
|
-
re.multiline ? "m" : "",
|
|
2221
|
-
re.unicode ? "u" : "",
|
|
2222
|
-
re.sticky ? "y" : ""
|
|
2223
|
-
].join("");
|
|
2224
|
-
}
|
|
2225
|
-
function anchoredRegexp(re) {
|
|
2226
|
-
return RegExp("^(?:" + re.source + ")", flags(re));
|
|
2227
|
-
}
|
|
2228
|
-
function seq() {
|
|
2229
|
-
var parsers = [].slice.call(arguments);
|
|
2230
|
-
var numParsers = parsers.length;
|
|
2231
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
2232
|
-
assertParser(parsers[j]);
|
|
2233
|
-
}
|
|
2234
|
-
return Parsimmon(function(input, i) {
|
|
2235
|
-
var result;
|
|
2236
|
-
var accum = new Array(numParsers);
|
|
2237
|
-
for(var j2 = 0; j2 < numParsers; j2 += 1){
|
|
2238
|
-
result = mergeReplies(parsers[j2]._(input, i), result);
|
|
2239
|
-
if (!result.status) {
|
|
2240
|
-
return result;
|
|
2241
|
-
}
|
|
2242
|
-
accum[j2] = result.value;
|
|
2243
|
-
i = result.index;
|
|
2244
|
-
}
|
|
2245
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
function seqObj() {
|
|
2249
|
-
var seenKeys = {};
|
|
2250
|
-
var totalKeys = 0;
|
|
2251
|
-
var parsers = toArray(arguments);
|
|
2252
|
-
var numParsers = parsers.length;
|
|
2253
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
2254
|
-
var p = parsers[j];
|
|
2255
|
-
if (isParser(p)) {
|
|
2256
|
-
continue;
|
|
2257
|
-
}
|
|
2258
|
-
if (isArray(p)) {
|
|
2259
|
-
var isWellFormed = p.length === 2 && typeof p[0] === "string" && isParser(p[1]);
|
|
2260
|
-
if (isWellFormed) {
|
|
2261
|
-
var key = p[0];
|
|
2262
|
-
if (Object.prototype.hasOwnProperty.call(seenKeys, key)) {
|
|
2263
|
-
throw new Error("seqObj: duplicate key " + key);
|
|
2264
|
-
}
|
|
2265
|
-
seenKeys[key] = true;
|
|
2266
|
-
totalKeys++;
|
|
2267
|
-
continue;
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.");
|
|
2271
|
-
}
|
|
2272
|
-
if (totalKeys === 0) {
|
|
2273
|
-
throw new Error("seqObj expects at least one named parser, found zero");
|
|
2274
|
-
}
|
|
2275
|
-
return Parsimmon(function(input, i) {
|
|
2276
|
-
var result;
|
|
2277
|
-
var accum = {};
|
|
2278
|
-
for(var j2 = 0; j2 < numParsers; j2 += 1){
|
|
2279
|
-
var name;
|
|
2280
|
-
var parser2;
|
|
2281
|
-
if (isArray(parsers[j2])) {
|
|
2282
|
-
name = parsers[j2][0];
|
|
2283
|
-
parser2 = parsers[j2][1];
|
|
2284
|
-
} else {
|
|
2285
|
-
name = null;
|
|
2286
|
-
parser2 = parsers[j2];
|
|
2287
|
-
}
|
|
2288
|
-
result = mergeReplies(parser2._(input, i), result);
|
|
2289
|
-
if (!result.status) {
|
|
2290
|
-
return result;
|
|
2291
|
-
}
|
|
2292
|
-
if (name) {
|
|
2293
|
-
accum[name] = result.value;
|
|
2294
|
-
}
|
|
2295
|
-
i = result.index;
|
|
2296
|
-
}
|
|
2297
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
2298
|
-
});
|
|
2299
|
-
}
|
|
2300
|
-
function seqMap() {
|
|
2301
|
-
var args = [].slice.call(arguments);
|
|
2302
|
-
if (args.length === 0) {
|
|
2303
|
-
throw new Error("seqMap needs at least one argument");
|
|
2304
|
-
}
|
|
2305
|
-
var mapper = args.pop();
|
|
2306
|
-
assertFunction(mapper);
|
|
2307
|
-
return seq.apply(null, args).map(function(results) {
|
|
2308
|
-
return mapper.apply(null, results);
|
|
2309
|
-
});
|
|
2310
|
-
}
|
|
2311
|
-
function createLanguage(parsers) {
|
|
2312
|
-
var language = {};
|
|
2313
|
-
for(var key in parsers){
|
|
2314
|
-
if (({}).hasOwnProperty.call(parsers, key)) {
|
|
2315
|
-
(function(key2) {
|
|
2316
|
-
var func = function func() {
|
|
2317
|
-
return parsers[key2](language);
|
|
2318
|
-
};
|
|
2319
|
-
language[key2] = lazy(func);
|
|
2320
|
-
})(key);
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
return language;
|
|
2324
|
-
}
|
|
2325
|
-
function alt() {
|
|
2326
|
-
var parsers = [].slice.call(arguments);
|
|
2327
|
-
var numParsers = parsers.length;
|
|
2328
|
-
if (numParsers === 0) {
|
|
2329
|
-
return fail("zero alternates");
|
|
2330
|
-
}
|
|
2331
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
2332
|
-
assertParser(parsers[j]);
|
|
2333
|
-
}
|
|
2334
|
-
return Parsimmon(function(input, i) {
|
|
2335
|
-
var result;
|
|
2336
|
-
for(var j2 = 0; j2 < parsers.length; j2 += 1){
|
|
2337
|
-
result = mergeReplies(parsers[j2]._(input, i), result);
|
|
2338
|
-
if (result.status) {
|
|
2339
|
-
return result;
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
return result;
|
|
2343
|
-
});
|
|
2344
|
-
}
|
|
2345
|
-
function sepBy(parser2, separator) {
|
|
2346
|
-
return sepBy1(parser2, separator).or(succeed([]));
|
|
2347
|
-
}
|
|
2348
|
-
function sepBy1(parser2, separator) {
|
|
2349
|
-
assertParser(parser2);
|
|
2350
|
-
assertParser(separator);
|
|
2351
|
-
var pairs = separator.then(parser2).many();
|
|
2352
|
-
return seqMap(parser2, pairs, function(r, rs) {
|
|
2353
|
-
return [
|
|
2354
|
-
r
|
|
2355
|
-
].concat(rs);
|
|
2356
|
-
});
|
|
2357
|
-
}
|
|
2358
|
-
_.parse = function(input) {
|
|
2359
|
-
if (typeof input !== "string" && !isBuffer(input)) {
|
|
2360
|
-
throw new Error(".parse must be called with a string or Buffer as its argument");
|
|
2361
|
-
}
|
|
2362
|
-
var parseResult = this.skip(eof)._(input, 0);
|
|
2363
|
-
var result;
|
|
2364
|
-
if (parseResult.status) {
|
|
2365
|
-
result = {
|
|
2366
|
-
status: true,
|
|
2367
|
-
value: parseResult.value
|
|
2368
|
-
};
|
|
2369
|
-
} else {
|
|
2370
|
-
result = {
|
|
2371
|
-
status: false,
|
|
2372
|
-
index: makeLineColumnIndex(input, parseResult.furthest),
|
|
2373
|
-
expected: parseResult.expected
|
|
2374
|
-
};
|
|
2375
|
-
}
|
|
2376
|
-
delete lineColumnIndex[input];
|
|
2377
|
-
return result;
|
|
2378
|
-
};
|
|
2379
|
-
_.tryParse = function(str) {
|
|
2380
|
-
var result = this.parse(str);
|
|
2381
|
-
if (result.status) {
|
|
2382
|
-
return result.value;
|
|
2383
|
-
} else {
|
|
2384
|
-
var msg = formatError(str, result);
|
|
2385
|
-
var err = new Error(msg);
|
|
2386
|
-
err.type = "ParsimmonError";
|
|
2387
|
-
err.result = result;
|
|
2388
|
-
throw err;
|
|
2389
|
-
}
|
|
2390
|
-
};
|
|
2391
|
-
_.assert = function(condition, errorMessage) {
|
|
2392
|
-
return this.chain(function(value) {
|
|
2393
|
-
return condition(value) ? succeed(value) : fail(errorMessage);
|
|
2394
|
-
});
|
|
2395
|
-
};
|
|
2396
|
-
_.or = function(alternative) {
|
|
2397
|
-
return alt(this, alternative);
|
|
2398
|
-
};
|
|
2399
|
-
_.trim = function(parser2) {
|
|
2400
|
-
return this.wrap(parser2, parser2);
|
|
2401
|
-
};
|
|
2402
|
-
_.wrap = function(leftParser, rightParser) {
|
|
2403
|
-
return seqMap(leftParser, this, rightParser, function(left, middle) {
|
|
2404
|
-
return middle;
|
|
2405
|
-
});
|
|
2406
|
-
};
|
|
2407
|
-
_.thru = function(wrapper) {
|
|
2408
|
-
return wrapper(this);
|
|
2409
|
-
};
|
|
2410
|
-
_.then = function(next) {
|
|
2411
|
-
assertParser(next);
|
|
2412
|
-
return seq(this, next).map(function(results) {
|
|
2413
|
-
return results[1];
|
|
2414
|
-
});
|
|
2415
|
-
};
|
|
2416
|
-
_.many = function() {
|
|
2417
|
-
var self = this;
|
|
2418
|
-
return Parsimmon(function(input, i) {
|
|
2419
|
-
var accum = [];
|
|
2420
|
-
var result = void 0;
|
|
2421
|
-
for(;;){
|
|
2422
|
-
result = mergeReplies(self._(input, i), result);
|
|
2423
|
-
if (result.status) {
|
|
2424
|
-
if (i === result.index) {
|
|
2425
|
-
throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");
|
|
2426
|
-
}
|
|
2427
|
-
i = result.index;
|
|
2428
|
-
accum.push(result.value);
|
|
2429
|
-
} else {
|
|
2430
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
|
-
});
|
|
2434
|
-
};
|
|
2435
|
-
_.tieWith = function(separator) {
|
|
2436
|
-
assertString(separator);
|
|
2437
|
-
return this.map(function(args) {
|
|
2438
|
-
assertArray(args);
|
|
2439
|
-
if (args.length) {
|
|
2440
|
-
assertString(args[0]);
|
|
2441
|
-
var s = args[0];
|
|
2442
|
-
for(var i = 1; i < args.length; i++){
|
|
2443
|
-
assertString(args[i]);
|
|
2444
|
-
s += separator + args[i];
|
|
2445
|
-
}
|
|
2446
|
-
return s;
|
|
2447
|
-
} else {
|
|
2448
|
-
return "";
|
|
2449
|
-
}
|
|
2450
|
-
});
|
|
2451
|
-
};
|
|
2452
|
-
_.tie = function() {
|
|
2453
|
-
return this.tieWith("");
|
|
2454
|
-
};
|
|
2455
|
-
_.times = function(min, max) {
|
|
2456
|
-
var self = this;
|
|
2457
|
-
if (arguments.length < 2) {
|
|
2458
|
-
max = min;
|
|
2459
|
-
}
|
|
2460
|
-
assertNumber(min);
|
|
2461
|
-
assertNumber(max);
|
|
2462
|
-
return Parsimmon(function(input, i) {
|
|
2463
|
-
var accum = [];
|
|
2464
|
-
var result = void 0;
|
|
2465
|
-
var prevResult = void 0;
|
|
2466
|
-
for(var times2 = 0; times2 < min; times2 += 1){
|
|
2467
|
-
result = self._(input, i);
|
|
2468
|
-
prevResult = mergeReplies(result, prevResult);
|
|
2469
|
-
if (result.status) {
|
|
2470
|
-
i = result.index;
|
|
2471
|
-
accum.push(result.value);
|
|
2472
|
-
} else {
|
|
2473
|
-
return prevResult;
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
for(; times2 < max; times2 += 1){
|
|
2477
|
-
result = self._(input, i);
|
|
2478
|
-
prevResult = mergeReplies(result, prevResult);
|
|
2479
|
-
if (result.status) {
|
|
2480
|
-
i = result.index;
|
|
2481
|
-
accum.push(result.value);
|
|
2482
|
-
} else {
|
|
2483
|
-
break;
|
|
2484
|
-
}
|
|
2485
|
-
}
|
|
2486
|
-
return mergeReplies(makeSuccess(i, accum), prevResult);
|
|
2487
|
-
});
|
|
2488
|
-
};
|
|
2489
|
-
_.result = function(res) {
|
|
2490
|
-
return this.map(function() {
|
|
2491
|
-
return res;
|
|
2492
|
-
});
|
|
2493
|
-
};
|
|
2494
|
-
_.atMost = function(n) {
|
|
2495
|
-
return this.times(0, n);
|
|
2496
|
-
};
|
|
2497
|
-
_.atLeast = function(n) {
|
|
2498
|
-
return seqMap(this.times(n), this.many(), function(init, rest) {
|
|
2499
|
-
return init.concat(rest);
|
|
2500
|
-
});
|
|
2501
|
-
};
|
|
2502
|
-
_.map = function(fn) {
|
|
2503
|
-
assertFunction(fn);
|
|
2504
|
-
var self = this;
|
|
2505
|
-
return Parsimmon(function(input, i) {
|
|
2506
|
-
var result = self._(input, i);
|
|
2507
|
-
if (!result.status) {
|
|
2508
|
-
return result;
|
|
2509
|
-
}
|
|
2510
|
-
return mergeReplies(makeSuccess(result.index, fn(result.value)), result);
|
|
2511
|
-
});
|
|
2512
|
-
};
|
|
2513
|
-
_.contramap = function(fn) {
|
|
2514
|
-
assertFunction(fn);
|
|
2515
|
-
var self = this;
|
|
2516
|
-
return Parsimmon(function(input, i) {
|
|
2517
|
-
var result = self.parse(fn(input.slice(i)));
|
|
2518
|
-
if (!result.status) {
|
|
2519
|
-
return result;
|
|
2520
|
-
}
|
|
2521
|
-
return makeSuccess(i + input.length, result.value);
|
|
2522
|
-
});
|
|
2523
|
-
};
|
|
2524
|
-
_.promap = function(f, g) {
|
|
2525
|
-
assertFunction(f);
|
|
2526
|
-
assertFunction(g);
|
|
2527
|
-
return this.contramap(f).map(g);
|
|
2528
|
-
};
|
|
2529
|
-
_.skip = function(next) {
|
|
2530
|
-
return seq(this, next).map(function(results) {
|
|
2531
|
-
return results[0];
|
|
2532
|
-
});
|
|
2533
|
-
};
|
|
2534
|
-
_.mark = function() {
|
|
2535
|
-
return seqMap(index, this, index, function(start, value, end2) {
|
|
2536
|
-
return {
|
|
2537
|
-
start: start,
|
|
2538
|
-
value: value,
|
|
2539
|
-
end: end2
|
|
2540
|
-
};
|
|
2541
|
-
});
|
|
2542
|
-
};
|
|
2543
|
-
_.node = function(name) {
|
|
2544
|
-
return seqMap(index, this, index, function(start, value, end2) {
|
|
2545
|
-
return {
|
|
2546
|
-
name: name,
|
|
2547
|
-
value: value,
|
|
2548
|
-
start: start,
|
|
2549
|
-
end: end2
|
|
2550
|
-
};
|
|
2551
|
-
});
|
|
2552
|
-
};
|
|
2553
|
-
_.sepBy = function(separator) {
|
|
2554
|
-
return sepBy(this, separator);
|
|
2555
|
-
};
|
|
2556
|
-
_.sepBy1 = function(separator) {
|
|
2557
|
-
return sepBy1(this, separator);
|
|
2558
|
-
};
|
|
2559
|
-
_.lookahead = function(x) {
|
|
2560
|
-
return this.skip(lookahead(x));
|
|
2561
|
-
};
|
|
2562
|
-
_.notFollowedBy = function(x) {
|
|
2563
|
-
return this.skip(notFollowedBy(x));
|
|
2564
|
-
};
|
|
2565
|
-
_.desc = function(expected) {
|
|
2566
|
-
if (!isArray(expected)) {
|
|
2567
|
-
expected = [
|
|
2568
|
-
expected
|
|
2569
|
-
];
|
|
2570
|
-
}
|
|
2571
|
-
var self = this;
|
|
2572
|
-
return Parsimmon(function(input, i) {
|
|
2573
|
-
var reply = self._(input, i);
|
|
2574
|
-
if (!reply.status) {
|
|
2575
|
-
reply.expected = expected;
|
|
2576
|
-
}
|
|
2577
|
-
return reply;
|
|
2578
|
-
});
|
|
2579
|
-
};
|
|
2580
|
-
_.fallback = function(result) {
|
|
2581
|
-
return this.or(succeed(result));
|
|
2582
|
-
};
|
|
2583
|
-
_.ap = function(other) {
|
|
2584
|
-
return seqMap(other, this, function(f, x) {
|
|
2585
|
-
return f(x);
|
|
2586
|
-
});
|
|
2587
|
-
};
|
|
2588
|
-
_.chain = function(f) {
|
|
2589
|
-
var self = this;
|
|
2590
|
-
return Parsimmon(function(input, i) {
|
|
2591
|
-
var result = self._(input, i);
|
|
2592
|
-
if (!result.status) {
|
|
2593
|
-
return result;
|
|
2594
|
-
}
|
|
2595
|
-
var nextParser = f(result.value);
|
|
2596
|
-
return mergeReplies(nextParser._(input, result.index), result);
|
|
2597
|
-
});
|
|
2598
|
-
};
|
|
2599
|
-
function string(str) {
|
|
2600
|
-
assertString(str);
|
|
2601
|
-
var expected = "'" + str + "'";
|
|
2602
|
-
return Parsimmon(function(input, i) {
|
|
2603
|
-
var j = i + str.length;
|
|
2604
|
-
var head = input.slice(i, j);
|
|
2605
|
-
if (head === str) {
|
|
2606
|
-
return makeSuccess(j, head);
|
|
2607
|
-
} else {
|
|
2608
|
-
return makeFailure(i, expected);
|
|
2609
|
-
}
|
|
2610
|
-
});
|
|
2611
|
-
}
|
|
2612
|
-
function byte(b) {
|
|
2613
|
-
ensureBuffer();
|
|
2614
|
-
assertNumber(b);
|
|
2615
|
-
if (b > 255) {
|
|
2616
|
-
throw new Error("Value specified to byte constructor (" + b + "=0x" + b.toString(16) + ") is larger in value than a single byte.");
|
|
2617
|
-
}
|
|
2618
|
-
var expected = (b > 15 ? "0x" : "0x0") + b.toString(16);
|
|
2619
|
-
return Parsimmon(function(input, i) {
|
|
2620
|
-
var head = get(input, i);
|
|
2621
|
-
if (head === b) {
|
|
2622
|
-
return makeSuccess(i + 1, head);
|
|
2623
|
-
} else {
|
|
2624
|
-
return makeFailure(i, expected);
|
|
2625
|
-
}
|
|
2626
|
-
});
|
|
2627
|
-
}
|
|
2628
|
-
function regexp(re, group) {
|
|
2629
|
-
assertRegexp(re);
|
|
2630
|
-
if (arguments.length >= 2) {
|
|
2631
|
-
assertNumber(group);
|
|
2632
|
-
} else {
|
|
2633
|
-
group = 0;
|
|
2634
|
-
}
|
|
2635
|
-
var anchored = anchoredRegexp(re);
|
|
2636
|
-
var expected = "" + re;
|
|
2637
|
-
return Parsimmon(function(input, i) {
|
|
2638
|
-
var match = anchored.exec(input.slice(i));
|
|
2639
|
-
if (match) {
|
|
2640
|
-
if (0 <= group && group <= match.length) {
|
|
2641
|
-
var fullMatch = match[0];
|
|
2642
|
-
var groupMatch = match[group];
|
|
2643
|
-
return makeSuccess(i + fullMatch.length, groupMatch);
|
|
2644
|
-
}
|
|
2645
|
-
var message = "valid match group (0 to " + match.length + ") in " + expected;
|
|
2646
|
-
return makeFailure(i, message);
|
|
2647
|
-
}
|
|
2648
|
-
return makeFailure(i, expected);
|
|
2649
|
-
});
|
|
2650
|
-
}
|
|
2651
|
-
function succeed(value) {
|
|
2652
|
-
return Parsimmon(function(input, i) {
|
|
2653
|
-
return makeSuccess(i, value);
|
|
2654
|
-
});
|
|
2655
|
-
}
|
|
2656
|
-
function fail(expected) {
|
|
2657
|
-
return Parsimmon(function(input, i) {
|
|
2658
|
-
return makeFailure(i, expected);
|
|
2659
|
-
});
|
|
2660
|
-
}
|
|
2661
|
-
function lookahead(x) {
|
|
2662
|
-
if (isParser(x)) {
|
|
2663
|
-
return Parsimmon(function(input, i) {
|
|
2664
|
-
var result = x._(input, i);
|
|
2665
|
-
result.index = i;
|
|
2666
|
-
result.value = "";
|
|
2667
|
-
return result;
|
|
2668
|
-
});
|
|
2669
|
-
} else if (typeof x === "string") {
|
|
2670
|
-
return lookahead(string(x));
|
|
2671
|
-
} else if (_instanceof(x, RegExp)) {
|
|
2672
|
-
return lookahead(regexp(x));
|
|
2673
|
-
}
|
|
2674
|
-
throw new Error("not a string, regexp, or parser: " + x);
|
|
2675
|
-
}
|
|
2676
|
-
function notFollowedBy(parser2) {
|
|
2677
|
-
assertParser(parser2);
|
|
2678
|
-
return Parsimmon(function(input, i) {
|
|
2679
|
-
var result = parser2._(input, i);
|
|
2680
|
-
var text = input.slice(i, result.index);
|
|
2681
|
-
return result.status ? makeFailure(i, 'not "' + text + '"') : makeSuccess(i, null);
|
|
2682
|
-
});
|
|
2683
|
-
}
|
|
2684
|
-
function test(predicate) {
|
|
2685
|
-
assertFunction(predicate);
|
|
2686
|
-
return Parsimmon(function(input, i) {
|
|
2687
|
-
var char = get(input, i);
|
|
2688
|
-
if (i < input.length && predicate(char)) {
|
|
2689
|
-
return makeSuccess(i + 1, char);
|
|
2690
|
-
} else {
|
|
2691
|
-
return makeFailure(i, "a character/byte matching " + predicate);
|
|
2692
|
-
}
|
|
2693
|
-
});
|
|
2694
|
-
}
|
|
2695
|
-
function oneOf(str) {
|
|
2696
|
-
var expected = str.split("");
|
|
2697
|
-
for(var idx = 0; idx < expected.length; idx++){
|
|
2698
|
-
expected[idx] = "'" + expected[idx] + "'";
|
|
2699
|
-
}
|
|
2700
|
-
return test(function(ch) {
|
|
2701
|
-
return str.indexOf(ch) >= 0;
|
|
2702
|
-
}).desc(expected);
|
|
2703
|
-
}
|
|
2704
|
-
function noneOf(str) {
|
|
2705
|
-
return test(function(ch) {
|
|
2706
|
-
return str.indexOf(ch) < 0;
|
|
2707
|
-
}).desc("none of '" + str + "'");
|
|
2708
|
-
}
|
|
2709
|
-
function custom(parsingFunction) {
|
|
2710
|
-
return Parsimmon(parsingFunction(makeSuccess, makeFailure));
|
|
2711
|
-
}
|
|
2712
|
-
function range(begin, end2) {
|
|
2713
|
-
return test(function(ch) {
|
|
2714
|
-
return begin <= ch && ch <= end2;
|
|
2715
|
-
}).desc(begin + "-" + end2);
|
|
2716
|
-
}
|
|
2717
|
-
function takeWhile(predicate) {
|
|
2718
|
-
assertFunction(predicate);
|
|
2719
|
-
return Parsimmon(function(input, i) {
|
|
2720
|
-
var j = i;
|
|
2721
|
-
while(j < input.length && predicate(get(input, j))){
|
|
2722
|
-
j++;
|
|
2723
|
-
}
|
|
2724
|
-
return makeSuccess(j, input.slice(i, j));
|
|
2725
|
-
});
|
|
2726
|
-
}
|
|
2727
|
-
function lazy(desc, f) {
|
|
2728
|
-
if (arguments.length < 2) {
|
|
2729
|
-
f = desc;
|
|
2730
|
-
desc = void 0;
|
|
2731
|
-
}
|
|
2732
|
-
var parser2 = Parsimmon(function(input, i) {
|
|
2733
|
-
parser2._ = f()._;
|
|
2734
|
-
return parser2._(input, i);
|
|
2735
|
-
});
|
|
2736
|
-
if (desc) {
|
|
2737
|
-
return parser2.desc(desc);
|
|
2738
|
-
} else {
|
|
2739
|
-
return parser2;
|
|
2740
|
-
}
|
|
2741
|
-
}
|
|
2742
|
-
function empty() {
|
|
2743
|
-
return fail("fantasy-land/empty");
|
|
2744
|
-
}
|
|
2745
|
-
_.concat = _.or;
|
|
2746
|
-
_.empty = empty;
|
|
2747
|
-
_.of = succeed;
|
|
2748
|
-
_["fantasy-land/ap"] = _.ap;
|
|
2749
|
-
_["fantasy-land/chain"] = _.chain;
|
|
2750
|
-
_["fantasy-land/concat"] = _.concat;
|
|
2751
|
-
_["fantasy-land/empty"] = _.empty;
|
|
2752
|
-
_["fantasy-land/of"] = _.of;
|
|
2753
|
-
_["fantasy-land/map"] = _.map;
|
|
2754
|
-
var index = Parsimmon(function(input, i) {
|
|
2755
|
-
return makeSuccess(i, makeLineColumnIndex(input, i));
|
|
2756
|
-
});
|
|
2757
|
-
var any = Parsimmon(function(input, i) {
|
|
2758
|
-
if (i >= input.length) {
|
|
2759
|
-
return makeFailure(i, "any character/byte");
|
|
2760
|
-
}
|
|
2761
|
-
return makeSuccess(i + 1, get(input, i));
|
|
2762
|
-
});
|
|
2763
|
-
var all = Parsimmon(function(input, i) {
|
|
2764
|
-
return makeSuccess(input.length, input.slice(i));
|
|
2765
|
-
});
|
|
2766
|
-
var eof = Parsimmon(function(input, i) {
|
|
2767
|
-
if (i < input.length) {
|
|
2768
|
-
return makeFailure(i, "EOF");
|
|
2769
|
-
}
|
|
2770
|
-
return makeSuccess(i, null);
|
|
2771
|
-
});
|
|
2772
|
-
var digit = regexp(/[0-9]/).desc("a digit");
|
|
2773
|
-
var digits = regexp(/[0-9]*/).desc("optional digits");
|
|
2774
|
-
var letter = regexp(/[a-z]/i).desc("a letter");
|
|
2775
|
-
var letters = regexp(/[a-z]*/i).desc("optional letters");
|
|
2776
|
-
var optWhitespace = regexp(/\s*/).desc("optional whitespace");
|
|
2777
|
-
var whitespace = regexp(/\s+/).desc("whitespace");
|
|
2778
|
-
var cr = string("\r");
|
|
2779
|
-
var lf = string("\n");
|
|
2780
|
-
var crlf = string("\r\n");
|
|
2781
|
-
var newline = alt(crlf, lf, cr).desc("newline");
|
|
2782
|
-
var end = alt(newline, eof);
|
|
2783
|
-
Parsimmon.all = all;
|
|
2784
|
-
Parsimmon.alt = alt;
|
|
2785
|
-
Parsimmon.any = any;
|
|
2786
|
-
Parsimmon.cr = cr;
|
|
2787
|
-
Parsimmon.createLanguage = createLanguage;
|
|
2788
|
-
Parsimmon.crlf = crlf;
|
|
2789
|
-
Parsimmon.custom = custom;
|
|
2790
|
-
Parsimmon.digit = digit;
|
|
2791
|
-
Parsimmon.digits = digits;
|
|
2792
|
-
Parsimmon.empty = empty;
|
|
2793
|
-
Parsimmon.end = end;
|
|
2794
|
-
Parsimmon.eof = eof;
|
|
2795
|
-
Parsimmon.fail = fail;
|
|
2796
|
-
Parsimmon.formatError = formatError;
|
|
2797
|
-
Parsimmon.index = index;
|
|
2798
|
-
Parsimmon.isParser = isParser;
|
|
2799
|
-
Parsimmon.lazy = lazy;
|
|
2800
|
-
Parsimmon.letter = letter;
|
|
2801
|
-
Parsimmon.letters = letters;
|
|
2802
|
-
Parsimmon.lf = lf;
|
|
2803
|
-
Parsimmon.lookahead = lookahead;
|
|
2804
|
-
Parsimmon.makeFailure = makeFailure;
|
|
2805
|
-
Parsimmon.makeSuccess = makeSuccess;
|
|
2806
|
-
Parsimmon.newline = newline;
|
|
2807
|
-
Parsimmon.noneOf = noneOf;
|
|
2808
|
-
Parsimmon.notFollowedBy = notFollowedBy;
|
|
2809
|
-
Parsimmon.of = succeed;
|
|
2810
|
-
Parsimmon.oneOf = oneOf;
|
|
2811
|
-
Parsimmon.optWhitespace = optWhitespace;
|
|
2812
|
-
Parsimmon.Parser = Parsimmon;
|
|
2813
|
-
Parsimmon.range = range;
|
|
2814
|
-
Parsimmon.regex = regexp;
|
|
2815
|
-
Parsimmon.regexp = regexp;
|
|
2816
|
-
Parsimmon.sepBy = sepBy;
|
|
2817
|
-
Parsimmon.sepBy1 = sepBy1;
|
|
2818
|
-
Parsimmon.seq = seq;
|
|
2819
|
-
Parsimmon.seqMap = seqMap;
|
|
2820
|
-
Parsimmon.seqObj = seqObj;
|
|
2821
|
-
Parsimmon.string = string;
|
|
2822
|
-
Parsimmon.succeed = succeed;
|
|
2823
|
-
Parsimmon.takeWhile = takeWhile;
|
|
2824
|
-
Parsimmon.test = test;
|
|
2825
|
-
Parsimmon.whitespace = whitespace;
|
|
2826
|
-
Parsimmon["fantasy-land/empty"] = empty;
|
|
2827
|
-
Parsimmon["fantasy-land/of"] = succeed;
|
|
2828
|
-
Parsimmon.Binary = {
|
|
2829
|
-
bitSeq: bitSeq,
|
|
2830
|
-
bitSeqObj: bitSeqObj,
|
|
2831
|
-
byte: byte,
|
|
2832
|
-
buffer: parseBuffer,
|
|
2833
|
-
encodedString: encodedString,
|
|
2834
|
-
uintBE: uintBE,
|
|
2835
|
-
uint8BE: uintBE(1),
|
|
2836
|
-
uint16BE: uintBE(2),
|
|
2837
|
-
uint32BE: uintBE(4),
|
|
2838
|
-
uintLE: uintLE,
|
|
2839
|
-
uint8LE: uintLE(1),
|
|
2840
|
-
uint16LE: uintLE(2),
|
|
2841
|
-
uint32LE: uintLE(4),
|
|
2842
|
-
intBE: intBE,
|
|
2843
|
-
int8BE: intBE(1),
|
|
2844
|
-
int16BE: intBE(2),
|
|
2845
|
-
int32BE: intBE(4),
|
|
2846
|
-
intLE: intLE,
|
|
2847
|
-
int8LE: intLE(1),
|
|
2848
|
-
int16LE: intLE(2),
|
|
2849
|
-
int32LE: intLE(4),
|
|
2850
|
-
floatBE: floatBE(),
|
|
2851
|
-
floatLE: floatLE(),
|
|
2852
|
-
doubleBE: doubleBE(),
|
|
2853
|
-
doubleLE: doubleLE()
|
|
2854
|
-
};
|
|
2855
|
-
module.exports = Parsimmon;
|
|
2856
|
-
}
|
|
2857
|
-
});
|
|
2858
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/TokenError.js
|
|
2859
|
-
var require_TokenError = __commonJS({
|
|
2860
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/TokenError.js": function(exports) {
|
|
2861
|
-
"use strict";
|
|
2862
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2863
|
-
value: true
|
|
2864
|
-
});
|
|
2865
|
-
exports.TokenError = void 0;
|
|
2866
|
-
var TokenError = /*#__PURE__*/ function(Error1) {
|
|
2867
|
-
_inherits(TokenError, Error1);
|
|
2868
|
-
var _super = _create_super(TokenError);
|
|
2869
|
-
function TokenError(message, token) {
|
|
2870
|
-
_class_call_check(this, TokenError);
|
|
2871
|
-
var _this;
|
|
2872
|
-
_this = _super.call(this, message);
|
|
2873
|
-
_this.message = message;
|
|
2874
|
-
_this.token = token;
|
|
2875
|
-
if (token && token.errors) token.errors.push(_assert_this_initialized(_this));
|
|
2876
|
-
else throw _assert_this_initialized(_this);
|
|
2877
|
-
return _this;
|
|
2878
|
-
}
|
|
2879
|
-
_create_class(TokenError, [
|
|
2880
|
-
{
|
|
2881
|
-
key: "inspect",
|
|
2882
|
-
value: function inspect() {
|
|
2883
|
-
return "SyntaxError: " + this.message;
|
|
2884
|
-
}
|
|
2885
|
-
}
|
|
2886
|
-
]);
|
|
2887
|
-
return TokenError;
|
|
2888
|
-
}(_wrap_native_super(Error));
|
|
2889
|
-
exports.TokenError = TokenError;
|
|
2890
|
-
}
|
|
2891
|
-
});
|
|
2892
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Parser.js
|
|
2893
|
-
var require_Parser = __commonJS({
|
|
2894
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Parser.js": function(exports) {
|
|
2895
|
-
"use strict";
|
|
2896
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2897
|
-
value: true
|
|
2898
|
-
});
|
|
2899
|
-
exports.Parser = exports.findRuleByName = exports.parseRuleName = exports.escapeRegExp = exports.readToken = void 0;
|
|
2900
|
-
var UPPER_SNAKE_RE = /^[A-Z0-9_]+$/;
|
|
2901
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
2902
|
-
var preDecorationRE = /^(@|&|!)/;
|
|
2903
|
-
var WS_RULE = "WS";
|
|
2904
|
-
var TokenError_1 = require_TokenError();
|
|
2905
|
-
function readToken(txt, expr) {
|
|
2906
|
-
var result = expr.exec(txt);
|
|
2907
|
-
if (result && result.index == 0) {
|
|
2908
|
-
if (result[0].length == 0 && expr.source.length > 0) return null;
|
|
2909
|
-
return {
|
|
2910
|
-
type: null,
|
|
2911
|
-
text: result[0],
|
|
2912
|
-
rest: txt.substr(result[0].length),
|
|
2913
|
-
start: 0,
|
|
2914
|
-
end: result[0].length - 1,
|
|
2915
|
-
fullText: result[0],
|
|
2916
|
-
errors: [],
|
|
2917
|
-
children: [],
|
|
2918
|
-
parent: null
|
|
2919
|
-
};
|
|
2920
|
-
}
|
|
2921
|
-
return null;
|
|
2922
|
-
}
|
|
2923
|
-
exports.readToken = readToken;
|
|
2924
|
-
function escapeRegExp(str) {
|
|
2925
|
-
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
2926
|
-
}
|
|
2927
|
-
exports.escapeRegExp = escapeRegExp;
|
|
2928
|
-
function fixRest(token) {
|
|
2929
|
-
token.rest = "";
|
|
2930
|
-
token.children && token.children.forEach(function(c) {
|
|
2931
|
-
return fixRest(c);
|
|
2932
|
-
});
|
|
2933
|
-
}
|
|
2934
|
-
function fixPositions(token, start) {
|
|
2935
|
-
token.start += start;
|
|
2936
|
-
token.end += start;
|
|
2937
|
-
token.children && token.children.forEach(function(c) {
|
|
2938
|
-
return fixPositions(c, token.start);
|
|
2939
|
-
});
|
|
2940
|
-
}
|
|
2941
|
-
function agregateErrors(errors, token) {
|
|
2942
|
-
if (token.errors && token.errors.length) token.errors.forEach(function(err) {
|
|
2943
|
-
return errors.push(err);
|
|
2944
|
-
});
|
|
2945
|
-
token.children && token.children.forEach(function(tok) {
|
|
2946
|
-
return agregateErrors(errors, tok);
|
|
2947
|
-
});
|
|
2948
|
-
}
|
|
2949
|
-
function parseRuleName(name) {
|
|
2950
|
-
var postDecoration = decorationRE.exec(name);
|
|
2951
|
-
var preDecoration = preDecorationRE.exec(name);
|
|
2952
|
-
var postDecorationText = postDecoration && postDecoration[0] || "";
|
|
2953
|
-
var preDecorationText = preDecoration && preDecoration[0] || "";
|
|
2954
|
-
var out = {
|
|
2955
|
-
raw: name,
|
|
2956
|
-
name: name.replace(decorationRE, "").replace(preDecorationRE, ""),
|
|
2957
|
-
isOptional: postDecorationText == "?" || postDecorationText == "*",
|
|
2958
|
-
allowRepetition: postDecorationText == "+" || postDecorationText == "*",
|
|
2959
|
-
atLeastOne: postDecorationText == "+",
|
|
2960
|
-
lookupPositive: preDecorationText == "&",
|
|
2961
|
-
lookupNegative: preDecorationText == "!",
|
|
2962
|
-
pinned: preDecorationText == "@",
|
|
2963
|
-
lookup: false,
|
|
2964
|
-
isLiteral: false
|
|
2965
|
-
};
|
|
2966
|
-
out.isLiteral = out.name[0] == "'" || out.name[0] == '"';
|
|
2967
|
-
out.lookup = out.lookupNegative || out.lookupPositive;
|
|
2968
|
-
return out;
|
|
2969
|
-
}
|
|
2970
|
-
exports.parseRuleName = parseRuleName;
|
|
2971
|
-
function findRuleByName(name, parser2) {
|
|
2972
|
-
var parsed = parseRuleName(name);
|
|
2973
|
-
return parser2.cachedRules[parsed.name] || null;
|
|
2974
|
-
}
|
|
2975
|
-
exports.findRuleByName = findRuleByName;
|
|
2976
|
-
function stripRules(token, re) {
|
|
2977
|
-
if (token.children) {
|
|
2978
|
-
var localRules = token.children.filter(function(x) {
|
|
2979
|
-
return x.type && re.test(x.type);
|
|
2980
|
-
});
|
|
2981
|
-
for(var i = 0; i < localRules.length; i++){
|
|
2982
|
-
var indexOnChildren = token.children.indexOf(localRules[i]);
|
|
2983
|
-
if (indexOnChildren != -1) {
|
|
2984
|
-
token.children.splice(indexOnChildren, 1);
|
|
2985
|
-
}
|
|
2986
|
-
}
|
|
2987
|
-
token.children.forEach(function(c) {
|
|
2988
|
-
return stripRules(c, re);
|
|
2989
|
-
});
|
|
2990
|
-
}
|
|
2991
|
-
}
|
|
2992
|
-
var ignoreMissingRules = [
|
|
2993
|
-
"EOF"
|
|
2994
|
-
];
|
|
2995
|
-
var Parser2 = /*#__PURE__*/ function() {
|
|
2996
|
-
function Parser2(grammarRules, options) {
|
|
2997
|
-
var _this = this;
|
|
2998
|
-
_class_call_check(this, Parser2);
|
|
2999
|
-
this.grammarRules = grammarRules;
|
|
3000
|
-
this.options = options;
|
|
3001
|
-
this.cachedRules = {};
|
|
3002
|
-
this.debug = options ? options.debug === true : false;
|
|
3003
|
-
var errors = [];
|
|
3004
|
-
var neededRules = [];
|
|
3005
|
-
grammarRules.forEach(function(rule) {
|
|
3006
|
-
var parsedName = parseRuleName(rule.name);
|
|
3007
|
-
if (parsedName.name in _this.cachedRules) {
|
|
3008
|
-
errors.push("Duplicated rule " + parsedName.name);
|
|
3009
|
-
return;
|
|
3010
|
-
} else {
|
|
3011
|
-
_this.cachedRules[parsedName.name] = rule;
|
|
3012
|
-
}
|
|
3013
|
-
if (!rule.bnf || !rule.bnf.length) {
|
|
3014
|
-
var error = "Missing rule content, rule: " + rule.name;
|
|
3015
|
-
if (errors.indexOf(error) == -1) errors.push(error);
|
|
3016
|
-
} else {
|
|
3017
|
-
rule.bnf.forEach(function(options2) {
|
|
3018
|
-
if (typeof options2[0] === "string") {
|
|
3019
|
-
var parsed = parseRuleName(options2[0]);
|
|
3020
|
-
if (parsed.name == rule.name) {
|
|
3021
|
-
var error = "Left recursion is not allowed, rule: " + rule.name;
|
|
3022
|
-
if (errors.indexOf(error) == -1) errors.push(error);
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
options2.forEach(function(option) {
|
|
3026
|
-
if (typeof option == "string") {
|
|
3027
|
-
var name = parseRuleName(option);
|
|
3028
|
-
if (!name.isLiteral && neededRules.indexOf(name.name) == -1 && ignoreMissingRules.indexOf(name.name) == -1) neededRules.push(name.name);
|
|
3029
|
-
}
|
|
3030
|
-
});
|
|
3031
|
-
});
|
|
3032
|
-
}
|
|
3033
|
-
if (WS_RULE == rule.name) rule.implicitWs = false;
|
|
3034
|
-
if (rule.implicitWs) {
|
|
3035
|
-
if (neededRules.indexOf(WS_RULE) == -1) neededRules.push(WS_RULE);
|
|
3036
|
-
}
|
|
3037
|
-
if (rule.recover) {
|
|
3038
|
-
if (neededRules.indexOf(rule.recover) == -1) neededRules.push(rule.recover);
|
|
3039
|
-
}
|
|
3040
|
-
});
|
|
3041
|
-
neededRules.forEach(function(ruleName) {
|
|
3042
|
-
if (!(ruleName in _this.cachedRules)) {
|
|
3043
|
-
errors.push("Missing rule " + ruleName);
|
|
3044
|
-
}
|
|
3045
|
-
});
|
|
3046
|
-
if (errors.length) throw new Error(errors.join("\n"));
|
|
3047
|
-
}
|
|
3048
|
-
_create_class(Parser2, [
|
|
3049
|
-
{
|
|
3050
|
-
key: "getAST",
|
|
3051
|
-
value: function getAST(txt, target) {
|
|
3052
|
-
if (!target) {
|
|
3053
|
-
target = this.grammarRules.filter(function(x) {
|
|
3054
|
-
return !x.fragment && x.name.indexOf("%") != 0;
|
|
3055
|
-
})[0].name;
|
|
3056
|
-
}
|
|
3057
|
-
var result = this.parse(txt, target);
|
|
3058
|
-
if (result) {
|
|
3059
|
-
agregateErrors(result.errors, result);
|
|
3060
|
-
fixPositions(result, 0);
|
|
3061
|
-
stripRules(result, /^%/);
|
|
3062
|
-
if (!this.options || !this.options.keepUpperRules) stripRules(result, UPPER_SNAKE_RE);
|
|
3063
|
-
var rest = result.rest;
|
|
3064
|
-
if (rest) {
|
|
3065
|
-
new TokenError_1.TokenError("Unexpected end of input: \n" + rest, result);
|
|
3066
|
-
}
|
|
3067
|
-
fixRest(result);
|
|
3068
|
-
result.rest = rest;
|
|
3069
|
-
}
|
|
3070
|
-
return result;
|
|
3071
|
-
}
|
|
3072
|
-
},
|
|
3073
|
-
{
|
|
3074
|
-
key: "emitSource",
|
|
3075
|
-
value: function emitSource() {
|
|
3076
|
-
return "CANNOT EMIT SOURCE FROM BASE Parser";
|
|
3077
|
-
}
|
|
3078
|
-
},
|
|
3079
|
-
{
|
|
3080
|
-
key: "parse",
|
|
3081
|
-
value: function parse(txt, target) {
|
|
3082
|
-
var _this = this;
|
|
3083
|
-
var recursion = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
3084
|
-
var out = null;
|
|
3085
|
-
var type = parseRuleName(target);
|
|
3086
|
-
var expr;
|
|
3087
|
-
var printable = this.debug && /*!isLiteral &*/ !UPPER_SNAKE_RE.test(type.name);
|
|
3088
|
-
printable && console.log(new Array(recursion).join("\u2502 ") + "Trying to get " + target + " from " + JSON.stringify(txt.split("\n")[0]));
|
|
3089
|
-
var realType = type.name;
|
|
3090
|
-
var targetLex = findRuleByName(type.name, this);
|
|
3091
|
-
if (type.name == "EOF") {
|
|
3092
|
-
if (txt.length) {
|
|
3093
|
-
return null;
|
|
3094
|
-
} else if (txt.length == 0) {
|
|
3095
|
-
return {
|
|
3096
|
-
type: "EOF",
|
|
3097
|
-
text: "",
|
|
3098
|
-
rest: "",
|
|
3099
|
-
start: 0,
|
|
3100
|
-
end: 0,
|
|
3101
|
-
fullText: "",
|
|
3102
|
-
errors: [],
|
|
3103
|
-
children: [],
|
|
3104
|
-
parent: null
|
|
3105
|
-
};
|
|
3106
|
-
}
|
|
3107
|
-
}
|
|
3108
|
-
try {
|
|
3109
|
-
if (!targetLex && type.isLiteral) {
|
|
3110
|
-
var src = type.name.trim();
|
|
3111
|
-
if (src.startsWith('"')) {
|
|
3112
|
-
src = JSON.parse(src);
|
|
3113
|
-
} else if (src.startsWith("'")) {
|
|
3114
|
-
src = src.replace(/^'(.+)'$/, "$1").replace(/\\'/g, "'");
|
|
3115
|
-
}
|
|
3116
|
-
if (src === "") {
|
|
3117
|
-
return {
|
|
3118
|
-
type: "%%EMPTY%%",
|
|
3119
|
-
text: "",
|
|
3120
|
-
rest: txt,
|
|
3121
|
-
start: 0,
|
|
3122
|
-
end: 0,
|
|
3123
|
-
fullText: "",
|
|
3124
|
-
errors: [],
|
|
3125
|
-
children: [],
|
|
3126
|
-
parent: null
|
|
3127
|
-
};
|
|
3128
|
-
}
|
|
3129
|
-
expr = new RegExp(escapeRegExp(src));
|
|
3130
|
-
realType = null;
|
|
3131
|
-
}
|
|
3132
|
-
} catch (e) {
|
|
3133
|
-
if (_instanceof(e, ReferenceError)) {
|
|
3134
|
-
console.error(e);
|
|
3135
|
-
}
|
|
3136
|
-
return null;
|
|
3137
|
-
}
|
|
3138
|
-
if (expr) {
|
|
3139
|
-
var result = readToken(txt, expr);
|
|
3140
|
-
if (result) {
|
|
3141
|
-
result.type = realType;
|
|
3142
|
-
return result;
|
|
3143
|
-
}
|
|
3144
|
-
} else {
|
|
3145
|
-
var options = targetLex.bnf;
|
|
3146
|
-
if (_instanceof(options, Array)) {
|
|
3147
|
-
options.forEach(function(phases) {
|
|
3148
|
-
var _loop = function(i) {
|
|
3149
|
-
if (typeof phases[i] == "string") {
|
|
3150
|
-
var _loop = function() {
|
|
3151
|
-
got = null;
|
|
3152
|
-
if (targetLex.implicitWs) {
|
|
3153
|
-
got = _this.parse(tmpTxt, localTarget.name, recursion + 1);
|
|
3154
|
-
if (!got) {
|
|
3155
|
-
var WS = void 0;
|
|
3156
|
-
do {
|
|
3157
|
-
WS = _this.parse(tmpTxt, WS_RULE, recursion + 1);
|
|
3158
|
-
if (WS) {
|
|
3159
|
-
tmp.text = tmp.text + WS.text;
|
|
3160
|
-
tmp.end = tmp.text.length;
|
|
3161
|
-
WS.parent = tmp;
|
|
3162
|
-
tmp.children.push(WS);
|
|
3163
|
-
tmpTxt = tmpTxt.substr(WS.text.length);
|
|
3164
|
-
position += WS.text.length;
|
|
3165
|
-
} else {
|
|
3166
|
-
break;
|
|
3167
|
-
}
|
|
3168
|
-
}while (WS && WS.text.length);
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
got = got || _this.parse(tmpTxt, localTarget.name, recursion + 1);
|
|
3172
|
-
if (localTarget.lookupNegative) {
|
|
3173
|
-
if (got) return {
|
|
3174
|
-
v: void void 0
|
|
3175
|
-
};
|
|
3176
|
-
return "break";
|
|
3177
|
-
}
|
|
3178
|
-
if (localTarget.lookupPositive) {
|
|
3179
|
-
if (!got) return {
|
|
3180
|
-
v: void void 0
|
|
3181
|
-
};
|
|
3182
|
-
}
|
|
3183
|
-
if (!got) {
|
|
3184
|
-
if (localTarget.isOptional) return "break";
|
|
3185
|
-
if (localTarget.atLeastOne && foundAtLeastOne) return "break";
|
|
3186
|
-
}
|
|
3187
|
-
if (got && targetLex.pinned == i + 1) {
|
|
3188
|
-
pinned = got;
|
|
3189
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " PINNED");
|
|
3190
|
-
}
|
|
3191
|
-
if (!got) got = _this.parseRecovery(targetLex, tmpTxt, recursion + 1);
|
|
3192
|
-
if (!got) {
|
|
3193
|
-
if (pinned) {
|
|
3194
|
-
out = tmp;
|
|
3195
|
-
got = {
|
|
3196
|
-
type: "SyntaxError",
|
|
3197
|
-
text: tmpTxt,
|
|
3198
|
-
children: [],
|
|
3199
|
-
end: tmpTxt.length,
|
|
3200
|
-
errors: [],
|
|
3201
|
-
fullText: "",
|
|
3202
|
-
parent: null,
|
|
3203
|
-
start: 0,
|
|
3204
|
-
rest: ""
|
|
3205
|
-
};
|
|
3206
|
-
if (tmpTxt.length) {
|
|
3207
|
-
new TokenError_1.TokenError("Unexpected end of input. Expecting ".concat(localTarget.name, " Got: ").concat(tmpTxt), got);
|
|
3208
|
-
} else {
|
|
3209
|
-
new TokenError_1.TokenError("Unexpected end of input. Missing ".concat(localTarget.name), got);
|
|
3210
|
-
}
|
|
3211
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text));
|
|
3212
|
-
} else {
|
|
3213
|
-
return {
|
|
3214
|
-
v: void void 0
|
|
3215
|
-
};
|
|
3216
|
-
}
|
|
3217
|
-
}
|
|
3218
|
-
foundAtLeastOne = true;
|
|
3219
|
-
foundSomething = true;
|
|
3220
|
-
if (got.type == "%%EMPTY%%") {
|
|
3221
|
-
return "break";
|
|
3222
|
-
}
|
|
3223
|
-
got.start += position;
|
|
3224
|
-
got.end += position;
|
|
3225
|
-
if (!localTarget.lookupPositive && got.type) {
|
|
3226
|
-
if (got.fragment) {
|
|
3227
|
-
got.children && got.children.forEach(function(x) {
|
|
3228
|
-
x.start += position;
|
|
3229
|
-
x.end += position;
|
|
3230
|
-
x.parent = tmp;
|
|
3231
|
-
tmp.children.push(x);
|
|
3232
|
-
});
|
|
3233
|
-
} else {
|
|
3234
|
-
got.parent = tmp;
|
|
3235
|
-
tmp.children.push(got);
|
|
3236
|
-
}
|
|
3237
|
-
}
|
|
3238
|
-
if (localTarget.lookup) got.lookup = true;
|
|
3239
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text));
|
|
3240
|
-
if (!localTarget.lookup && !got.lookup) {
|
|
3241
|
-
tmp.text = tmp.text + got.text;
|
|
3242
|
-
tmp.end = tmp.text.length;
|
|
3243
|
-
tmpTxt = tmpTxt.substr(got.text.length);
|
|
3244
|
-
position += got.text.length;
|
|
3245
|
-
}
|
|
3246
|
-
tmp.rest = tmpTxt;
|
|
3247
|
-
};
|
|
3248
|
-
var localTarget = parseRuleName(phases[i]);
|
|
3249
|
-
allOptional = allOptional && localTarget.isOptional;
|
|
3250
|
-
var got = void 0;
|
|
3251
|
-
var foundAtLeastOne = false;
|
|
3252
|
-
do {
|
|
3253
|
-
var _ret = _loop();
|
|
3254
|
-
if (_type_of(_ret) === "object") return {
|
|
3255
|
-
v: _ret.v
|
|
3256
|
-
};
|
|
3257
|
-
if (_ret === "break") break;
|
|
3258
|
-
}while (got && localTarget.allowRepetition && tmpTxt.length && !got.lookup);
|
|
3259
|
-
} else {
|
|
3260
|
-
var got1 = readToken(tmpTxt, phases[i]);
|
|
3261
|
-
if (!got1) {
|
|
3262
|
-
return {
|
|
3263
|
-
v: void void 0
|
|
3264
|
-
};
|
|
3265
|
-
}
|
|
3266
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514> " + JSON.stringify(got1.text) + phases[i].source);
|
|
3267
|
-
foundSomething = true;
|
|
3268
|
-
got1.start += position;
|
|
3269
|
-
got1.end += position;
|
|
3270
|
-
tmp.text = tmp.text + got1.text;
|
|
3271
|
-
tmp.end = tmp.text.length;
|
|
3272
|
-
tmpTxt = tmpTxt.substr(got1.text.length);
|
|
3273
|
-
position += got1.text.length;
|
|
3274
|
-
tmp.rest = tmpTxt;
|
|
3275
|
-
}
|
|
3276
|
-
};
|
|
3277
|
-
if (out) return;
|
|
3278
|
-
var pinned = null;
|
|
3279
|
-
var tmp = {
|
|
3280
|
-
type: type.name,
|
|
3281
|
-
text: "",
|
|
3282
|
-
children: [],
|
|
3283
|
-
end: 0,
|
|
3284
|
-
errors: [],
|
|
3285
|
-
fullText: "",
|
|
3286
|
-
parent: null,
|
|
3287
|
-
start: 0,
|
|
3288
|
-
rest: txt
|
|
3289
|
-
};
|
|
3290
|
-
if (targetLex.fragment) tmp.fragment = true;
|
|
3291
|
-
var tmpTxt = txt;
|
|
3292
|
-
var position = 0;
|
|
3293
|
-
var allOptional = phases.length > 0;
|
|
3294
|
-
var foundSomething = false;
|
|
3295
|
-
for(var i = 0; i < phases.length; i++){
|
|
3296
|
-
var _ret = _loop(i);
|
|
3297
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
3298
|
-
}
|
|
3299
|
-
if (foundSomething) {
|
|
3300
|
-
out = tmp;
|
|
3301
|
-
printable && console.log(new Array(recursion).join("\u2502 ") + "\u251C<\u2500\u2534< PUSHING " + out.type + " " + JSON.stringify(out.text));
|
|
3302
|
-
}
|
|
3303
|
-
});
|
|
3304
|
-
}
|
|
3305
|
-
if (out && targetLex.simplifyWhenOneChildren && out.children.length == 1) {
|
|
3306
|
-
out = out.children[0];
|
|
3307
|
-
}
|
|
3308
|
-
}
|
|
3309
|
-
if (!out) {
|
|
3310
|
-
printable && console.log(target + " NOT RESOLVED FROM " + txt);
|
|
3311
|
-
}
|
|
3312
|
-
return out;
|
|
3313
|
-
}
|
|
3314
|
-
},
|
|
3315
|
-
{
|
|
3316
|
-
key: "parseRecovery",
|
|
3317
|
-
value: function parseRecovery(recoverableToken, tmpTxt, recursion) {
|
|
3318
|
-
if (recoverableToken.recover && tmpTxt.length) {
|
|
3319
|
-
var printable = this.debug;
|
|
3320
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "Trying to recover until token " + recoverableToken.recover + " from " + JSON.stringify(tmpTxt.split("\n")[0] + tmpTxt.split("\n")[1]));
|
|
3321
|
-
var tmp = {
|
|
3322
|
-
type: "SyntaxError",
|
|
3323
|
-
text: "",
|
|
3324
|
-
children: [],
|
|
3325
|
-
end: 0,
|
|
3326
|
-
errors: [],
|
|
3327
|
-
fullText: "",
|
|
3328
|
-
parent: null,
|
|
3329
|
-
start: 0,
|
|
3330
|
-
rest: ""
|
|
3331
|
-
};
|
|
3332
|
-
var got;
|
|
3333
|
-
do {
|
|
3334
|
-
got = this.parse(tmpTxt, recoverableToken.recover, recursion + 1);
|
|
3335
|
-
if (got) {
|
|
3336
|
-
new TokenError_1.TokenError('Unexpected input: "' + tmp.text + '" Expecting: '.concat(recoverableToken.name), tmp);
|
|
3337
|
-
break;
|
|
3338
|
-
} else {
|
|
3339
|
-
tmp.text = tmp.text + tmpTxt[0];
|
|
3340
|
-
tmp.end = tmp.text.length;
|
|
3341
|
-
tmpTxt = tmpTxt.substr(1);
|
|
3342
|
-
}
|
|
3343
|
-
}while (!got && tmpTxt.length > 0);
|
|
3344
|
-
if (tmp.text.length > 0 && got) {
|
|
3345
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "Recovered text: " + JSON.stringify(tmp.text));
|
|
3346
|
-
return tmp;
|
|
3347
|
-
}
|
|
3348
|
-
}
|
|
3349
|
-
return null;
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
]);
|
|
3353
|
-
return Parser2;
|
|
3354
|
-
}();
|
|
3355
|
-
exports.Parser = Parser2;
|
|
3356
|
-
exports.default = Parser2;
|
|
3357
|
-
}
|
|
3358
|
-
});
|
|
3359
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/SemanticHelpers.js
|
|
3360
|
-
var require_SemanticHelpers = __commonJS({
|
|
3361
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/SemanticHelpers.js": function(exports) {
|
|
3362
|
-
"use strict";
|
|
3363
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3364
|
-
value: true
|
|
3365
|
-
});
|
|
3366
|
-
exports.findChildrenByType = void 0;
|
|
3367
|
-
function findChildrenByType(token, type) {
|
|
3368
|
-
return token.children ? token.children.filter(function(x) {
|
|
3369
|
-
return x.type == type;
|
|
3370
|
-
}) : [];
|
|
3371
|
-
}
|
|
3372
|
-
exports.findChildrenByType = findChildrenByType;
|
|
3373
|
-
}
|
|
3374
|
-
});
|
|
3375
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/BNF.js
|
|
3376
|
-
var require_BNF = __commonJS({
|
|
3377
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/BNF.js": function(exports) {
|
|
3378
|
-
"use strict";
|
|
3379
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3380
|
-
value: true
|
|
3381
|
-
});
|
|
3382
|
-
var SemanticHelpers_1 = require_SemanticHelpers();
|
|
3383
|
-
var Parser_1 = require_Parser();
|
|
3384
|
-
var BNF;
|
|
3385
|
-
(function(BNF2) {
|
|
3386
|
-
BNF2.RULES = [
|
|
3387
|
-
{
|
|
3388
|
-
name: "syntax",
|
|
3389
|
-
bnf: [
|
|
3390
|
-
[
|
|
3391
|
-
"RULE_EOL*",
|
|
3392
|
-
"rule+"
|
|
3393
|
-
]
|
|
3394
|
-
]
|
|
3395
|
-
},
|
|
3396
|
-
{
|
|
3397
|
-
name: "rule",
|
|
3398
|
-
bnf: [
|
|
3399
|
-
[
|
|
3400
|
-
'" "*',
|
|
3401
|
-
'"<"',
|
|
3402
|
-
"rule-name",
|
|
3403
|
-
'">"',
|
|
3404
|
-
'" "*',
|
|
3405
|
-
'"::="',
|
|
3406
|
-
"firstExpression",
|
|
3407
|
-
"otherExpression*",
|
|
3408
|
-
'" "*',
|
|
3409
|
-
"RULE_EOL+",
|
|
3410
|
-
'" "*'
|
|
3411
|
-
]
|
|
3412
|
-
]
|
|
3413
|
-
},
|
|
3414
|
-
{
|
|
3415
|
-
name: "firstExpression",
|
|
3416
|
-
bnf: [
|
|
3417
|
-
[
|
|
3418
|
-
'" "*',
|
|
3419
|
-
"list"
|
|
3420
|
-
]
|
|
3421
|
-
]
|
|
3422
|
-
},
|
|
3423
|
-
{
|
|
3424
|
-
name: "otherExpression",
|
|
3425
|
-
bnf: [
|
|
3426
|
-
[
|
|
3427
|
-
'" "*',
|
|
3428
|
-
'"|"',
|
|
3429
|
-
'" "*',
|
|
3430
|
-
"list"
|
|
3431
|
-
]
|
|
3432
|
-
]
|
|
3433
|
-
},
|
|
3434
|
-
{
|
|
3435
|
-
name: "RULE_EOL",
|
|
3436
|
-
bnf: [
|
|
3437
|
-
[
|
|
3438
|
-
'"\\r"'
|
|
3439
|
-
],
|
|
3440
|
-
[
|
|
3441
|
-
'"\\n"'
|
|
3442
|
-
]
|
|
3443
|
-
]
|
|
3444
|
-
},
|
|
3445
|
-
{
|
|
3446
|
-
name: "list",
|
|
3447
|
-
bnf: [
|
|
3448
|
-
[
|
|
3449
|
-
"term",
|
|
3450
|
-
'" "*',
|
|
3451
|
-
"list"
|
|
3452
|
-
],
|
|
3453
|
-
[
|
|
3454
|
-
"term"
|
|
3455
|
-
]
|
|
3456
|
-
]
|
|
3457
|
-
},
|
|
3458
|
-
{
|
|
3459
|
-
name: "term",
|
|
3460
|
-
bnf: [
|
|
3461
|
-
[
|
|
3462
|
-
"literal"
|
|
3463
|
-
],
|
|
3464
|
-
[
|
|
3465
|
-
'"<"',
|
|
3466
|
-
"rule-name",
|
|
3467
|
-
'">"'
|
|
3468
|
-
]
|
|
3469
|
-
]
|
|
3470
|
-
},
|
|
3471
|
-
{
|
|
3472
|
-
name: "literal",
|
|
3473
|
-
bnf: [
|
|
3474
|
-
[
|
|
3475
|
-
"'\"'",
|
|
3476
|
-
"RULE_CHARACTER1*",
|
|
3477
|
-
"'\"'"
|
|
3478
|
-
],
|
|
3479
|
-
[
|
|
3480
|
-
'"\'"',
|
|
3481
|
-
"RULE_CHARACTER2*",
|
|
3482
|
-
'"\'"'
|
|
3483
|
-
]
|
|
3484
|
-
]
|
|
3485
|
-
},
|
|
3486
|
-
{
|
|
3487
|
-
name: "RULE_CHARACTER",
|
|
3488
|
-
bnf: [
|
|
3489
|
-
[
|
|
3490
|
-
'" "'
|
|
3491
|
-
],
|
|
3492
|
-
[
|
|
3493
|
-
"RULE_LETTER"
|
|
3494
|
-
],
|
|
3495
|
-
[
|
|
3496
|
-
"RULE_DIGIT"
|
|
3497
|
-
],
|
|
3498
|
-
[
|
|
3499
|
-
"RULE_SYMBOL"
|
|
3500
|
-
]
|
|
3501
|
-
]
|
|
3502
|
-
},
|
|
3503
|
-
{
|
|
3504
|
-
name: "RULE_LETTER",
|
|
3505
|
-
bnf: [
|
|
3506
|
-
[
|
|
3507
|
-
'"A"'
|
|
3508
|
-
],
|
|
3509
|
-
[
|
|
3510
|
-
'"B"'
|
|
3511
|
-
],
|
|
3512
|
-
[
|
|
3513
|
-
'"C"'
|
|
3514
|
-
],
|
|
3515
|
-
[
|
|
3516
|
-
'"D"'
|
|
3517
|
-
],
|
|
3518
|
-
[
|
|
3519
|
-
'"E"'
|
|
3520
|
-
],
|
|
3521
|
-
[
|
|
3522
|
-
'"F"'
|
|
3523
|
-
],
|
|
3524
|
-
[
|
|
3525
|
-
'"G"'
|
|
3526
|
-
],
|
|
3527
|
-
[
|
|
3528
|
-
'"H"'
|
|
3529
|
-
],
|
|
3530
|
-
[
|
|
3531
|
-
'"I"'
|
|
3532
|
-
],
|
|
3533
|
-
[
|
|
3534
|
-
'"J"'
|
|
3535
|
-
],
|
|
3536
|
-
[
|
|
3537
|
-
'"K"'
|
|
3538
|
-
],
|
|
3539
|
-
[
|
|
3540
|
-
'"L"'
|
|
3541
|
-
],
|
|
3542
|
-
[
|
|
3543
|
-
'"M"'
|
|
3544
|
-
],
|
|
3545
|
-
[
|
|
3546
|
-
'"N"'
|
|
3547
|
-
],
|
|
3548
|
-
[
|
|
3549
|
-
'"O"'
|
|
3550
|
-
],
|
|
3551
|
-
[
|
|
3552
|
-
'"P"'
|
|
3553
|
-
],
|
|
3554
|
-
[
|
|
3555
|
-
'"Q"'
|
|
3556
|
-
],
|
|
3557
|
-
[
|
|
3558
|
-
'"R"'
|
|
3559
|
-
],
|
|
3560
|
-
[
|
|
3561
|
-
'"S"'
|
|
3562
|
-
],
|
|
3563
|
-
[
|
|
3564
|
-
'"T"'
|
|
3565
|
-
],
|
|
3566
|
-
[
|
|
3567
|
-
'"U"'
|
|
3568
|
-
],
|
|
3569
|
-
[
|
|
3570
|
-
'"V"'
|
|
3571
|
-
],
|
|
3572
|
-
[
|
|
3573
|
-
'"W"'
|
|
3574
|
-
],
|
|
3575
|
-
[
|
|
3576
|
-
'"X"'
|
|
3577
|
-
],
|
|
3578
|
-
[
|
|
3579
|
-
'"Y"'
|
|
3580
|
-
],
|
|
3581
|
-
[
|
|
3582
|
-
'"Z"'
|
|
3583
|
-
],
|
|
3584
|
-
[
|
|
3585
|
-
'"a"'
|
|
3586
|
-
],
|
|
3587
|
-
[
|
|
3588
|
-
'"b"'
|
|
3589
|
-
],
|
|
3590
|
-
[
|
|
3591
|
-
'"c"'
|
|
3592
|
-
],
|
|
3593
|
-
[
|
|
3594
|
-
'"d"'
|
|
3595
|
-
],
|
|
3596
|
-
[
|
|
3597
|
-
'"e"'
|
|
3598
|
-
],
|
|
3599
|
-
[
|
|
3600
|
-
'"f"'
|
|
3601
|
-
],
|
|
3602
|
-
[
|
|
3603
|
-
'"g"'
|
|
3604
|
-
],
|
|
3605
|
-
[
|
|
3606
|
-
'"h"'
|
|
3607
|
-
],
|
|
3608
|
-
[
|
|
3609
|
-
'"i"'
|
|
3610
|
-
],
|
|
3611
|
-
[
|
|
3612
|
-
'"j"'
|
|
3613
|
-
],
|
|
3614
|
-
[
|
|
3615
|
-
'"k"'
|
|
3616
|
-
],
|
|
3617
|
-
[
|
|
3618
|
-
'"l"'
|
|
3619
|
-
],
|
|
3620
|
-
[
|
|
3621
|
-
'"m"'
|
|
3622
|
-
],
|
|
3623
|
-
[
|
|
3624
|
-
'"n"'
|
|
3625
|
-
],
|
|
3626
|
-
[
|
|
3627
|
-
'"o"'
|
|
3628
|
-
],
|
|
3629
|
-
[
|
|
3630
|
-
'"p"'
|
|
3631
|
-
],
|
|
3632
|
-
[
|
|
3633
|
-
'"q"'
|
|
3634
|
-
],
|
|
3635
|
-
[
|
|
3636
|
-
'"r"'
|
|
3637
|
-
],
|
|
3638
|
-
[
|
|
3639
|
-
'"s"'
|
|
3640
|
-
],
|
|
3641
|
-
[
|
|
3642
|
-
'"t"'
|
|
3643
|
-
],
|
|
3644
|
-
[
|
|
3645
|
-
'"u"'
|
|
3646
|
-
],
|
|
3647
|
-
[
|
|
3648
|
-
'"v"'
|
|
3649
|
-
],
|
|
3650
|
-
[
|
|
3651
|
-
'"w"'
|
|
3652
|
-
],
|
|
3653
|
-
[
|
|
3654
|
-
'"x"'
|
|
3655
|
-
],
|
|
3656
|
-
[
|
|
3657
|
-
'"y"'
|
|
3658
|
-
],
|
|
3659
|
-
[
|
|
3660
|
-
'"z"'
|
|
3661
|
-
]
|
|
3662
|
-
]
|
|
3663
|
-
},
|
|
3664
|
-
{
|
|
3665
|
-
name: "RULE_DIGIT",
|
|
3666
|
-
bnf: [
|
|
3667
|
-
[
|
|
3668
|
-
'"0"'
|
|
3669
|
-
],
|
|
3670
|
-
[
|
|
3671
|
-
'"1"'
|
|
3672
|
-
],
|
|
3673
|
-
[
|
|
3674
|
-
'"2"'
|
|
3675
|
-
],
|
|
3676
|
-
[
|
|
3677
|
-
'"3"'
|
|
3678
|
-
],
|
|
3679
|
-
[
|
|
3680
|
-
'"4"'
|
|
3681
|
-
],
|
|
3682
|
-
[
|
|
3683
|
-
'"5"'
|
|
3684
|
-
],
|
|
3685
|
-
[
|
|
3686
|
-
'"6"'
|
|
3687
|
-
],
|
|
3688
|
-
[
|
|
3689
|
-
'"7"'
|
|
3690
|
-
],
|
|
3691
|
-
[
|
|
3692
|
-
'"8"'
|
|
3693
|
-
],
|
|
3694
|
-
[
|
|
3695
|
-
'"9"'
|
|
3696
|
-
]
|
|
3697
|
-
]
|
|
3698
|
-
},
|
|
3699
|
-
{
|
|
3700
|
-
name: "RULE_SYMBOL",
|
|
3701
|
-
bnf: [
|
|
3702
|
-
[
|
|
3703
|
-
'"-"'
|
|
3704
|
-
],
|
|
3705
|
-
[
|
|
3706
|
-
'"_"'
|
|
3707
|
-
],
|
|
3708
|
-
[
|
|
3709
|
-
'"!"'
|
|
3710
|
-
],
|
|
3711
|
-
[
|
|
3712
|
-
'"#"'
|
|
3713
|
-
],
|
|
3714
|
-
[
|
|
3715
|
-
'"$"'
|
|
3716
|
-
],
|
|
3717
|
-
[
|
|
3718
|
-
'"%"'
|
|
3719
|
-
],
|
|
3720
|
-
[
|
|
3721
|
-
'"&"'
|
|
3722
|
-
],
|
|
3723
|
-
[
|
|
3724
|
-
'"("'
|
|
3725
|
-
],
|
|
3726
|
-
[
|
|
3727
|
-
'")"'
|
|
3728
|
-
],
|
|
3729
|
-
[
|
|
3730
|
-
'"*"'
|
|
3731
|
-
],
|
|
3732
|
-
[
|
|
3733
|
-
'"+"'
|
|
3734
|
-
],
|
|
3735
|
-
[
|
|
3736
|
-
'","'
|
|
3737
|
-
],
|
|
3738
|
-
[
|
|
3739
|
-
'"-"'
|
|
3740
|
-
],
|
|
3741
|
-
[
|
|
3742
|
-
'"."'
|
|
3743
|
-
],
|
|
3744
|
-
[
|
|
3745
|
-
'"/"'
|
|
3746
|
-
],
|
|
3747
|
-
[
|
|
3748
|
-
'":"'
|
|
3749
|
-
],
|
|
3750
|
-
[
|
|
3751
|
-
'";"'
|
|
3752
|
-
],
|
|
3753
|
-
[
|
|
3754
|
-
'"<"'
|
|
3755
|
-
],
|
|
3756
|
-
[
|
|
3757
|
-
'"="'
|
|
3758
|
-
],
|
|
3759
|
-
[
|
|
3760
|
-
'">"'
|
|
3761
|
-
],
|
|
3762
|
-
[
|
|
3763
|
-
'"?"'
|
|
3764
|
-
],
|
|
3765
|
-
[
|
|
3766
|
-
'"@"'
|
|
3767
|
-
],
|
|
3768
|
-
[
|
|
3769
|
-
'"["'
|
|
3770
|
-
],
|
|
3771
|
-
[
|
|
3772
|
-
'"\\"'
|
|
3773
|
-
],
|
|
3774
|
-
[
|
|
3775
|
-
'"]"'
|
|
3776
|
-
],
|
|
3777
|
-
[
|
|
3778
|
-
'"^"'
|
|
3779
|
-
],
|
|
3780
|
-
[
|
|
3781
|
-
'"_"'
|
|
3782
|
-
],
|
|
3783
|
-
[
|
|
3784
|
-
'"`"'
|
|
3785
|
-
],
|
|
3786
|
-
[
|
|
3787
|
-
'"{"'
|
|
3788
|
-
],
|
|
3789
|
-
[
|
|
3790
|
-
'"|"'
|
|
3791
|
-
],
|
|
3792
|
-
[
|
|
3793
|
-
'"}"'
|
|
3794
|
-
],
|
|
3795
|
-
[
|
|
3796
|
-
'"~"'
|
|
3797
|
-
]
|
|
3798
|
-
]
|
|
3799
|
-
},
|
|
3800
|
-
{
|
|
3801
|
-
name: "RULE_CHARACTER1",
|
|
3802
|
-
bnf: [
|
|
3803
|
-
[
|
|
3804
|
-
"RULE_CHARACTER"
|
|
3805
|
-
],
|
|
3806
|
-
[
|
|
3807
|
-
'"\'"'
|
|
3808
|
-
]
|
|
3809
|
-
]
|
|
3810
|
-
},
|
|
3811
|
-
{
|
|
3812
|
-
name: "RULE_CHARACTER2",
|
|
3813
|
-
bnf: [
|
|
3814
|
-
[
|
|
3815
|
-
"RULE_CHARACTER"
|
|
3816
|
-
],
|
|
3817
|
-
[
|
|
3818
|
-
"'\"'"
|
|
3819
|
-
]
|
|
3820
|
-
]
|
|
3821
|
-
},
|
|
3822
|
-
{
|
|
3823
|
-
name: "rule-name",
|
|
3824
|
-
bnf: [
|
|
3825
|
-
[
|
|
3826
|
-
"RULE_LETTER",
|
|
3827
|
-
"RULE_CHAR*"
|
|
3828
|
-
]
|
|
3829
|
-
]
|
|
3830
|
-
},
|
|
3831
|
-
{
|
|
3832
|
-
name: "RULE_CHAR",
|
|
3833
|
-
bnf: [
|
|
3834
|
-
[
|
|
3835
|
-
"RULE_LETTER"
|
|
3836
|
-
],
|
|
3837
|
-
[
|
|
3838
|
-
"RULE_DIGIT"
|
|
3839
|
-
],
|
|
3840
|
-
[
|
|
3841
|
-
'"_"'
|
|
3842
|
-
],
|
|
3843
|
-
[
|
|
3844
|
-
'"-"'
|
|
3845
|
-
]
|
|
3846
|
-
]
|
|
3847
|
-
}
|
|
3848
|
-
];
|
|
3849
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
3850
|
-
debug: false
|
|
3851
|
-
});
|
|
3852
|
-
function getAllTerms(expr) {
|
|
3853
|
-
var terms = SemanticHelpers_1.findChildrenByType(expr, "term").map(function(term) {
|
|
3854
|
-
return SemanticHelpers_1.findChildrenByType(term, "literal").concat(SemanticHelpers_1.findChildrenByType(term, "rule-name"))[0].text;
|
|
3855
|
-
});
|
|
3856
|
-
SemanticHelpers_1.findChildrenByType(expr, "list").forEach(function(expr2) {
|
|
3857
|
-
terms = terms.concat(getAllTerms(expr2));
|
|
3858
|
-
});
|
|
3859
|
-
return terms;
|
|
3860
|
-
}
|
|
3861
|
-
function getRules(source) {
|
|
3862
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
3863
|
-
var ast = parser2.getAST(source);
|
|
3864
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
3865
|
-
if (ast.errors && ast.errors.length) {
|
|
3866
|
-
throw ast.errors[0];
|
|
3867
|
-
}
|
|
3868
|
-
var rules = SemanticHelpers_1.findChildrenByType(ast, "rule");
|
|
3869
|
-
var ret = rules.map(function(rule) {
|
|
3870
|
-
var name = SemanticHelpers_1.findChildrenByType(rule, "rule-name")[0].text;
|
|
3871
|
-
var expressions = SemanticHelpers_1.findChildrenByType(rule, "firstExpression").concat(SemanticHelpers_1.findChildrenByType(rule, "otherExpression"));
|
|
3872
|
-
var bnf = [];
|
|
3873
|
-
expressions.forEach(function(expr) {
|
|
3874
|
-
bnf.push(getAllTerms(expr));
|
|
3875
|
-
});
|
|
3876
|
-
return {
|
|
3877
|
-
name: name,
|
|
3878
|
-
bnf: bnf
|
|
3879
|
-
};
|
|
3880
|
-
});
|
|
3881
|
-
if (!ret.some(function(x) {
|
|
3882
|
-
return x.name == "EOL";
|
|
3883
|
-
})) {
|
|
3884
|
-
ret.push({
|
|
3885
|
-
name: "EOL",
|
|
3886
|
-
bnf: [
|
|
3887
|
-
[
|
|
3888
|
-
'"\\r\\n"',
|
|
3889
|
-
'"\\r"',
|
|
3890
|
-
'"\\n"'
|
|
3891
|
-
]
|
|
3892
|
-
]
|
|
3893
|
-
});
|
|
3894
|
-
}
|
|
3895
|
-
return ret;
|
|
3896
|
-
}
|
|
3897
|
-
BNF2.getRules = getRules;
|
|
3898
|
-
function Transform(source) {
|
|
3899
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
3900
|
-
return getRules(source.join(""), subParser);
|
|
3901
|
-
}
|
|
3902
|
-
BNF2.Transform = Transform;
|
|
3903
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
3904
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
3905
|
-
var _super = _create_super(Parser2);
|
|
3906
|
-
function Parser2(source, options) {
|
|
3907
|
-
_class_call_check(this, Parser2);
|
|
3908
|
-
var _this;
|
|
3909
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
3910
|
-
debug: true
|
|
3911
|
-
}) : BNF2.defaultParser;
|
|
3912
|
-
_this = _super.call(this, getRules(source, subParser), options);
|
|
3913
|
-
_this.source = source;
|
|
3914
|
-
return _this;
|
|
3915
|
-
}
|
|
3916
|
-
_create_class(Parser2, [
|
|
3917
|
-
{
|
|
3918
|
-
key: "emitSource",
|
|
3919
|
-
value: function emitSource() {
|
|
3920
|
-
return this.source;
|
|
3921
|
-
}
|
|
3922
|
-
}
|
|
3923
|
-
]);
|
|
3924
|
-
return Parser2;
|
|
3925
|
-
}(Parser_1.Parser);
|
|
3926
|
-
BNF2.Parser = Parser2;
|
|
3927
|
-
})(BNF || (BNF = {}));
|
|
3928
|
-
exports.default = BNF;
|
|
3929
|
-
}
|
|
3930
|
-
});
|
|
3931
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/W3CEBNF.js
|
|
3932
|
-
var require_W3CEBNF = __commonJS({
|
|
3933
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/W3CEBNF.js": function(exports) {
|
|
3934
|
-
"use strict";
|
|
3935
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3936
|
-
value: true
|
|
3937
|
-
});
|
|
3938
|
-
var Parser_1 = require_Parser();
|
|
3939
|
-
var BNF;
|
|
3940
|
-
(function(BNF2) {
|
|
3941
|
-
BNF2.RULES = [
|
|
3942
|
-
{
|
|
3943
|
-
name: "Grammar",
|
|
3944
|
-
bnf: [
|
|
3945
|
-
[
|
|
3946
|
-
"RULE_S*",
|
|
3947
|
-
"%Atomic*",
|
|
3948
|
-
"EOF"
|
|
3949
|
-
]
|
|
3950
|
-
]
|
|
3951
|
-
},
|
|
3952
|
-
{
|
|
3953
|
-
name: "%Atomic",
|
|
3954
|
-
bnf: [
|
|
3955
|
-
[
|
|
3956
|
-
"Production",
|
|
3957
|
-
"RULE_S*"
|
|
3958
|
-
]
|
|
3959
|
-
],
|
|
3960
|
-
fragment: true
|
|
3961
|
-
},
|
|
3962
|
-
{
|
|
3963
|
-
name: "Production",
|
|
3964
|
-
bnf: [
|
|
3965
|
-
[
|
|
3966
|
-
"NCName",
|
|
3967
|
-
"RULE_S*",
|
|
3968
|
-
'"::="',
|
|
3969
|
-
"RULE_WHITESPACE*",
|
|
3970
|
-
"Choice",
|
|
3971
|
-
"RULE_WHITESPACE*",
|
|
3972
|
-
"RULE_EOL+",
|
|
3973
|
-
"RULE_S*"
|
|
3974
|
-
]
|
|
3975
|
-
]
|
|
3976
|
-
},
|
|
3977
|
-
{
|
|
3978
|
-
name: "NCName",
|
|
3979
|
-
bnf: [
|
|
3980
|
-
[
|
|
3981
|
-
/[a-zA-Z][a-zA-Z_0-9]*/
|
|
3982
|
-
]
|
|
3983
|
-
]
|
|
3984
|
-
},
|
|
3985
|
-
{
|
|
3986
|
-
name: "Choice",
|
|
3987
|
-
bnf: [
|
|
3988
|
-
[
|
|
3989
|
-
"SequenceOrDifference",
|
|
3990
|
-
"%_Choice_1*"
|
|
3991
|
-
]
|
|
3992
|
-
],
|
|
3993
|
-
fragment: true
|
|
3994
|
-
},
|
|
3995
|
-
{
|
|
3996
|
-
name: "%_Choice_1",
|
|
3997
|
-
bnf: [
|
|
3998
|
-
[
|
|
3999
|
-
"RULE_WHITESPACE*",
|
|
4000
|
-
'"|"',
|
|
4001
|
-
"RULE_WHITESPACE*",
|
|
4002
|
-
"SequenceOrDifference"
|
|
4003
|
-
]
|
|
4004
|
-
],
|
|
4005
|
-
fragment: true
|
|
4006
|
-
},
|
|
4007
|
-
{
|
|
4008
|
-
name: "SequenceOrDifference",
|
|
4009
|
-
bnf: [
|
|
4010
|
-
[
|
|
4011
|
-
"Item",
|
|
4012
|
-
"RULE_WHITESPACE*",
|
|
4013
|
-
"%_Item_1?"
|
|
4014
|
-
]
|
|
4015
|
-
]
|
|
4016
|
-
},
|
|
4017
|
-
{
|
|
4018
|
-
name: "%_Item_1",
|
|
4019
|
-
bnf: [
|
|
4020
|
-
[
|
|
4021
|
-
"Minus",
|
|
4022
|
-
"Item"
|
|
4023
|
-
],
|
|
4024
|
-
[
|
|
4025
|
-
"Item*"
|
|
4026
|
-
]
|
|
4027
|
-
],
|
|
4028
|
-
fragment: true
|
|
4029
|
-
},
|
|
4030
|
-
{
|
|
4031
|
-
name: "Minus",
|
|
4032
|
-
bnf: [
|
|
4033
|
-
[
|
|
4034
|
-
'"-"'
|
|
4035
|
-
]
|
|
4036
|
-
]
|
|
4037
|
-
},
|
|
4038
|
-
{
|
|
4039
|
-
name: "Item",
|
|
4040
|
-
bnf: [
|
|
4041
|
-
[
|
|
4042
|
-
"RULE_WHITESPACE*",
|
|
4043
|
-
"%Primary",
|
|
4044
|
-
"PrimaryDecoration?"
|
|
4045
|
-
]
|
|
4046
|
-
],
|
|
4047
|
-
fragment: true
|
|
4048
|
-
},
|
|
4049
|
-
{
|
|
4050
|
-
name: "PrimaryDecoration",
|
|
4051
|
-
bnf: [
|
|
4052
|
-
[
|
|
4053
|
-
'"?"'
|
|
4054
|
-
],
|
|
4055
|
-
[
|
|
4056
|
-
'"*"'
|
|
4057
|
-
],
|
|
4058
|
-
[
|
|
4059
|
-
'"+"'
|
|
4060
|
-
]
|
|
4061
|
-
]
|
|
4062
|
-
},
|
|
4063
|
-
{
|
|
4064
|
-
name: "DecorationName",
|
|
4065
|
-
bnf: [
|
|
4066
|
-
[
|
|
4067
|
-
'"ebnf://"',
|
|
4068
|
-
/[^\x5D#]+/
|
|
4069
|
-
]
|
|
4070
|
-
]
|
|
4071
|
-
},
|
|
4072
|
-
{
|
|
4073
|
-
name: "%Primary",
|
|
4074
|
-
bnf: [
|
|
4075
|
-
[
|
|
4076
|
-
"NCName"
|
|
4077
|
-
],
|
|
4078
|
-
[
|
|
4079
|
-
"StringLiteral"
|
|
4080
|
-
],
|
|
4081
|
-
[
|
|
4082
|
-
"CharCode"
|
|
4083
|
-
],
|
|
4084
|
-
[
|
|
4085
|
-
"CharClass"
|
|
4086
|
-
],
|
|
4087
|
-
[
|
|
4088
|
-
"SubItem"
|
|
4089
|
-
]
|
|
4090
|
-
],
|
|
4091
|
-
fragment: true
|
|
4092
|
-
},
|
|
4093
|
-
{
|
|
4094
|
-
name: "SubItem",
|
|
4095
|
-
bnf: [
|
|
4096
|
-
[
|
|
4097
|
-
'"("',
|
|
4098
|
-
"RULE_WHITESPACE*",
|
|
4099
|
-
"Choice",
|
|
4100
|
-
"RULE_WHITESPACE*",
|
|
4101
|
-
'")"'
|
|
4102
|
-
]
|
|
4103
|
-
]
|
|
4104
|
-
},
|
|
4105
|
-
{
|
|
4106
|
-
name: "StringLiteral",
|
|
4107
|
-
bnf: [
|
|
4108
|
-
[
|
|
4109
|
-
"'\"'",
|
|
4110
|
-
/[^"]*/,
|
|
4111
|
-
"'\"'"
|
|
4112
|
-
],
|
|
4113
|
-
[
|
|
4114
|
-
'"\'"',
|
|
4115
|
-
/[^']*/,
|
|
4116
|
-
'"\'"'
|
|
4117
|
-
]
|
|
4118
|
-
],
|
|
4119
|
-
pinned: 1
|
|
4120
|
-
},
|
|
4121
|
-
{
|
|
4122
|
-
name: "CharCode",
|
|
4123
|
-
bnf: [
|
|
4124
|
-
[
|
|
4125
|
-
'"#x"',
|
|
4126
|
-
/[0-9a-zA-Z]+/
|
|
4127
|
-
]
|
|
4128
|
-
]
|
|
4129
|
-
},
|
|
4130
|
-
{
|
|
4131
|
-
name: "CharClass",
|
|
4132
|
-
bnf: [
|
|
4133
|
-
[
|
|
4134
|
-
"'['",
|
|
4135
|
-
"'^'?",
|
|
4136
|
-
"%RULE_CharClass_1+",
|
|
4137
|
-
'"]"'
|
|
4138
|
-
]
|
|
4139
|
-
]
|
|
4140
|
-
},
|
|
4141
|
-
{
|
|
4142
|
-
name: "%RULE_CharClass_1",
|
|
4143
|
-
bnf: [
|
|
4144
|
-
[
|
|
4145
|
-
"CharCodeRange"
|
|
4146
|
-
],
|
|
4147
|
-
[
|
|
4148
|
-
"CharRange"
|
|
4149
|
-
],
|
|
4150
|
-
[
|
|
4151
|
-
"CharCode"
|
|
4152
|
-
],
|
|
4153
|
-
[
|
|
4154
|
-
"RULE_Char"
|
|
4155
|
-
]
|
|
4156
|
-
],
|
|
4157
|
-
fragment: true
|
|
4158
|
-
},
|
|
4159
|
-
{
|
|
4160
|
-
name: "RULE_Char",
|
|
4161
|
-
bnf: [
|
|
4162
|
-
[
|
|
4163
|
-
/\x09/
|
|
4164
|
-
],
|
|
4165
|
-
[
|
|
4166
|
-
/\x0A/
|
|
4167
|
-
],
|
|
4168
|
-
[
|
|
4169
|
-
/\x0D/
|
|
4170
|
-
],
|
|
4171
|
-
[
|
|
4172
|
-
/[\x20-\x5c]/
|
|
4173
|
-
],
|
|
4174
|
-
[
|
|
4175
|
-
/[\x5e-\uD7FF]/
|
|
4176
|
-
],
|
|
4177
|
-
[
|
|
4178
|
-
/[\uE000-\uFFFD]/
|
|
4179
|
-
]
|
|
4180
|
-
]
|
|
4181
|
-
},
|
|
4182
|
-
{
|
|
4183
|
-
name: "CharRange",
|
|
4184
|
-
bnf: [
|
|
4185
|
-
[
|
|
4186
|
-
"RULE_Char",
|
|
4187
|
-
'"-"',
|
|
4188
|
-
"RULE_Char"
|
|
4189
|
-
]
|
|
4190
|
-
]
|
|
4191
|
-
},
|
|
4192
|
-
{
|
|
4193
|
-
name: "CharCodeRange",
|
|
4194
|
-
bnf: [
|
|
4195
|
-
[
|
|
4196
|
-
"CharCode",
|
|
4197
|
-
'"-"',
|
|
4198
|
-
"CharCode"
|
|
4199
|
-
]
|
|
4200
|
-
]
|
|
4201
|
-
},
|
|
4202
|
-
{
|
|
4203
|
-
name: "RULE_WHITESPACE",
|
|
4204
|
-
bnf: [
|
|
4205
|
-
[
|
|
4206
|
-
"%RULE_WHITESPACE_CHAR*"
|
|
4207
|
-
],
|
|
4208
|
-
[
|
|
4209
|
-
"Comment",
|
|
4210
|
-
"RULE_WHITESPACE*"
|
|
4211
|
-
]
|
|
4212
|
-
]
|
|
4213
|
-
},
|
|
4214
|
-
{
|
|
4215
|
-
name: "RULE_S",
|
|
4216
|
-
bnf: [
|
|
4217
|
-
[
|
|
4218
|
-
"RULE_WHITESPACE",
|
|
4219
|
-
"RULE_S*"
|
|
4220
|
-
],
|
|
4221
|
-
[
|
|
4222
|
-
"RULE_EOL",
|
|
4223
|
-
"RULE_S*"
|
|
4224
|
-
]
|
|
4225
|
-
]
|
|
4226
|
-
},
|
|
4227
|
-
{
|
|
4228
|
-
name: "%RULE_WHITESPACE_CHAR",
|
|
4229
|
-
bnf: [
|
|
4230
|
-
[
|
|
4231
|
-
/\x09/
|
|
4232
|
-
],
|
|
4233
|
-
[
|
|
4234
|
-
/\x20/
|
|
4235
|
-
]
|
|
4236
|
-
],
|
|
4237
|
-
fragment: true
|
|
4238
|
-
},
|
|
4239
|
-
{
|
|
4240
|
-
name: "Comment",
|
|
4241
|
-
bnf: [
|
|
4242
|
-
[
|
|
4243
|
-
'"/*"',
|
|
4244
|
-
"%RULE_Comment_Body*",
|
|
4245
|
-
'"*/"'
|
|
4246
|
-
]
|
|
4247
|
-
]
|
|
4248
|
-
},
|
|
4249
|
-
{
|
|
4250
|
-
name: "%RULE_Comment_Body",
|
|
4251
|
-
bnf: [
|
|
4252
|
-
[
|
|
4253
|
-
'!"*/"',
|
|
4254
|
-
/[^*]/
|
|
4255
|
-
]
|
|
4256
|
-
],
|
|
4257
|
-
fragment: true
|
|
4258
|
-
},
|
|
4259
|
-
{
|
|
4260
|
-
name: "RULE_EOL",
|
|
4261
|
-
bnf: [
|
|
4262
|
-
[
|
|
4263
|
-
/\x0D/,
|
|
4264
|
-
/\x0A/
|
|
4265
|
-
],
|
|
4266
|
-
[
|
|
4267
|
-
/\x0A/
|
|
4268
|
-
],
|
|
4269
|
-
[
|
|
4270
|
-
/\x0D/
|
|
4271
|
-
]
|
|
4272
|
-
]
|
|
4273
|
-
},
|
|
4274
|
-
{
|
|
4275
|
-
name: "Link",
|
|
4276
|
-
bnf: [
|
|
4277
|
-
[
|
|
4278
|
-
"'['",
|
|
4279
|
-
"Url",
|
|
4280
|
-
"']'"
|
|
4281
|
-
]
|
|
4282
|
-
]
|
|
4283
|
-
},
|
|
4284
|
-
{
|
|
4285
|
-
name: "Url",
|
|
4286
|
-
bnf: [
|
|
4287
|
-
[
|
|
4288
|
-
/[^\x5D:/?#]/,
|
|
4289
|
-
'"://"',
|
|
4290
|
-
/[^\x5D#]+/,
|
|
4291
|
-
"%Url1?"
|
|
4292
|
-
]
|
|
4293
|
-
]
|
|
4294
|
-
},
|
|
4295
|
-
{
|
|
4296
|
-
name: "%Url1",
|
|
4297
|
-
bnf: [
|
|
4298
|
-
[
|
|
4299
|
-
'"#"',
|
|
4300
|
-
"NCName"
|
|
4301
|
-
]
|
|
4302
|
-
],
|
|
4303
|
-
fragment: true
|
|
4304
|
-
}
|
|
4305
|
-
];
|
|
4306
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
4307
|
-
debug: false
|
|
4308
|
-
});
|
|
4309
|
-
var preDecorationRE = /^(!|&)/;
|
|
4310
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
4311
|
-
var subExpressionRE = /^%/;
|
|
4312
|
-
function getBNFRule(name, parser2) {
|
|
4313
|
-
if (typeof name == "string") {
|
|
4314
|
-
if (preDecorationRE.test(name)) return "";
|
|
4315
|
-
var subexpression = subExpressionRE.test(name);
|
|
4316
|
-
if (subexpression) {
|
|
4317
|
-
var decoration = decorationRE.exec(name);
|
|
4318
|
-
var decorationText = decoration ? decoration[0] + " " : "";
|
|
4319
|
-
var lonely = isLonelyRule(name, parser2);
|
|
4320
|
-
if (lonely) return getBNFBody(name, parser2) + decorationText;
|
|
4321
|
-
return "(" + getBNFBody(name, parser2) + ")" + decorationText;
|
|
4322
|
-
}
|
|
4323
|
-
return name;
|
|
4324
|
-
} else {
|
|
4325
|
-
return name.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g, "#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g, "[#x$1-#x$2]");
|
|
4326
|
-
}
|
|
4327
|
-
}
|
|
4328
|
-
function isLonelyRule(name, parser2) {
|
|
4329
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4330
|
-
return rule && rule.bnf.length == 1 && rule.bnf[0].length == 1 && (_instanceof(rule.bnf[0][0], RegExp) || rule.bnf[0][0][0] == '"' || rule.bnf[0][0][0] == "'");
|
|
4331
|
-
}
|
|
4332
|
-
function getBNFChoice(rules, parser2) {
|
|
4333
|
-
return rules.map(function(x) {
|
|
4334
|
-
return getBNFRule(x, parser2);
|
|
4335
|
-
}).join(" ");
|
|
4336
|
-
}
|
|
4337
|
-
function getBNFBody(name, parser2) {
|
|
4338
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4339
|
-
if (rule) return rule.bnf.map(function(x) {
|
|
4340
|
-
return getBNFChoice(x, parser2);
|
|
4341
|
-
}).join(" | ");
|
|
4342
|
-
return "RULE_NOT_FOUND {" + name + "}";
|
|
4343
|
-
}
|
|
4344
|
-
function emit(parser2) {
|
|
4345
|
-
var acumulator = [];
|
|
4346
|
-
parser2.grammarRules.forEach(function(l) {
|
|
4347
|
-
if (!/^%/.test(l.name)) {
|
|
4348
|
-
var recover = l.recover ? " /* { recoverUntil=" + l.recover + " } */" : "";
|
|
4349
|
-
acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser2) + recover);
|
|
4350
|
-
}
|
|
4351
|
-
});
|
|
4352
|
-
return acumulator.join("\n");
|
|
4353
|
-
}
|
|
4354
|
-
BNF2.emit = emit;
|
|
4355
|
-
var subitems = 0;
|
|
4356
|
-
function restar(total, resta) {
|
|
4357
|
-
console.log("reberia restar " + resta + " a " + total);
|
|
4358
|
-
throw new Error("Difference not supported yet");
|
|
4359
|
-
}
|
|
4360
|
-
function convertRegex(txt) {
|
|
4361
|
-
return new RegExp(txt.replace(/#x([a-zA-Z0-9]{4})/g, "\\u$1").replace(/#x([a-zA-Z0-9]{3})/g, "\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g, "\\x$1").replace(/#x([a-zA-Z0-9]{1})/g, "\\x0$1"));
|
|
4362
|
-
}
|
|
4363
|
-
function getSubItems(tmpRules, seq, parentName) {
|
|
4364
|
-
var anterior = null;
|
|
4365
|
-
var bnfSeq = [];
|
|
4366
|
-
seq.children.forEach(function(x, i) {
|
|
4367
|
-
if (x.type == "Minus") {
|
|
4368
|
-
restar(anterior, x);
|
|
4369
|
-
} else {}
|
|
4370
|
-
var decoration = seq.children[i + 1];
|
|
4371
|
-
decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || "";
|
|
4372
|
-
var preDecoration = "";
|
|
4373
|
-
switch(x.type){
|
|
4374
|
-
case "SubItem":
|
|
4375
|
-
var name = "%" + (parentName + subitems++);
|
|
4376
|
-
createRule(tmpRules, x, name);
|
|
4377
|
-
bnfSeq.push(preDecoration + name + decoration);
|
|
4378
|
-
break;
|
|
4379
|
-
case "NCName":
|
|
4380
|
-
case "StringLiteral":
|
|
4381
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
4382
|
-
break;
|
|
4383
|
-
case "CharCode":
|
|
4384
|
-
case "CharClass":
|
|
4385
|
-
if (decoration || preDecoration) {
|
|
4386
|
-
var newRule = {
|
|
4387
|
-
name: "%" + (parentName + subitems++),
|
|
4388
|
-
bnf: [
|
|
4389
|
-
[
|
|
4390
|
-
convertRegex(x.text)
|
|
4391
|
-
]
|
|
4392
|
-
]
|
|
4393
|
-
};
|
|
4394
|
-
tmpRules.push(newRule);
|
|
4395
|
-
bnfSeq.push(preDecoration + newRule.name + decoration);
|
|
4396
|
-
} else {
|
|
4397
|
-
bnfSeq.push(convertRegex(x.text));
|
|
4398
|
-
}
|
|
4399
|
-
break;
|
|
4400
|
-
case "PrimaryDecoration":
|
|
4401
|
-
break;
|
|
4402
|
-
default:
|
|
4403
|
-
throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text));
|
|
4404
|
-
}
|
|
4405
|
-
anterior = x;
|
|
4406
|
-
});
|
|
4407
|
-
return bnfSeq;
|
|
4408
|
-
}
|
|
4409
|
-
function createRule(tmpRules, token, name) {
|
|
4410
|
-
var bnf = token.children.filter(function(x) {
|
|
4411
|
-
return x.type == "SequenceOrDifference";
|
|
4412
|
-
}).map(function(s) {
|
|
4413
|
-
return getSubItems(tmpRules, s, name);
|
|
4414
|
-
});
|
|
4415
|
-
var rule = {
|
|
4416
|
-
name: name,
|
|
4417
|
-
bnf: bnf
|
|
4418
|
-
};
|
|
4419
|
-
var recover = null;
|
|
4420
|
-
bnf.forEach(function(x) {
|
|
4421
|
-
recover = recover || x["recover"];
|
|
4422
|
-
delete x["recover"];
|
|
4423
|
-
});
|
|
4424
|
-
if (name.indexOf("%") == 0) rule.fragment = true;
|
|
4425
|
-
if (recover) rule.recover = recover;
|
|
4426
|
-
tmpRules.push(rule);
|
|
4427
|
-
}
|
|
4428
|
-
function getRules(source) {
|
|
4429
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
4430
|
-
var ast = parser2.getAST(source);
|
|
4431
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
4432
|
-
if (ast.errors && ast.errors.length) {
|
|
4433
|
-
throw ast.errors[0];
|
|
4434
|
-
}
|
|
4435
|
-
var tmpRules = [];
|
|
4436
|
-
ast.children.filter(function(x) {
|
|
4437
|
-
return x.type == "Production";
|
|
4438
|
-
}).map(function(x) {
|
|
4439
|
-
var name = x.children.filter(function(x2) {
|
|
4440
|
-
return x2.type == "NCName";
|
|
4441
|
-
})[0].text;
|
|
4442
|
-
createRule(tmpRules, x, name);
|
|
4443
|
-
});
|
|
4444
|
-
return tmpRules;
|
|
4445
|
-
}
|
|
4446
|
-
BNF2.getRules = getRules;
|
|
4447
|
-
function Transform(source) {
|
|
4448
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
4449
|
-
return getRules(source.join(""), subParser);
|
|
4450
|
-
}
|
|
4451
|
-
BNF2.Transform = Transform;
|
|
4452
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
4453
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
4454
|
-
var _super = _create_super(Parser2);
|
|
4455
|
-
function Parser2(source, options) {
|
|
4456
|
-
_class_call_check(this, Parser2);
|
|
4457
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
4458
|
-
debug: true
|
|
4459
|
-
}) : BNF2.defaultParser;
|
|
4460
|
-
return _super.call(this, getRules(source, subParser), options);
|
|
4461
|
-
}
|
|
4462
|
-
_create_class(Parser2, [
|
|
4463
|
-
{
|
|
4464
|
-
key: "emitSource",
|
|
4465
|
-
value: function emitSource() {
|
|
4466
|
-
return emit(this);
|
|
4467
|
-
}
|
|
4468
|
-
}
|
|
4469
|
-
]);
|
|
4470
|
-
return Parser2;
|
|
4471
|
-
}(Parser_1.Parser);
|
|
4472
|
-
BNF2.Parser = Parser2;
|
|
4473
|
-
})(BNF || (BNF = {}));
|
|
4474
|
-
exports.default = BNF;
|
|
4475
|
-
}
|
|
4476
|
-
});
|
|
4477
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/Custom.js
|
|
4478
|
-
var require_Custom = __commonJS({
|
|
4479
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/Custom.js": function(exports) {
|
|
4480
|
-
"use strict";
|
|
4481
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4482
|
-
value: true
|
|
4483
|
-
});
|
|
4484
|
-
var TokenError_1 = require_TokenError();
|
|
4485
|
-
var Parser_1 = require_Parser();
|
|
4486
|
-
var BNF;
|
|
4487
|
-
(function(BNF2) {
|
|
4488
|
-
BNF2.RULES = [
|
|
4489
|
-
{
|
|
4490
|
-
name: "Grammar",
|
|
4491
|
-
bnf: [
|
|
4492
|
-
[
|
|
4493
|
-
"RULE_S*",
|
|
4494
|
-
"Attributes?",
|
|
4495
|
-
"RULE_S*",
|
|
4496
|
-
"%Atomic*",
|
|
4497
|
-
"EOF"
|
|
4498
|
-
]
|
|
4499
|
-
]
|
|
4500
|
-
},
|
|
4501
|
-
{
|
|
4502
|
-
name: "%Atomic",
|
|
4503
|
-
bnf: [
|
|
4504
|
-
[
|
|
4505
|
-
"Production",
|
|
4506
|
-
"RULE_S*"
|
|
4507
|
-
]
|
|
4508
|
-
],
|
|
4509
|
-
fragment: true
|
|
4510
|
-
},
|
|
4511
|
-
{
|
|
4512
|
-
name: "Production",
|
|
4513
|
-
bnf: [
|
|
4514
|
-
[
|
|
4515
|
-
"NCName",
|
|
4516
|
-
"RULE_S*",
|
|
4517
|
-
'"::="',
|
|
4518
|
-
"RULE_WHITESPACE*",
|
|
4519
|
-
"%Choice",
|
|
4520
|
-
"RULE_WHITESPACE*",
|
|
4521
|
-
"Attributes?",
|
|
4522
|
-
"RULE_EOL+",
|
|
4523
|
-
"RULE_S*"
|
|
4524
|
-
]
|
|
4525
|
-
]
|
|
4526
|
-
},
|
|
4527
|
-
{
|
|
4528
|
-
name: "NCName",
|
|
4529
|
-
bnf: [
|
|
4530
|
-
[
|
|
4531
|
-
/[a-zA-Z][a-zA-Z_0-9]*/
|
|
4532
|
-
]
|
|
4533
|
-
]
|
|
4534
|
-
},
|
|
4535
|
-
{
|
|
4536
|
-
name: "Attributes",
|
|
4537
|
-
bnf: [
|
|
4538
|
-
[
|
|
4539
|
-
'"{"',
|
|
4540
|
-
"Attribute",
|
|
4541
|
-
"%Attributes*",
|
|
4542
|
-
"RULE_S*",
|
|
4543
|
-
'"}"'
|
|
4544
|
-
]
|
|
4545
|
-
]
|
|
4546
|
-
},
|
|
4547
|
-
{
|
|
4548
|
-
name: "%Attributes",
|
|
4549
|
-
bnf: [
|
|
4550
|
-
[
|
|
4551
|
-
"RULE_S*",
|
|
4552
|
-
'","',
|
|
4553
|
-
"Attribute"
|
|
4554
|
-
]
|
|
4555
|
-
],
|
|
4556
|
-
fragment: true
|
|
4557
|
-
},
|
|
4558
|
-
{
|
|
4559
|
-
name: "Attribute",
|
|
4560
|
-
bnf: [
|
|
4561
|
-
[
|
|
4562
|
-
"RULE_S*",
|
|
4563
|
-
"NCName",
|
|
4564
|
-
"RULE_WHITESPACE*",
|
|
4565
|
-
'"="',
|
|
4566
|
-
"RULE_WHITESPACE*",
|
|
4567
|
-
"AttributeValue"
|
|
4568
|
-
]
|
|
4569
|
-
]
|
|
4570
|
-
},
|
|
4571
|
-
{
|
|
4572
|
-
name: "AttributeValue",
|
|
4573
|
-
bnf: [
|
|
4574
|
-
[
|
|
4575
|
-
"NCName"
|
|
4576
|
-
],
|
|
4577
|
-
[
|
|
4578
|
-
/[1-9][0-9]*/
|
|
4579
|
-
]
|
|
4580
|
-
]
|
|
4581
|
-
},
|
|
4582
|
-
{
|
|
4583
|
-
name: "%Choice",
|
|
4584
|
-
bnf: [
|
|
4585
|
-
[
|
|
4586
|
-
"SequenceOrDifference",
|
|
4587
|
-
"%_Choice_1*"
|
|
4588
|
-
]
|
|
4589
|
-
],
|
|
4590
|
-
fragment: true
|
|
4591
|
-
},
|
|
4592
|
-
{
|
|
4593
|
-
name: "%_Choice_1",
|
|
4594
|
-
bnf: [
|
|
4595
|
-
[
|
|
4596
|
-
"RULE_S*",
|
|
4597
|
-
'"|"',
|
|
4598
|
-
"RULE_S*",
|
|
4599
|
-
"SequenceOrDifference"
|
|
4600
|
-
]
|
|
4601
|
-
],
|
|
4602
|
-
fragment: true
|
|
4603
|
-
},
|
|
4604
|
-
{
|
|
4605
|
-
name: "SequenceOrDifference",
|
|
4606
|
-
bnf: [
|
|
4607
|
-
[
|
|
4608
|
-
"%Item",
|
|
4609
|
-
"RULE_WHITESPACE*",
|
|
4610
|
-
"%_Item_1?"
|
|
4611
|
-
]
|
|
4612
|
-
]
|
|
4613
|
-
},
|
|
4614
|
-
{
|
|
4615
|
-
name: "%_Item_1",
|
|
4616
|
-
bnf: [
|
|
4617
|
-
[
|
|
4618
|
-
"Minus",
|
|
4619
|
-
"%Item"
|
|
4620
|
-
],
|
|
4621
|
-
[
|
|
4622
|
-
"%Item*"
|
|
4623
|
-
]
|
|
4624
|
-
],
|
|
4625
|
-
fragment: true
|
|
4626
|
-
},
|
|
4627
|
-
{
|
|
4628
|
-
name: "Minus",
|
|
4629
|
-
bnf: [
|
|
4630
|
-
[
|
|
4631
|
-
'"-"'
|
|
4632
|
-
]
|
|
4633
|
-
]
|
|
4634
|
-
},
|
|
4635
|
-
{
|
|
4636
|
-
name: "%Item",
|
|
4637
|
-
bnf: [
|
|
4638
|
-
[
|
|
4639
|
-
"RULE_WHITESPACE*",
|
|
4640
|
-
"PrimaryPreDecoration?",
|
|
4641
|
-
"%Primary",
|
|
4642
|
-
"PrimaryDecoration?"
|
|
4643
|
-
]
|
|
4644
|
-
],
|
|
4645
|
-
fragment: true
|
|
4646
|
-
},
|
|
4647
|
-
{
|
|
4648
|
-
name: "PrimaryDecoration",
|
|
4649
|
-
bnf: [
|
|
4650
|
-
[
|
|
4651
|
-
'"?"'
|
|
4652
|
-
],
|
|
4653
|
-
[
|
|
4654
|
-
'"*"'
|
|
4655
|
-
],
|
|
4656
|
-
[
|
|
4657
|
-
'"+"'
|
|
4658
|
-
]
|
|
4659
|
-
]
|
|
4660
|
-
},
|
|
4661
|
-
{
|
|
4662
|
-
name: "PrimaryPreDecoration",
|
|
4663
|
-
bnf: [
|
|
4664
|
-
[
|
|
4665
|
-
'"&"'
|
|
4666
|
-
],
|
|
4667
|
-
[
|
|
4668
|
-
'"!"'
|
|
4669
|
-
],
|
|
4670
|
-
[
|
|
4671
|
-
'"~"'
|
|
4672
|
-
]
|
|
4673
|
-
]
|
|
4674
|
-
},
|
|
4675
|
-
{
|
|
4676
|
-
name: "%Primary",
|
|
4677
|
-
bnf: [
|
|
4678
|
-
[
|
|
4679
|
-
"NCName"
|
|
4680
|
-
],
|
|
4681
|
-
[
|
|
4682
|
-
"StringLiteral"
|
|
4683
|
-
],
|
|
4684
|
-
[
|
|
4685
|
-
"CharCode"
|
|
4686
|
-
],
|
|
4687
|
-
[
|
|
4688
|
-
"CharClass"
|
|
4689
|
-
],
|
|
4690
|
-
[
|
|
4691
|
-
"SubItem"
|
|
4692
|
-
]
|
|
4693
|
-
],
|
|
4694
|
-
fragment: true
|
|
4695
|
-
},
|
|
4696
|
-
{
|
|
4697
|
-
name: "SubItem",
|
|
4698
|
-
bnf: [
|
|
4699
|
-
[
|
|
4700
|
-
'"("',
|
|
4701
|
-
"RULE_S*",
|
|
4702
|
-
"%Choice",
|
|
4703
|
-
"RULE_S*",
|
|
4704
|
-
'")"'
|
|
4705
|
-
]
|
|
4706
|
-
]
|
|
4707
|
-
},
|
|
4708
|
-
{
|
|
4709
|
-
name: "StringLiteral",
|
|
4710
|
-
bnf: [
|
|
4711
|
-
[
|
|
4712
|
-
"'\"'",
|
|
4713
|
-
/[^"]*/,
|
|
4714
|
-
"'\"'"
|
|
4715
|
-
],
|
|
4716
|
-
[
|
|
4717
|
-
'"\'"',
|
|
4718
|
-
/[^']*/,
|
|
4719
|
-
'"\'"'
|
|
4720
|
-
]
|
|
4721
|
-
]
|
|
4722
|
-
},
|
|
4723
|
-
{
|
|
4724
|
-
name: "CharCode",
|
|
4725
|
-
bnf: [
|
|
4726
|
-
[
|
|
4727
|
-
'"#x"',
|
|
4728
|
-
/[0-9a-zA-Z]+/
|
|
4729
|
-
]
|
|
4730
|
-
]
|
|
4731
|
-
},
|
|
4732
|
-
{
|
|
4733
|
-
name: "CharClass",
|
|
4734
|
-
bnf: [
|
|
4735
|
-
[
|
|
4736
|
-
"'['",
|
|
4737
|
-
"'^'?",
|
|
4738
|
-
"%RULE_CharClass_1+",
|
|
4739
|
-
'"]"'
|
|
4740
|
-
]
|
|
4741
|
-
]
|
|
4742
|
-
},
|
|
4743
|
-
{
|
|
4744
|
-
name: "%RULE_CharClass_1",
|
|
4745
|
-
bnf: [
|
|
4746
|
-
[
|
|
4747
|
-
"CharCodeRange"
|
|
4748
|
-
],
|
|
4749
|
-
[
|
|
4750
|
-
"CharRange"
|
|
4751
|
-
],
|
|
4752
|
-
[
|
|
4753
|
-
"CharCode"
|
|
4754
|
-
],
|
|
4755
|
-
[
|
|
4756
|
-
"RULE_Char"
|
|
4757
|
-
]
|
|
4758
|
-
],
|
|
4759
|
-
fragment: true
|
|
4760
|
-
},
|
|
4761
|
-
{
|
|
4762
|
-
name: "RULE_Char",
|
|
4763
|
-
bnf: [
|
|
4764
|
-
[
|
|
4765
|
-
/\x09/
|
|
4766
|
-
],
|
|
4767
|
-
[
|
|
4768
|
-
/\x0A/
|
|
4769
|
-
],
|
|
4770
|
-
[
|
|
4771
|
-
/\x0D/
|
|
4772
|
-
],
|
|
4773
|
-
[
|
|
4774
|
-
/[\x20-\x5c]/
|
|
4775
|
-
],
|
|
4776
|
-
[
|
|
4777
|
-
/[\x5e-\uD7FF]/
|
|
4778
|
-
],
|
|
4779
|
-
[
|
|
4780
|
-
/[\uE000-\uFFFD]/
|
|
4781
|
-
]
|
|
4782
|
-
]
|
|
4783
|
-
},
|
|
4784
|
-
{
|
|
4785
|
-
name: "CharRange",
|
|
4786
|
-
bnf: [
|
|
4787
|
-
[
|
|
4788
|
-
"RULE_Char",
|
|
4789
|
-
'"-"',
|
|
4790
|
-
"RULE_Char"
|
|
4791
|
-
]
|
|
4792
|
-
]
|
|
4793
|
-
},
|
|
4794
|
-
{
|
|
4795
|
-
name: "CharCodeRange",
|
|
4796
|
-
bnf: [
|
|
4797
|
-
[
|
|
4798
|
-
"CharCode",
|
|
4799
|
-
'"-"',
|
|
4800
|
-
"CharCode"
|
|
4801
|
-
]
|
|
4802
|
-
]
|
|
4803
|
-
},
|
|
4804
|
-
{
|
|
4805
|
-
name: "RULE_WHITESPACE",
|
|
4806
|
-
bnf: [
|
|
4807
|
-
[
|
|
4808
|
-
"%RULE_WHITESPACE_CHAR*"
|
|
4809
|
-
],
|
|
4810
|
-
[
|
|
4811
|
-
"Comment",
|
|
4812
|
-
"RULE_WHITESPACE*"
|
|
4813
|
-
]
|
|
4814
|
-
]
|
|
4815
|
-
},
|
|
4816
|
-
{
|
|
4817
|
-
name: "RULE_S",
|
|
4818
|
-
bnf: [
|
|
4819
|
-
[
|
|
4820
|
-
"RULE_WHITESPACE",
|
|
4821
|
-
"RULE_S*"
|
|
4822
|
-
],
|
|
4823
|
-
[
|
|
4824
|
-
"RULE_EOL",
|
|
4825
|
-
"RULE_S*"
|
|
4826
|
-
]
|
|
4827
|
-
]
|
|
4828
|
-
},
|
|
4829
|
-
{
|
|
4830
|
-
name: "%RULE_WHITESPACE_CHAR",
|
|
4831
|
-
bnf: [
|
|
4832
|
-
[
|
|
4833
|
-
/\x09/
|
|
4834
|
-
],
|
|
4835
|
-
[
|
|
4836
|
-
/\x20/
|
|
4837
|
-
]
|
|
4838
|
-
],
|
|
4839
|
-
fragment: true
|
|
4840
|
-
},
|
|
4841
|
-
{
|
|
4842
|
-
name: "Comment",
|
|
4843
|
-
bnf: [
|
|
4844
|
-
[
|
|
4845
|
-
'"/*"',
|
|
4846
|
-
"%RULE_Comment_Body*",
|
|
4847
|
-
'"*/"'
|
|
4848
|
-
]
|
|
4849
|
-
]
|
|
4850
|
-
},
|
|
4851
|
-
{
|
|
4852
|
-
name: "%RULE_Comment_Body",
|
|
4853
|
-
bnf: [
|
|
4854
|
-
[
|
|
4855
|
-
/[^*]/
|
|
4856
|
-
],
|
|
4857
|
-
[
|
|
4858
|
-
'"*"+',
|
|
4859
|
-
/[^/]*/
|
|
4860
|
-
]
|
|
4861
|
-
],
|
|
4862
|
-
fragment: true
|
|
4863
|
-
},
|
|
4864
|
-
{
|
|
4865
|
-
name: "RULE_EOL",
|
|
4866
|
-
bnf: [
|
|
4867
|
-
[
|
|
4868
|
-
/\x0D/,
|
|
4869
|
-
/\x0A/
|
|
4870
|
-
],
|
|
4871
|
-
[
|
|
4872
|
-
/\x0A/
|
|
4873
|
-
],
|
|
4874
|
-
[
|
|
4875
|
-
/\x0D/
|
|
4876
|
-
]
|
|
4877
|
-
]
|
|
4878
|
-
},
|
|
4879
|
-
{
|
|
4880
|
-
name: "Link",
|
|
4881
|
-
bnf: [
|
|
4882
|
-
[
|
|
4883
|
-
"'['",
|
|
4884
|
-
"Url",
|
|
4885
|
-
"']'"
|
|
4886
|
-
]
|
|
4887
|
-
]
|
|
4888
|
-
},
|
|
4889
|
-
{
|
|
4890
|
-
name: "Url",
|
|
4891
|
-
bnf: [
|
|
4892
|
-
[
|
|
4893
|
-
/[^\x5D:/?#]/,
|
|
4894
|
-
'"://"',
|
|
4895
|
-
/[^\x5D#]+/,
|
|
4896
|
-
"%Url1?"
|
|
4897
|
-
]
|
|
4898
|
-
]
|
|
4899
|
-
},
|
|
4900
|
-
{
|
|
4901
|
-
name: "%Url1",
|
|
4902
|
-
bnf: [
|
|
4903
|
-
[
|
|
4904
|
-
'"#"',
|
|
4905
|
-
"NCName"
|
|
4906
|
-
]
|
|
4907
|
-
],
|
|
4908
|
-
fragment: true
|
|
4909
|
-
}
|
|
4910
|
-
];
|
|
4911
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
4912
|
-
debug: false
|
|
4913
|
-
});
|
|
4914
|
-
var preDecorationRE = /^(!|&)/;
|
|
4915
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
4916
|
-
var subExpressionRE = /^%/;
|
|
4917
|
-
function getBNFRule(name, parser2) {
|
|
4918
|
-
if (typeof name == "string") {
|
|
4919
|
-
var decoration = decorationRE.exec(name);
|
|
4920
|
-
var preDecoration = preDecorationRE.exec(name);
|
|
4921
|
-
var preDecorationText = preDecoration ? preDecoration[0] : "";
|
|
4922
|
-
var decorationText = decoration ? decoration[0] + " " : "";
|
|
4923
|
-
var subexpression = subExpressionRE.test(name);
|
|
4924
|
-
if (subexpression) {
|
|
4925
|
-
var lonely = isLonelyRule(name, parser2);
|
|
4926
|
-
if (lonely) return preDecorationText + getBNFBody(name, parser2) + decorationText;
|
|
4927
|
-
return preDecorationText + "(" + getBNFBody(name, parser2) + ")" + decorationText;
|
|
4928
|
-
}
|
|
4929
|
-
return name.replace(preDecorationRE, preDecorationText);
|
|
4930
|
-
} else {
|
|
4931
|
-
return name.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g, "#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g, "[#x$1-#x$2]");
|
|
4932
|
-
}
|
|
4933
|
-
}
|
|
4934
|
-
function isLonelyRule(name, parser2) {
|
|
4935
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4936
|
-
return rule && rule.bnf.length == 1 && rule.bnf[0].length == 1 && (_instanceof(rule.bnf[0][0], RegExp) || rule.bnf[0][0][0] == '"' || rule.bnf[0][0][0] == "'");
|
|
4937
|
-
}
|
|
4938
|
-
function getBNFChoice(rules, parser2) {
|
|
4939
|
-
return rules.map(function(x) {
|
|
4940
|
-
return getBNFRule(x, parser2);
|
|
4941
|
-
}).join(" ");
|
|
4942
|
-
}
|
|
4943
|
-
function getBNFBody(name, parser2) {
|
|
4944
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4945
|
-
if (rule) return rule.bnf.map(function(x) {
|
|
4946
|
-
return getBNFChoice(x, parser2);
|
|
4947
|
-
}).join(" | ");
|
|
4948
|
-
return "RULE_NOT_FOUND {" + name + "}";
|
|
4949
|
-
}
|
|
4950
|
-
function emit(parser2) {
|
|
4951
|
-
var acumulator = [];
|
|
4952
|
-
parser2.grammarRules.forEach(function(l) {
|
|
4953
|
-
if (!/^%/.test(l.name)) {
|
|
4954
|
-
var recover = l.recover ? " { recoverUntil=" + l.recover + " }" : "";
|
|
4955
|
-
acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser2) + recover);
|
|
4956
|
-
}
|
|
4957
|
-
});
|
|
4958
|
-
return acumulator.join("\n");
|
|
4959
|
-
}
|
|
4960
|
-
BNF2.emit = emit;
|
|
4961
|
-
var subitems = 0;
|
|
4962
|
-
function restar(total, resta) {
|
|
4963
|
-
console.log("reberia restar " + resta + " a " + total);
|
|
4964
|
-
throw new Error("Difference not supported yet");
|
|
4965
|
-
}
|
|
4966
|
-
function convertRegex(txt) {
|
|
4967
|
-
return new RegExp(txt.replace(/#x([a-zA-Z0-9]{4})/g, "\\u$1").replace(/#x([a-zA-Z0-9]{3})/g, "\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g, "\\x$1").replace(/#x([a-zA-Z0-9]{1})/g, "\\x0$1"));
|
|
4968
|
-
}
|
|
4969
|
-
function getSubItems(tmpRules, seq, parentName, parentAttributes) {
|
|
4970
|
-
var anterior = null;
|
|
4971
|
-
var bnfSeq = [];
|
|
4972
|
-
seq.children.forEach(function(x, i) {
|
|
4973
|
-
if (x.type == "Minus") {
|
|
4974
|
-
restar(anterior, x);
|
|
4975
|
-
} else {}
|
|
4976
|
-
var decoration = seq.children[i + 1];
|
|
4977
|
-
decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || "";
|
|
4978
|
-
var preDecoration = "";
|
|
4979
|
-
if (anterior && anterior.type == "PrimaryPreDecoration") {
|
|
4980
|
-
preDecoration = anterior.text;
|
|
4981
|
-
}
|
|
4982
|
-
var pinned = preDecoration == "~" ? 1 : void 0;
|
|
4983
|
-
if (pinned) {
|
|
4984
|
-
preDecoration = "";
|
|
4985
|
-
}
|
|
4986
|
-
switch(x.type){
|
|
4987
|
-
case "SubItem":
|
|
4988
|
-
var name = "%" + (parentName + subitems++);
|
|
4989
|
-
createRule(tmpRules, x, name, parentAttributes);
|
|
4990
|
-
bnfSeq.push(preDecoration + name + decoration);
|
|
4991
|
-
break;
|
|
4992
|
-
case "NCName":
|
|
4993
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
4994
|
-
break;
|
|
4995
|
-
case "StringLiteral":
|
|
4996
|
-
if (decoration || preDecoration || !/^['"/()a-zA-Z0-9&_.:=,+*\-\^\\]+$/.test(x.text)) {
|
|
4997
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
4998
|
-
} else {
|
|
4999
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5000
|
-
try {
|
|
5001
|
-
for(var _iterator = x.text.slice(1, -1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5002
|
-
var c = _step.value;
|
|
5003
|
-
if (parentAttributes && parentAttributes["ignoreCase"] == "true" && /[a-zA-Z]/.test(c)) {
|
|
5004
|
-
bnfSeq.push(new RegExp("[" + c.toUpperCase() + c.toLowerCase() + "]"));
|
|
5005
|
-
} else {
|
|
5006
|
-
bnfSeq.push(new RegExp(Parser_1.escapeRegExp(c)));
|
|
5007
|
-
}
|
|
5008
|
-
}
|
|
5009
|
-
} catch (err) {
|
|
5010
|
-
_didIteratorError = true;
|
|
5011
|
-
_iteratorError = err;
|
|
5012
|
-
} finally{
|
|
5013
|
-
try {
|
|
5014
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5015
|
-
_iterator.return();
|
|
5016
|
-
}
|
|
5017
|
-
} finally{
|
|
5018
|
-
if (_didIteratorError) {
|
|
5019
|
-
throw _iteratorError;
|
|
5020
|
-
}
|
|
5021
|
-
}
|
|
5022
|
-
}
|
|
5023
|
-
}
|
|
5024
|
-
break;
|
|
5025
|
-
case "CharCode":
|
|
5026
|
-
case "CharClass":
|
|
5027
|
-
if (decoration || preDecoration) {
|
|
5028
|
-
var newRule = {
|
|
5029
|
-
name: "%" + (parentName + subitems++),
|
|
5030
|
-
bnf: [
|
|
5031
|
-
[
|
|
5032
|
-
convertRegex(x.text)
|
|
5033
|
-
]
|
|
5034
|
-
],
|
|
5035
|
-
pinned: pinned
|
|
5036
|
-
};
|
|
5037
|
-
tmpRules.push(newRule);
|
|
5038
|
-
bnfSeq.push(preDecoration + newRule.name + decoration);
|
|
5039
|
-
} else {
|
|
5040
|
-
bnfSeq.push(convertRegex(x.text));
|
|
5041
|
-
}
|
|
5042
|
-
break;
|
|
5043
|
-
case "PrimaryPreDecoration":
|
|
5044
|
-
case "PrimaryDecoration":
|
|
5045
|
-
break;
|
|
5046
|
-
default:
|
|
5047
|
-
throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text));
|
|
5048
|
-
}
|
|
5049
|
-
anterior = x;
|
|
5050
|
-
});
|
|
5051
|
-
return bnfSeq;
|
|
5052
|
-
}
|
|
5053
|
-
function createRule(tmpRules, token, name) {
|
|
5054
|
-
var parentAttributes = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : void 0;
|
|
5055
|
-
var attrNode = token.children.filter(function(x) {
|
|
5056
|
-
return x.type == "Attributes";
|
|
5057
|
-
})[0];
|
|
5058
|
-
var attributes = {};
|
|
5059
|
-
if (attrNode) {
|
|
5060
|
-
attrNode.children.forEach(function(x) {
|
|
5061
|
-
var name2 = x.children.filter(function(x2) {
|
|
5062
|
-
return x2.type == "NCName";
|
|
5063
|
-
})[0].text;
|
|
5064
|
-
if (name2 in attributes) {
|
|
5065
|
-
throw new TokenError_1.TokenError("Duplicated attribute " + name2, x);
|
|
5066
|
-
} else {
|
|
5067
|
-
attributes[name2] = x.children.filter(function(x2) {
|
|
5068
|
-
return x2.type == "AttributeValue";
|
|
5069
|
-
})[0].text;
|
|
5070
|
-
}
|
|
5071
|
-
});
|
|
5072
|
-
}
|
|
5073
|
-
var bnf = token.children.filter(function(x) {
|
|
5074
|
-
return x.type == "SequenceOrDifference";
|
|
5075
|
-
}).map(function(s) {
|
|
5076
|
-
return getSubItems(tmpRules, s, name, parentAttributes ? parentAttributes : attributes);
|
|
5077
|
-
});
|
|
5078
|
-
var rule = {
|
|
5079
|
-
name: name,
|
|
5080
|
-
bnf: bnf
|
|
5081
|
-
};
|
|
5082
|
-
if (name.indexOf("%") == 0) rule.fragment = true;
|
|
5083
|
-
if (attributes["recoverUntil"]) {
|
|
5084
|
-
rule.recover = attributes["recoverUntil"];
|
|
5085
|
-
if (rule.bnf.length > 1) throw new TokenError_1.TokenError("only one-option productions are suitable for error recovering", token);
|
|
5086
|
-
}
|
|
5087
|
-
if ("pin" in attributes) {
|
|
5088
|
-
var num = parseInt(attributes["pin"]);
|
|
5089
|
-
if (!isNaN(num)) {
|
|
5090
|
-
rule.pinned = num;
|
|
5091
|
-
}
|
|
5092
|
-
if (rule.bnf.length > 1) throw new TokenError_1.TokenError("only one-option productions are suitable for pinning", token);
|
|
5093
|
-
}
|
|
5094
|
-
if ("ws" in attributes) {
|
|
5095
|
-
rule.implicitWs = attributes["ws"] != "explicit";
|
|
5096
|
-
} else {
|
|
5097
|
-
rule.implicitWs = null;
|
|
5098
|
-
}
|
|
5099
|
-
rule.fragment = rule.fragment || attributes["fragment"] == "true";
|
|
5100
|
-
rule.simplifyWhenOneChildren = attributes["simplifyWhenOneChildren"] == "true";
|
|
5101
|
-
tmpRules.push(rule);
|
|
5102
|
-
}
|
|
5103
|
-
function getRules(source) {
|
|
5104
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
5105
|
-
var ast = parser2.getAST(source);
|
|
5106
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
5107
|
-
if (ast.errors && ast.errors.length) {
|
|
5108
|
-
throw ast.errors[0];
|
|
5109
|
-
}
|
|
5110
|
-
var implicitWs = null;
|
|
5111
|
-
var attrNode = ast.children.filter(function(x) {
|
|
5112
|
-
return x.type == "Attributes";
|
|
5113
|
-
})[0];
|
|
5114
|
-
var attributes = {};
|
|
5115
|
-
if (attrNode) {
|
|
5116
|
-
attrNode.children.forEach(function(x) {
|
|
5117
|
-
var name = x.children.filter(function(x2) {
|
|
5118
|
-
return x2.type == "NCName";
|
|
5119
|
-
})[0].text;
|
|
5120
|
-
if (name in attributes) {
|
|
5121
|
-
throw new TokenError_1.TokenError("Duplicated attribute " + name, x);
|
|
5122
|
-
} else {
|
|
5123
|
-
attributes[name] = x.children.filter(function(x2) {
|
|
5124
|
-
return x2.type == "AttributeValue";
|
|
5125
|
-
})[0].text;
|
|
5126
|
-
}
|
|
5127
|
-
});
|
|
5128
|
-
}
|
|
5129
|
-
implicitWs = attributes["ws"] == "implicit";
|
|
5130
|
-
var tmpRules = [];
|
|
5131
|
-
ast.children.filter(function(x) {
|
|
5132
|
-
return x.type == "Production";
|
|
5133
|
-
}).map(function(x) {
|
|
5134
|
-
var name = x.children.filter(function(x2) {
|
|
5135
|
-
return x2.type == "NCName";
|
|
5136
|
-
})[0].text;
|
|
5137
|
-
createRule(tmpRules, x, name);
|
|
5138
|
-
});
|
|
5139
|
-
tmpRules.forEach(function(rule) {
|
|
5140
|
-
if (rule.implicitWs === null) rule.implicitWs = implicitWs;
|
|
5141
|
-
});
|
|
5142
|
-
return tmpRules;
|
|
5143
|
-
}
|
|
5144
|
-
BNF2.getRules = getRules;
|
|
5145
|
-
function Transform(source) {
|
|
5146
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
5147
|
-
return getRules(source.join(""), subParser);
|
|
5148
|
-
}
|
|
5149
|
-
BNF2.Transform = Transform;
|
|
5150
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
5151
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
5152
|
-
var _super = _create_super(Parser2);
|
|
5153
|
-
function Parser2(source, options) {
|
|
5154
|
-
_class_call_check(this, Parser2);
|
|
5155
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
5156
|
-
debug: true
|
|
5157
|
-
}) : BNF2.defaultParser;
|
|
5158
|
-
return _super.call(this, getRules(source, subParser), options);
|
|
5159
|
-
}
|
|
5160
|
-
_create_class(Parser2, [
|
|
5161
|
-
{
|
|
5162
|
-
key: "emitSource",
|
|
5163
|
-
value: function emitSource() {
|
|
5164
|
-
return emit(this);
|
|
5165
|
-
}
|
|
5166
|
-
}
|
|
5167
|
-
]);
|
|
5168
|
-
return Parser2;
|
|
5169
|
-
}(Parser_1.Parser);
|
|
5170
|
-
BNF2.Parser = Parser2;
|
|
5171
|
-
})(BNF || (BNF = {}));
|
|
5172
|
-
exports.default = BNF;
|
|
5173
|
-
}
|
|
5174
|
-
});
|
|
5175
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/index.js
|
|
5176
|
-
var require_Grammars = __commonJS({
|
|
5177
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/index.js": function(exports) {
|
|
5178
|
-
"use strict";
|
|
5179
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5180
|
-
value: true
|
|
5181
|
-
});
|
|
5182
|
-
var BNF_1 = require_BNF();
|
|
5183
|
-
Object.defineProperty(exports, "BNF", {
|
|
5184
|
-
enumerable: true,
|
|
5185
|
-
get: function get() {
|
|
5186
|
-
return BNF_1.default;
|
|
5187
|
-
}
|
|
5188
|
-
});
|
|
5189
|
-
var W3CEBNF_1 = require_W3CEBNF();
|
|
5190
|
-
Object.defineProperty(exports, "W3C", {
|
|
5191
|
-
enumerable: true,
|
|
5192
|
-
get: function get() {
|
|
5193
|
-
return W3CEBNF_1.default;
|
|
5194
|
-
}
|
|
5195
|
-
});
|
|
5196
|
-
var Custom_1 = require_Custom();
|
|
5197
|
-
Object.defineProperty(exports, "Custom", {
|
|
5198
|
-
enumerable: true,
|
|
5199
|
-
get: function get() {
|
|
5200
|
-
return Custom_1.default;
|
|
5201
|
-
}
|
|
5202
|
-
});
|
|
5203
|
-
}
|
|
5204
|
-
});
|
|
5205
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/index.js
|
|
5206
|
-
var require_dist = __commonJS({
|
|
5207
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/index.js": function(exports) {
|
|
5208
|
-
"use strict";
|
|
5209
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5210
|
-
value: true
|
|
5211
|
-
});
|
|
5212
|
-
var Parser_1 = require_Parser();
|
|
5213
|
-
Object.defineProperty(exports, "Parser", {
|
|
5214
|
-
enumerable: true,
|
|
5215
|
-
get: function get() {
|
|
5216
|
-
return Parser_1.Parser;
|
|
5217
|
-
}
|
|
5218
|
-
});
|
|
5219
|
-
var TokenError_1 = require_TokenError();
|
|
5220
|
-
Object.defineProperty(exports, "TokenError", {
|
|
5221
|
-
enumerable: true,
|
|
5222
|
-
get: function get() {
|
|
5223
|
-
return TokenError_1.TokenError;
|
|
5224
|
-
}
|
|
5225
|
-
});
|
|
5226
|
-
exports.Grammars = require_Grammars();
|
|
5227
|
-
}
|
|
5228
|
-
});
|
|
5229
1647
|
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/timm@1.7.1/node_modules/timm/lib/timm.js
|
|
5230
1648
|
var require_timm = __commonJS({
|
|
5231
1649
|
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/timm@1.7.1/node_modules/timm/lib/timm.js": function(exports) {
|
|
@@ -5318,14 +1736,14 @@ var CheckPathPlugin = function() {
|
|
|
5318
1736
|
result[idx] = newItem;
|
|
5319
1737
|
return result;
|
|
5320
1738
|
}
|
|
5321
|
-
function getIn(obj,
|
|
5322
|
-
if (!Array.isArray(
|
|
1739
|
+
function getIn(obj, path) {
|
|
1740
|
+
if (!Array.isArray(path)) {
|
|
5323
1741
|
throwStr(IS_DEV ? "A path array should be provided when calling getIn()" : INVALID_ARGS);
|
|
5324
1742
|
}
|
|
5325
1743
|
if (obj == null) return void 0;
|
|
5326
1744
|
var ptr = obj;
|
|
5327
|
-
for(var i = 0; i <
|
|
5328
|
-
var key =
|
|
1745
|
+
for(var i = 0; i < path.length; i++){
|
|
1746
|
+
var key = path[i];
|
|
5329
1747
|
ptr = ptr != null ? ptr[key] : void 0;
|
|
5330
1748
|
if (ptr === void 0) return ptr;
|
|
5331
1749
|
}
|
|
@@ -5339,18 +1757,18 @@ var CheckPathPlugin = function() {
|
|
|
5339
1757
|
obj2[key] = val;
|
|
5340
1758
|
return obj2;
|
|
5341
1759
|
}
|
|
5342
|
-
function setIn8(obj,
|
|
5343
|
-
if (!
|
|
5344
|
-
return doSetIn(obj,
|
|
1760
|
+
function setIn8(obj, path, val) {
|
|
1761
|
+
if (!path.length) return val;
|
|
1762
|
+
return doSetIn(obj, path, val, 0);
|
|
5345
1763
|
}
|
|
5346
|
-
function doSetIn(obj,
|
|
1764
|
+
function doSetIn(obj, path, val, idx) {
|
|
5347
1765
|
var newValue;
|
|
5348
|
-
var key =
|
|
5349
|
-
if (idx ===
|
|
1766
|
+
var key = path[idx];
|
|
1767
|
+
if (idx === path.length - 1) {
|
|
5350
1768
|
newValue = val;
|
|
5351
1769
|
} else {
|
|
5352
|
-
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof
|
|
5353
|
-
newValue = doSetIn(nestedObj,
|
|
1770
|
+
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === "number" ? [] : {};
|
|
1771
|
+
newValue = doSetIn(nestedObj, path, val, idx + 1);
|
|
5354
1772
|
}
|
|
5355
1773
|
return set2(obj, key, newValue);
|
|
5356
1774
|
}
|
|
@@ -5359,10 +1777,10 @@ var CheckPathPlugin = function() {
|
|
|
5359
1777
|
var nextVal = fnUpdate(prevVal);
|
|
5360
1778
|
return set2(obj, key, nextVal);
|
|
5361
1779
|
}
|
|
5362
|
-
function updateIn(obj,
|
|
5363
|
-
var prevVal = getIn(obj,
|
|
1780
|
+
function updateIn(obj, path, fnUpdate) {
|
|
1781
|
+
var prevVal = getIn(obj, path);
|
|
5364
1782
|
var nextVal = fnUpdate(prevVal);
|
|
5365
|
-
return setIn8(obj,
|
|
1783
|
+
return setIn8(obj, path, nextVal);
|
|
5366
1784
|
}
|
|
5367
1785
|
function merge(a, b, c, d, e, f) {
|
|
5368
1786
|
for(var _len = arguments.length, rest = new Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++){
|
|
@@ -5398,11 +1816,11 @@ var CheckPathPlugin = function() {
|
|
|
5398
1816
|
f
|
|
5399
1817
|
].concat(_to_consumable_array(rest))) : doMerge(false, true, a, b, c, d, e, f);
|
|
5400
1818
|
}
|
|
5401
|
-
function mergeIn(a,
|
|
1819
|
+
function mergeIn(a, path, b, c, d, e, f) {
|
|
5402
1820
|
for(var _len = arguments.length, rest = new Array(_len > 7 ? _len - 7 : 0), _key = 7; _key < _len; _key++){
|
|
5403
1821
|
rest[_key - 7] = arguments[_key];
|
|
5404
1822
|
}
|
|
5405
|
-
var prevVal = getIn(a,
|
|
1823
|
+
var prevVal = getIn(a, path);
|
|
5406
1824
|
if (prevVal == null) prevVal = {};
|
|
5407
1825
|
var nextVal;
|
|
5408
1826
|
if (rest.length) {
|
|
@@ -5421,7 +1839,7 @@ var CheckPathPlugin = function() {
|
|
|
5421
1839
|
} else {
|
|
5422
1840
|
nextVal = doMerge(false, false, prevVal, b, c, d, e, f);
|
|
5423
1841
|
}
|
|
5424
|
-
return setIn8(a,
|
|
1842
|
+
return setIn8(a, path, nextVal);
|
|
5425
1843
|
}
|
|
5426
1844
|
function omit4(obj, attrs) {
|
|
5427
1845
|
var omitList = Array.isArray(attrs) ? attrs : [
|
|
@@ -5923,9 +2341,6 @@ var CheckPathPlugin = function() {
|
|
|
5923
2341
|
}(Hook);
|
|
5924
2342
|
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+player@0.0.0/node_modules/@player-ui/player/dist/index.mjs
|
|
5925
2343
|
var import_ts_nested_error = __toESM(require_nested_error(), 1);
|
|
5926
|
-
var import_arr_flatten = __toESM(require_arr_flatten(), 1);
|
|
5927
|
-
var import_parsimmon = __toESM(require_parsimmon(), 1);
|
|
5928
|
-
var import_ebnf = __toESM(require_dist(), 1);
|
|
5929
2344
|
var import_ts_nested_error2 = __toESM(require_nested_error(), 1);
|
|
5930
2345
|
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+player@0.0.0/node_modules/@player-ui/player/dist/index.mjs
|
|
5931
2346
|
var import_timm = __toESM(require_timm(), 1);
|
|
@@ -6049,20 +2464,20 @@ var CheckPathPlugin = function() {
|
|
|
6049
2464
|
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+partial-match-registry@0.0.0/node_modules/@player-ui/partial-match-registry/dist/index.mjs
|
|
6050
2465
|
var import_sorted_array = __toESM(require_sorted_array(), 1);
|
|
6051
2466
|
function traverseObj(object) {
|
|
6052
|
-
var
|
|
2467
|
+
var path = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], pairs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : /* @__PURE__ */ new Map();
|
|
6053
2468
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6054
2469
|
try {
|
|
6055
2470
|
for(var _iterator = Object.keys(object)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6056
2471
|
var key = _step.value;
|
|
6057
2472
|
"";
|
|
6058
2473
|
var val = object[key];
|
|
6059
|
-
var
|
|
2474
|
+
var nestedPath = _to_consumable_array(path).concat([
|
|
6060
2475
|
key
|
|
6061
2476
|
]);
|
|
6062
2477
|
if (typeof val === "object") {
|
|
6063
|
-
traverseObj(val,
|
|
2478
|
+
traverseObj(val, nestedPath, pairs);
|
|
6064
2479
|
} else {
|
|
6065
|
-
pairs.set(
|
|
2480
|
+
pairs.set(nestedPath, val);
|
|
6066
2481
|
}
|
|
6067
2482
|
}
|
|
6068
2483
|
} catch (err) {
|
|
@@ -6110,12 +2525,12 @@ var CheckPathPlugin = function() {
|
|
|
6110
2525
|
},
|
|
6111
2526
|
{
|
|
6112
2527
|
/** Fetch the best match in the registry */ key: "get",
|
|
6113
|
-
value: function get(
|
|
2528
|
+
value: function get(query) {
|
|
6114
2529
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6115
2530
|
try {
|
|
6116
2531
|
for(var _iterator = this.store.array[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6117
2532
|
var entry = _step.value;
|
|
6118
|
-
if (entry.matcher(
|
|
2533
|
+
if (entry.matcher(query)) {
|
|
6119
2534
|
return entry.value;
|
|
6120
2535
|
}
|
|
6121
2536
|
}
|
|
@@ -6189,10 +2604,10 @@ var CheckPathPlugin = function() {
|
|
|
6189
2604
|
value: value
|
|
6190
2605
|
};
|
|
6191
2606
|
};
|
|
6192
|
-
var toPath = function(
|
|
2607
|
+
var toPath = function(path) {
|
|
6193
2608
|
return {
|
|
6194
2609
|
name: "PathNode",
|
|
6195
|
-
path:
|
|
2610
|
+
path: path
|
|
6196
2611
|
};
|
|
6197
2612
|
};
|
|
6198
2613
|
var toQuery = function(key, value) {
|
|
@@ -6211,30 +2626,6 @@ var CheckPathPlugin = function() {
|
|
|
6211
2626
|
value: values
|
|
6212
2627
|
};
|
|
6213
2628
|
};
|
|
6214
|
-
var doubleQuote = import_parsimmon.default.string('"');
|
|
6215
|
-
var singleQuote = import_parsimmon.default.string("'");
|
|
6216
|
-
var backTick = import_parsimmon.default.string("`");
|
|
6217
|
-
var identifier = import_parsimmon.default.regex(/[\w\-@]+/).desc("identifier").map(toValue);
|
|
6218
|
-
var path;
|
|
6219
|
-
var futurePath = import_parsimmon.default.lazy(function() {
|
|
6220
|
-
return path;
|
|
6221
|
-
});
|
|
6222
|
-
var nestedPath = futurePath.trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("{{"), import_parsimmon.default.string("}}")).map(toPath);
|
|
6223
|
-
var nestedExpression = import_parsimmon.default.regex(/[^`]*/).wrap(backTick, backTick).map(toExpression);
|
|
6224
|
-
var segment = import_parsimmon.default.alt(identifier, nestedPath, nestedExpression).atLeast(1).map(import_arr_flatten.default).map(toConcatenatedNode);
|
|
6225
|
-
var optionallyQuotedSegment = import_parsimmon.default.alt(import_parsimmon.default.regex(/[^"]*/).wrap(doubleQuote, doubleQuote).map(toValue), import_parsimmon.default.regex(/[^']*/).wrap(singleQuote, singleQuote).map(toValue), segment);
|
|
6226
|
-
var query = import_parsimmon.default.seq(optionallyQuotedSegment, import_parsimmon.default.string("=").times(1, 3).trim(import_parsimmon.default.optWhitespace), optionallyQuotedSegment).map(function(param) {
|
|
6227
|
-
var _param = _sliced_to_array(param, 3), key = _param[0], value = _param[2];
|
|
6228
|
-
return toQuery(key, value);
|
|
6229
|
-
});
|
|
6230
|
-
var brackets = import_parsimmon.default.alt(query, optionallyQuotedSegment).trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("["), import_parsimmon.default.string("]")).many();
|
|
6231
|
-
var segmentAndBrackets = import_parsimmon.default.seqMap(segment, brackets, function(s, bs) {
|
|
6232
|
-
return [
|
|
6233
|
-
s
|
|
6234
|
-
].concat(_to_consumable_array(bs));
|
|
6235
|
-
});
|
|
6236
|
-
path = import_parsimmon.default.sepBy(segmentAndBrackets, import_parsimmon.default.string(".")).map(import_arr_flatten.default);
|
|
6237
|
-
var parser = new import_ebnf.Grammars.W3C.Parser('\nvalue ::= segment_and_bracket (SEGMENT_SEPARATOR segment_and_bracket)*\nsegment ::= concatenated | expression | modelRef | identifier \nconcatenated ::= (expression | modelRef | identifier)+ \nmodelRef ::= OPEN_CURL OPEN_CURL value CLOSE_CURL CLOSE_CURL \nidentifier ::= [\\w\\-@]+\nquery ::= WHITESPACE* optionally_quoted_segment WHITESPACE* EQUALS EQUALS? EQUALS? WHITESPACE* optionally_quoted_segment WHITESPACE*\nbrackets ::= OPEN_BRACKET WHITESPACE* (query | optionally_quoted_segment) WHITESPACE* CLOSE_BRACKET \nsegment_and_bracket ::= segment brackets*\nquoted_value ::= [^"\']*\noptionally_quoted_segment ::= WHITESPACE* SINGLE_QUOTE quoted_value SINGLE_QUOTE WHITESPACE* | WHITESPACE* DOUBLE_QUOTE quoted_value DOUBLE_QUOTE WHITESPACE* | WHITESPACE* segment WHITESPACE*\nexpression_value ::= [^`]*\nexpression ::= BACK_TICK expression_value BACK_TICK\n\nEQUALS ::= "="\nSEGMENT_SEPARATOR ::= "."\nSINGLE_QUOTE ::= "\'"\nDOUBLE_QUOTE ::= \'"\'\nWHITESPACE ::= " "\nOPEN_CURL ::= "{"\nCLOSE_CURL ::= "}" \nOPEN_BRACKET ::= "[" \nCLOSE_BRACKET ::= "]"\nBACK_TICK ::= "`" \n');
|
|
6238
2629
|
var SEGMENT_SEPARATOR = ".";
|
|
6239
2630
|
var OPEN_CURL = "{";
|
|
6240
2631
|
var CLOSE_CURL = "}";
|
|
@@ -6264,14 +2655,14 @@ var CheckPathPlugin = function() {
|
|
|
6264
2655
|
charCode === 125;
|
|
6265
2656
|
return !matches;
|
|
6266
2657
|
};
|
|
6267
|
-
var parse = function(
|
|
2658
|
+
var parse = function(path) {
|
|
6268
2659
|
var index = 1;
|
|
6269
|
-
var ch =
|
|
2660
|
+
var ch = path.charAt(0);
|
|
6270
2661
|
var next = function(expected) {
|
|
6271
2662
|
if (expected && ch !== expected) {
|
|
6272
2663
|
throw new Error("Expected char: ".concat(expected, " but got: ").concat(ch));
|
|
6273
2664
|
}
|
|
6274
|
-
ch =
|
|
2665
|
+
ch = path.charAt(index);
|
|
6275
2666
|
index += 1;
|
|
6276
2667
|
return ch;
|
|
6277
2668
|
};
|
|
@@ -6280,7 +2671,7 @@ var CheckPathPlugin = function() {
|
|
|
6280
2671
|
next();
|
|
6281
2672
|
}
|
|
6282
2673
|
};
|
|
6283
|
-
var
|
|
2674
|
+
var identifier = function() {
|
|
6284
2675
|
if (!isIdentifierChar(ch)) {
|
|
6285
2676
|
return;
|
|
6286
2677
|
}
|
|
@@ -6326,7 +2717,7 @@ var CheckPathPlugin = function() {
|
|
|
6326
2717
|
return toValue(value);
|
|
6327
2718
|
}
|
|
6328
2719
|
};
|
|
6329
|
-
var
|
|
2720
|
+
var nestedPath = function() {
|
|
6330
2721
|
if (ch === OPEN_CURL) {
|
|
6331
2722
|
next(OPEN_CURL);
|
|
6332
2723
|
next(OPEN_CURL);
|
|
@@ -6337,10 +2728,10 @@ var CheckPathPlugin = function() {
|
|
|
6337
2728
|
}
|
|
6338
2729
|
};
|
|
6339
2730
|
var simpleSegment = function() {
|
|
6340
|
-
var
|
|
6341
|
-
return (_ref = (
|
|
2731
|
+
var _nestedPath, _ref;
|
|
2732
|
+
return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
|
|
6342
2733
|
};
|
|
6343
|
-
var
|
|
2734
|
+
var segment = function() {
|
|
6344
2735
|
var segments = [];
|
|
6345
2736
|
var nextSegment = simpleSegment();
|
|
6346
2737
|
while(nextSegment !== void 0){
|
|
@@ -6352,13 +2743,13 @@ var CheckPathPlugin = function() {
|
|
|
6352
2743
|
}
|
|
6353
2744
|
return toConcatenatedNode(segments);
|
|
6354
2745
|
};
|
|
6355
|
-
var
|
|
2746
|
+
var optionallyQuotedSegment = function() {
|
|
6356
2747
|
whitespace();
|
|
6357
2748
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
6358
|
-
var
|
|
6359
|
-
next(
|
|
2749
|
+
var singleQuote = ch === SINGLE_QUOTE;
|
|
2750
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
6360
2751
|
var id = regex(/[^'"]+/);
|
|
6361
|
-
next(
|
|
2752
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
6362
2753
|
return id;
|
|
6363
2754
|
}
|
|
6364
2755
|
return simpleSegment();
|
|
@@ -6376,12 +2767,12 @@ var CheckPathPlugin = function() {
|
|
|
6376
2767
|
if (ch === OPEN_BRACKET) {
|
|
6377
2768
|
next(OPEN_BRACKET);
|
|
6378
2769
|
whitespace();
|
|
6379
|
-
var value =
|
|
2770
|
+
var value = optionallyQuotedSegment();
|
|
6380
2771
|
if (value) {
|
|
6381
2772
|
whitespace();
|
|
6382
2773
|
if (equals()) {
|
|
6383
2774
|
whitespace();
|
|
6384
|
-
var second =
|
|
2775
|
+
var second = optionallyQuotedSegment();
|
|
6385
2776
|
value = toQuery(value, second);
|
|
6386
2777
|
whitespace();
|
|
6387
2778
|
}
|
|
@@ -6396,7 +2787,7 @@ var CheckPathPlugin = function() {
|
|
|
6396
2787
|
};
|
|
6397
2788
|
var parseSegmentAndBrackets = function() {
|
|
6398
2789
|
var parsed = [];
|
|
6399
|
-
var firstSegment =
|
|
2790
|
+
var firstSegment = segment();
|
|
6400
2791
|
if (firstSegment) {
|
|
6401
2792
|
parsed.push(firstSegment);
|
|
6402
2793
|
var bracketSegment = parseBracket();
|
|
@@ -6444,12 +2835,12 @@ var CheckPathPlugin = function() {
|
|
|
6444
2835
|
};
|
|
6445
2836
|
_class_call_check(this, _BindingInstance);
|
|
6446
2837
|
var split = Array.isArray(raw) ? raw : raw.split(".");
|
|
6447
|
-
this.split = split.map(function(
|
|
6448
|
-
if (typeof
|
|
6449
|
-
return
|
|
2838
|
+
this.split = split.map(function(segment) {
|
|
2839
|
+
if (typeof segment === "number") {
|
|
2840
|
+
return segment;
|
|
6450
2841
|
}
|
|
6451
|
-
var tryNum = Number(
|
|
6452
|
-
return isNaN(tryNum) ?
|
|
2842
|
+
var tryNum = Number(segment);
|
|
2843
|
+
return isNaN(tryNum) ? segment : tryNum;
|
|
6453
2844
|
});
|
|
6454
2845
|
Object.freeze(this.split);
|
|
6455
2846
|
this.joined = this.split.join(".");
|
|
@@ -6547,13 +2938,13 @@ var CheckPathPlugin = function() {
|
|
|
6547
2938
|
}
|
|
6548
2939
|
throw new Error("Unable to resolve value for node: ".concat(node.name));
|
|
6549
2940
|
}
|
|
6550
|
-
function appendPathSegments(
|
|
6551
|
-
if (typeof
|
|
6552
|
-
|
|
2941
|
+
function appendPathSegments(segment) {
|
|
2942
|
+
if (typeof segment === "string" && segment.indexOf(".") > -1) {
|
|
2943
|
+
segment.split(".").forEach(function(i) {
|
|
6553
2944
|
context.path.push(maybeConvertToNum(i));
|
|
6554
2945
|
});
|
|
6555
2946
|
} else {
|
|
6556
|
-
context.path.push(
|
|
2947
|
+
context.path.push(segment);
|
|
6557
2948
|
}
|
|
6558
2949
|
}
|
|
6559
2950
|
function resolveNode(_node) {
|
|
@@ -6631,24 +3022,24 @@ var CheckPathPlugin = function() {
|
|
|
6631
3022
|
* Takes a binding path, parses it, and returns an equivalent, normalized
|
|
6632
3023
|
* representation of that path.
|
|
6633
3024
|
*/ key: "normalizePath",
|
|
6634
|
-
value: function normalizePath(
|
|
6635
|
-
if (!BINDING_BRACKETS_REGEX.test(
|
|
3025
|
+
value: function normalizePath(path, resolveOptions) {
|
|
3026
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
6636
3027
|
return {
|
|
6637
|
-
path:
|
|
3028
|
+
path: path.split("."),
|
|
6638
3029
|
updates: void 0
|
|
6639
3030
|
};
|
|
6640
3031
|
}
|
|
6641
|
-
var
|
|
6642
|
-
var ast = (
|
|
6643
|
-
this.parseCache[
|
|
3032
|
+
var _this_parseCache_path;
|
|
3033
|
+
var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
|
|
3034
|
+
this.parseCache[path] = ast;
|
|
6644
3035
|
if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
|
|
6645
3036
|
var _ast_error;
|
|
6646
|
-
throw new TypeError('Cannot normalize path "'.concat(
|
|
3037
|
+
throw new TypeError('Cannot normalize path "'.concat(path, '": ').concat((_ast_error = ast === null || ast === void 0 ? void 0 : ast.error) !== null && _ast_error !== void 0 ? _ast_error : "Unknown Error."));
|
|
6647
3038
|
}
|
|
6648
3039
|
try {
|
|
6649
3040
|
return resolveBindingAST(ast.path, resolveOptions, this.hooks);
|
|
6650
3041
|
} catch (e) {
|
|
6651
|
-
throw new import_ts_nested_error.NestedError("Cannot resolve binding: ".concat(
|
|
3042
|
+
throw new import_ts_nested_error.NestedError("Cannot resolve binding: ".concat(path), e);
|
|
6652
3043
|
}
|
|
6653
3044
|
}
|
|
6654
3045
|
},
|
|
@@ -6676,21 +3067,21 @@ var CheckPathPlugin = function() {
|
|
|
6676
3067
|
var updates = {};
|
|
6677
3068
|
var joined = Array.isArray(rawBinding) ? rawBinding.join(".") : String(rawBinding);
|
|
6678
3069
|
var normalizeConfig = {
|
|
6679
|
-
getValue: function(
|
|
6680
|
-
var normalized2 = _this.normalizePath(
|
|
3070
|
+
getValue: function(path) {
|
|
3071
|
+
var normalized2 = _this.normalizePath(path.join("."), normalizeConfig);
|
|
6681
3072
|
return options.get(_this.getBindingForNormalizedResult(normalized2));
|
|
6682
3073
|
},
|
|
6683
3074
|
evaluate: function(exp) {
|
|
6684
3075
|
return options.evaluate(exp);
|
|
6685
3076
|
},
|
|
6686
|
-
convertToPath: function(
|
|
6687
|
-
if (
|
|
3077
|
+
convertToPath: function(path) {
|
|
3078
|
+
if (path === void 0) {
|
|
6688
3079
|
throw new Error("Attempted to convert undefined value to binding path");
|
|
6689
3080
|
}
|
|
6690
|
-
if (typeof
|
|
6691
|
-
throw new Error("Attempting to convert ".concat(typeof
|
|
3081
|
+
if (typeof path !== "string" && typeof path !== "number" && typeof path !== "boolean") {
|
|
3082
|
+
throw new Error("Attempting to convert ".concat(typeof path === "undefined" ? "undefined" : _type_of(path), " to a binding path."));
|
|
6692
3083
|
}
|
|
6693
|
-
var normalized2 = _this.normalizePath(String(
|
|
3084
|
+
var normalized2 = _this.normalizePath(String(path), normalizeConfig);
|
|
6694
3085
|
if (normalized2.updates) {
|
|
6695
3086
|
updates = _object_spread({}, updates, normalized2.updates);
|
|
6696
3087
|
}
|
|
@@ -7591,7 +3982,7 @@ var CheckPathPlugin = function() {
|
|
|
7591
3982
|
this.hooks = {
|
|
7592
3983
|
resolveTypeForBinding: new SyncWaterfallHook()
|
|
7593
3984
|
};
|
|
7594
|
-
this.schema = schema ?
|
|
3985
|
+
this.schema = schema ? parse2(schema) : /* @__PURE__ */ new Map();
|
|
7595
3986
|
}
|
|
7596
3987
|
_create_class(SchemaController, [
|
|
7597
3988
|
{
|
|
@@ -7982,7 +4373,7 @@ var CheckPathPlugin = function() {
|
|
|
7982
4373
|
}
|
|
7983
4374
|
}
|
|
7984
4375
|
var parseLocalObject = function(currentValue, objToParse) {
|
|
7985
|
-
var
|
|
4376
|
+
var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
7986
4377
|
if (typeof objToParse !== "object" || objToParse === null) {
|
|
7987
4378
|
return {
|
|
7988
4379
|
value: objToParse,
|
|
@@ -8019,7 +4410,7 @@ var CheckPathPlugin = function() {
|
|
|
8019
4410
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8020
4411
|
children: _to_consumable_array(children2).concat([
|
|
8021
4412
|
{
|
|
8022
|
-
path: _to_consumable_array(
|
|
4413
|
+
path: _to_consumable_array(path).concat([
|
|
8023
4414
|
"asset"
|
|
8024
4415
|
]),
|
|
8025
4416
|
value: assetAST
|
|
@@ -8044,7 +4435,7 @@ var CheckPathPlugin = function() {
|
|
|
8044
4435
|
}
|
|
8045
4436
|
if (templateAST) {
|
|
8046
4437
|
return {
|
|
8047
|
-
path: _to_consumable_array(
|
|
4438
|
+
path: _to_consumable_array(path).concat([
|
|
8048
4439
|
template.output
|
|
8049
4440
|
]),
|
|
8050
4441
|
value: templateAST
|
|
@@ -8065,7 +4456,7 @@ var CheckPathPlugin = function() {
|
|
|
8065
4456
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8066
4457
|
children: _to_consumable_array(children2).concat([
|
|
8067
4458
|
{
|
|
8068
|
-
path: _to_consumable_array(
|
|
4459
|
+
path: _to_consumable_array(path).concat([
|
|
8069
4460
|
localKey
|
|
8070
4461
|
], _to_consumable_array(firstChild.path)),
|
|
8071
4462
|
value: firstChild.value
|
|
@@ -8077,7 +4468,7 @@ var CheckPathPlugin = function() {
|
|
|
8077
4468
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8078
4469
|
children: _to_consumable_array(children2).concat([
|
|
8079
4470
|
{
|
|
8080
|
-
path: _to_consumable_array(
|
|
4471
|
+
path: _to_consumable_array(path).concat([
|
|
8081
4472
|
localKey
|
|
8082
4473
|
]),
|
|
8083
4474
|
value: localSwitch
|
|
@@ -8089,7 +4480,7 @@ var CheckPathPlugin = function() {
|
|
|
8089
4480
|
var localAsync = _this.parseAsync(localValue, "value", options);
|
|
8090
4481
|
if (localAsync) {
|
|
8091
4482
|
children2.push({
|
|
8092
|
-
path: _to_consumable_array(
|
|
4483
|
+
path: _to_consumable_array(path).concat([
|
|
8093
4484
|
localKey
|
|
8094
4485
|
]),
|
|
8095
4486
|
value: localAsync
|
|
@@ -8116,7 +4507,7 @@ var CheckPathPlugin = function() {
|
|
|
8116
4507
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8117
4508
|
children: _to_consumable_array(children2).concat([
|
|
8118
4509
|
{
|
|
8119
|
-
path: _to_consumable_array(
|
|
4510
|
+
path: _to_consumable_array(path).concat([
|
|
8120
4511
|
localKey
|
|
8121
4512
|
]),
|
|
8122
4513
|
value: multiNode
|
|
@@ -8133,7 +4524,7 @@ var CheckPathPlugin = function() {
|
|
|
8133
4524
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8134
4525
|
children: _to_consumable_array(children2).concat([
|
|
8135
4526
|
{
|
|
8136
|
-
path: _to_consumable_array(
|
|
4527
|
+
path: _to_consumable_array(path).concat([
|
|
8137
4528
|
localKey
|
|
8138
4529
|
]),
|
|
8139
4530
|
value: parsedNode
|
|
@@ -8142,7 +4533,7 @@ var CheckPathPlugin = function() {
|
|
|
8142
4533
|
});
|
|
8143
4534
|
}
|
|
8144
4535
|
} else {
|
|
8145
|
-
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(
|
|
4536
|
+
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
8146
4537
|
localKey
|
|
8147
4538
|
]));
|
|
8148
4539
|
return {
|
|
@@ -8151,7 +4542,7 @@ var CheckPathPlugin = function() {
|
|
|
8151
4542
|
};
|
|
8152
4543
|
}
|
|
8153
4544
|
} else {
|
|
8154
|
-
var value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(
|
|
4545
|
+
var value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(path).concat([
|
|
8155
4546
|
localKey
|
|
8156
4547
|
]), localValue);
|
|
8157
4548
|
return {
|
|
@@ -8456,17 +4847,17 @@ var CheckPathPlugin = function() {
|
|
|
8456
4847
|
return Resolver;
|
|
8457
4848
|
}();
|
|
8458
4849
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
8459
|
-
function CrossfieldProvider(initialView,
|
|
4850
|
+
function CrossfieldProvider(initialView, parser, logger) {
|
|
8460
4851
|
_class_call_check(this, CrossfieldProvider);
|
|
8461
4852
|
this.allValidations = /* @__PURE__ */ new Set();
|
|
8462
4853
|
this.byBinding = /* @__PURE__ */ new Map();
|
|
8463
4854
|
this.logger = logger;
|
|
8464
|
-
this.parse(initialView,
|
|
4855
|
+
this.parse(initialView, parser);
|
|
8465
4856
|
}
|
|
8466
4857
|
_create_class(CrossfieldProvider, [
|
|
8467
4858
|
{
|
|
8468
4859
|
key: "parse",
|
|
8469
|
-
value: function parse(contentView,
|
|
4860
|
+
value: function parse(contentView, parser) {
|
|
8470
4861
|
var _this = this;
|
|
8471
4862
|
var xfieldRefs = contentView.validation;
|
|
8472
4863
|
if (xfieldRefs === void 0) {
|
|
@@ -8485,7 +4876,7 @@ var CheckPathPlugin = function() {
|
|
|
8485
4876
|
_this.allValidations.add(withDefaults);
|
|
8486
4877
|
var ref = vRef.ref;
|
|
8487
4878
|
if (ref) {
|
|
8488
|
-
var parsed =
|
|
4879
|
+
var parsed = parser(ref);
|
|
8489
4880
|
if (_this.byBinding.has(parsed)) {
|
|
8490
4881
|
var _this_byBinding_get;
|
|
8491
4882
|
(_this_byBinding_get = _this.byBinding.get(parsed)) === null || _this_byBinding_get === void 0 ? void 0 : _this_byBinding_get.push(withDefaults);
|
|
@@ -8546,11 +4937,11 @@ var CheckPathPlugin = function() {
|
|
|
8546
4937
|
var _this_resolverOptions_logger;
|
|
8547
4938
|
(_this_resolverOptions_logger = this.resolverOptions.logger) === null || _this_resolverOptions_logger === void 0 ? void 0 : _this_resolverOptions_logger.warn("templatePlugin not set for View, legacy templates may not work");
|
|
8548
4939
|
}
|
|
8549
|
-
var
|
|
8550
|
-
this.hooks.parser.call(
|
|
8551
|
-
this.rootNode =
|
|
4940
|
+
var parser = new Parser();
|
|
4941
|
+
this.hooks.parser.call(parser);
|
|
4942
|
+
this.rootNode = parser.parseView(this.initialView);
|
|
8552
4943
|
this.resolver = new Resolver(this.rootNode, _object_spread_props(_object_spread({}, this.resolverOptions), {
|
|
8553
|
-
parseNode:
|
|
4944
|
+
parseNode: parser.parseObject.bind(parser)
|
|
8554
4945
|
}));
|
|
8555
4946
|
this.hooks.resolver.call(this.resolver);
|
|
8556
4947
|
}
|
|
@@ -8648,23 +5039,23 @@ var CheckPathPlugin = function() {
|
|
|
8648
5039
|
},
|
|
8649
5040
|
{
|
|
8650
5041
|
key: "applyParser",
|
|
8651
|
-
value: function applyParser(
|
|
5042
|
+
value: function applyParser(parser) {
|
|
8652
5043
|
var _this = this;
|
|
8653
|
-
|
|
5044
|
+
parser.hooks.onCreateASTNode.tap("template", function(node) {
|
|
8654
5045
|
if (node && node.type === "template" && !node.dynamic) {
|
|
8655
|
-
return _this.parseTemplate(
|
|
5046
|
+
return _this.parseTemplate(parser.parseObject.bind(parser), node, _this.options);
|
|
8656
5047
|
}
|
|
8657
5048
|
return node;
|
|
8658
5049
|
});
|
|
8659
|
-
|
|
5050
|
+
parser.hooks.determineNodeType.tap("template", function(obj) {
|
|
8660
5051
|
if (obj === "template") {
|
|
8661
5052
|
return "template";
|
|
8662
5053
|
}
|
|
8663
5054
|
});
|
|
8664
|
-
|
|
5055
|
+
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, determinedNodeType) {
|
|
8665
5056
|
if (determinedNodeType === "template") {
|
|
8666
5057
|
var _options_templateDepth, _obj_dynamic;
|
|
8667
|
-
var templateNode =
|
|
5058
|
+
var templateNode = parser.createASTNode({
|
|
8668
5059
|
type: "template",
|
|
8669
5060
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
8670
5061
|
data: obj.data,
|
|
@@ -8792,8 +5183,8 @@ var CheckPathPlugin = function() {
|
|
|
8792
5183
|
]);
|
|
8793
5184
|
}
|
|
8794
5185
|
var nodePath = findBasePath(node, resolver);
|
|
8795
|
-
if (nodePath.length > 0 && nodePath.some(function(
|
|
8796
|
-
return propsToSkip.has(
|
|
5186
|
+
if (nodePath.length > 0 && nodePath.some(function(segment) {
|
|
5187
|
+
return propsToSkip.has(segment.toString());
|
|
8797
5188
|
})) {
|
|
8798
5189
|
return node.value;
|
|
8799
5190
|
}
|
|
@@ -8835,17 +5226,17 @@ var CheckPathPlugin = function() {
|
|
|
8835
5226
|
},
|
|
8836
5227
|
{
|
|
8837
5228
|
key: "applyParser",
|
|
8838
|
-
value: function applyParser(
|
|
8839
|
-
|
|
5229
|
+
value: function applyParser(parser) {
|
|
5230
|
+
parser.hooks.determineNodeType.tap("applicability", function(obj) {
|
|
8840
5231
|
if (Object.prototype.hasOwnProperty.call(obj, "applicability")) {
|
|
8841
5232
|
return "applicability";
|
|
8842
5233
|
}
|
|
8843
5234
|
});
|
|
8844
|
-
|
|
5235
|
+
parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, determinedNodeType) {
|
|
8845
5236
|
if (determinedNodeType === "applicability") {
|
|
8846
|
-
var parsedApplicability =
|
|
5237
|
+
var parsedApplicability = parser.parseObject((0, import_timm7.omit)(obj, "applicability"), nodeType, options);
|
|
8847
5238
|
if (parsedApplicability !== null) {
|
|
8848
|
-
var applicabilityNode =
|
|
5239
|
+
var applicabilityNode = parser.createASTNode({
|
|
8849
5240
|
type: "applicability",
|
|
8850
5241
|
expression: obj.applicability,
|
|
8851
5242
|
value: parsedApplicability
|
|
@@ -8906,20 +5297,20 @@ var CheckPathPlugin = function() {
|
|
|
8906
5297
|
},
|
|
8907
5298
|
{
|
|
8908
5299
|
key: "applyParser",
|
|
8909
|
-
value: function applyParser(
|
|
5300
|
+
value: function applyParser(parser) {
|
|
8910
5301
|
var _this = this;
|
|
8911
|
-
|
|
5302
|
+
parser.hooks.onCreateASTNode.tap("switch", function(node) {
|
|
8912
5303
|
if (node && node.type === "switch" && !node.dynamic) {
|
|
8913
5304
|
return _this.resolveSwitch(node, _this.options);
|
|
8914
5305
|
}
|
|
8915
5306
|
return node;
|
|
8916
5307
|
});
|
|
8917
|
-
|
|
5308
|
+
parser.hooks.determineNodeType.tap("switch", function(obj) {
|
|
8918
5309
|
if (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch")) {
|
|
8919
5310
|
return "switch";
|
|
8920
5311
|
}
|
|
8921
5312
|
});
|
|
8922
|
-
|
|
5313
|
+
parser.hooks.parseNode.tap("switch", function(obj, _nodeType, options, determinedNodeType) {
|
|
8923
5314
|
if (determinedNodeType === "switch") {
|
|
8924
5315
|
var dynamic = "dynamicSwitch" in obj;
|
|
8925
5316
|
var switchContent = "dynamicSwitch" in obj ? obj.dynamicSwitch : obj.staticSwitch;
|
|
@@ -8928,7 +5319,7 @@ var CheckPathPlugin = function() {
|
|
|
8928
5319
|
var switchCaseExpr = switchCase.case, switchBody = _object_without_properties(switchCase, [
|
|
8929
5320
|
"case"
|
|
8930
5321
|
]);
|
|
8931
|
-
var value =
|
|
5322
|
+
var value = parser.parseObject(switchBody, "value", options);
|
|
8932
5323
|
if (value) {
|
|
8933
5324
|
cases.push({
|
|
8934
5325
|
case: switchCaseExpr,
|
|
@@ -8936,7 +5327,7 @@ var CheckPathPlugin = function() {
|
|
|
8936
5327
|
});
|
|
8937
5328
|
}
|
|
8938
5329
|
});
|
|
8939
|
-
var switchAST =
|
|
5330
|
+
var switchAST = parser.hooks.onCreateASTNode.call({
|
|
8940
5331
|
type: "switch",
|
|
8941
5332
|
dynamic: dynamic,
|
|
8942
5333
|
cases: cases
|
|
@@ -9957,11 +6348,11 @@ var CheckPathPlugin = function() {
|
|
|
9957
6348
|
},
|
|
9958
6349
|
{
|
|
9959
6350
|
key: "forView",
|
|
9960
|
-
value: function forView(
|
|
6351
|
+
value: function forView(parser) {
|
|
9961
6352
|
var _this = this;
|
|
9962
6353
|
return {
|
|
9963
6354
|
_getValidationForBinding: function(binding) {
|
|
9964
|
-
return _this.getValidationForBinding(isBinding(binding) ? binding :
|
|
6355
|
+
return _this.getValidationForBinding(isBinding(binding) ? binding : parser(binding));
|
|
9965
6356
|
},
|
|
9966
6357
|
getAll: function() {
|
|
9967
6358
|
var bindings = _this.getBindings();
|
|
@@ -9997,7 +6388,7 @@ var CheckPathPlugin = function() {
|
|
|
9997
6388
|
throw new Error("Section functionality should be provided by the view plugin");
|
|
9998
6389
|
},
|
|
9999
6390
|
type: function(binding) {
|
|
10000
|
-
return _this.schema.getType(isBinding(binding) ? binding :
|
|
6391
|
+
return _this.schema.getType(isBinding(binding) ? binding : parser(binding));
|
|
10001
6392
|
}
|
|
10002
6393
|
};
|
|
10003
6394
|
}
|
|
@@ -10497,11 +6888,11 @@ var CheckPathPlugin = function() {
|
|
|
10497
6888
|
]);
|
|
10498
6889
|
return DataController;
|
|
10499
6890
|
}();
|
|
10500
|
-
function
|
|
6891
|
+
function flatten(obj) {
|
|
10501
6892
|
var roots = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], sep = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
10502
6893
|
return Object.keys(obj).reduce(function(memo, prop) {
|
|
10503
6894
|
return _object_spread({}, memo, Object.prototype.toString.call(obj[prop]) === "[object Object]" ? // keep working if value is an object
|
|
10504
|
-
|
|
6895
|
+
flatten(obj[prop], roots.concat([
|
|
10505
6896
|
prop
|
|
10506
6897
|
])) : _define_property({}, roots.concat([
|
|
10507
6898
|
prop
|
|
@@ -10530,9 +6921,9 @@ var CheckPathPlugin = function() {
|
|
|
10530
6921
|
key: "getConstants",
|
|
10531
6922
|
value: function getConstants(key, namespace, fallback) {
|
|
10532
6923
|
var _this_tempStore_get, _this_store_get;
|
|
10533
|
-
var
|
|
6924
|
+
var path = new BindingInstance(key);
|
|
10534
6925
|
var _this_tempStore_get_get, _ref;
|
|
10535
|
-
return (_ref = (_this_tempStore_get_get = (_this_tempStore_get = this.tempStore.get(namespace)) === null || _this_tempStore_get === void 0 ? void 0 : _this_tempStore_get.get(
|
|
6926
|
+
return (_ref = (_this_tempStore_get_get = (_this_tempStore_get = this.tempStore.get(namespace)) === null || _this_tempStore_get === void 0 ? void 0 : _this_tempStore_get.get(path)) !== null && _this_tempStore_get_get !== void 0 ? _this_tempStore_get_get : (_this_store_get = this.store.get(namespace)) === null || _this_store_get === void 0 ? void 0 : _this_store_get.get(path)) !== null && _ref !== void 0 ? _ref : fallback;
|
|
10536
6927
|
}
|
|
10537
6928
|
},
|
|
10538
6929
|
{
|
|
@@ -11130,21 +7521,21 @@ var CheckPathPlugin = function() {
|
|
|
11130
7521
|
* @param query - A means of matching a parent asset
|
|
11131
7522
|
* @returns - The parent object if a match is found, else undefined
|
|
11132
7523
|
*/ key: "getParent",
|
|
11133
|
-
value: function getParent1(id,
|
|
7524
|
+
value: function getParent1(id, query) {
|
|
11134
7525
|
var _this_viewInfo;
|
|
11135
7526
|
var assetNode = (_this_viewInfo = this.viewInfo) === null || _this_viewInfo === void 0 ? void 0 : _this_viewInfo.assetIdMap.get(id);
|
|
11136
7527
|
if (!assetNode || !this.viewInfo) {
|
|
11137
7528
|
return void 0;
|
|
11138
7529
|
}
|
|
11139
7530
|
var potentialMatch = getParent(assetNode);
|
|
11140
|
-
if (
|
|
7531
|
+
if (query === void 0) {
|
|
11141
7532
|
if (potentialMatch) {
|
|
11142
7533
|
return this.getAssetFromAssetNode(potentialMatch);
|
|
11143
7534
|
}
|
|
11144
7535
|
return;
|
|
11145
7536
|
}
|
|
11146
|
-
var queryArray = Array.isArray(
|
|
11147
|
-
|
|
7537
|
+
var queryArray = Array.isArray(query) ? _to_consumable_array(query) : [
|
|
7538
|
+
query
|
|
11148
7539
|
];
|
|
11149
7540
|
var parentQuery = queryArray.shift();
|
|
11150
7541
|
var depth = 0;
|
|
@@ -11215,26 +7606,26 @@ var CheckPathPlugin = function() {
|
|
|
11215
7606
|
* @param id - The id of the asset to _start_ at
|
|
11216
7607
|
* @returns - true if the context applies, false if it doesn't
|
|
11217
7608
|
*/ key: "hasParentContext",
|
|
11218
|
-
value: function hasParentContext(id,
|
|
11219
|
-
return Boolean(this.getParent(id,
|
|
7609
|
+
value: function hasParentContext(id, query) {
|
|
7610
|
+
return Boolean(this.getParent(id, query));
|
|
11220
7611
|
}
|
|
11221
7612
|
},
|
|
11222
7613
|
{
|
|
11223
7614
|
/** Search the node for any matching paths in the graph that match the query */ key: "findChildPath",
|
|
11224
|
-
value: function findChildPath(node,
|
|
7615
|
+
value: function findChildPath(node, query) {
|
|
11225
7616
|
var _this = this;
|
|
11226
7617
|
var includeSelfMatch = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
11227
7618
|
var _node_children;
|
|
11228
|
-
if (
|
|
7619
|
+
if (query.length === 0) {
|
|
11229
7620
|
return true;
|
|
11230
7621
|
}
|
|
11231
|
-
var
|
|
7622
|
+
var _query = _to_array(query), first = _query[0], rest = _query.slice(1);
|
|
11232
7623
|
var matcher = createMatcher2(first);
|
|
11233
7624
|
if (node.type === NodeType.Asset || node.type === NodeType.View || node.type === NodeType.Applicability) {
|
|
11234
7625
|
var resolvedValue = this.getResolvedValue(node);
|
|
11235
7626
|
var _ref;
|
|
11236
7627
|
var includesSelf = (_ref = includeSelfMatch && matcher(resolvedValue)) !== null && _ref !== void 0 ? _ref : false;
|
|
11237
|
-
var childQuery = includesSelf ? rest :
|
|
7628
|
+
var childQuery = includesSelf ? rest : query;
|
|
11238
7629
|
if (childQuery.length === 0 && includesSelf) {
|
|
11239
7630
|
return true;
|
|
11240
7631
|
}
|
|
@@ -11248,11 +7639,11 @@ var CheckPathPlugin = function() {
|
|
|
11248
7639
|
return true;
|
|
11249
7640
|
}
|
|
11250
7641
|
} else if (node.type === NodeType.MultiNode && node.values.some(function(childNode) {
|
|
11251
|
-
return _this.findChildPath(childNode,
|
|
7642
|
+
return _this.findChildPath(childNode, query);
|
|
11252
7643
|
})) {
|
|
11253
7644
|
return true;
|
|
11254
7645
|
} else if ("children" in node && ((_node_children = node.children) === null || _node_children === void 0 ? void 0 : _node_children.some(function(childNode) {
|
|
11255
|
-
return _this.findChildPath(childNode.value,
|
|
7646
|
+
return _this.findChildPath(childNode.value, query);
|
|
11256
7647
|
}))) {
|
|
11257
7648
|
return true;
|
|
11258
7649
|
}
|
|
@@ -11266,11 +7657,11 @@ var CheckPathPlugin = function() {
|
|
|
11266
7657
|
* @param id - The id of the asset to _start_ at
|
|
11267
7658
|
* @returns - true if the context applies, false if it doesn't
|
|
11268
7659
|
*/ key: "hasChildContext",
|
|
11269
|
-
value: function hasChildContext(id,
|
|
7660
|
+
value: function hasChildContext(id, query) {
|
|
11270
7661
|
var _this_viewInfo;
|
|
11271
7662
|
var assetNode = (_this_viewInfo = this.viewInfo) === null || _this_viewInfo === void 0 ? void 0 : _this_viewInfo.assetIdMap.get(id);
|
|
11272
|
-
var queryArray = Array.isArray(
|
|
11273
|
-
|
|
7663
|
+
var queryArray = Array.isArray(query) ? _to_consumable_array(query) : [
|
|
7664
|
+
query
|
|
11274
7665
|
];
|
|
11275
7666
|
if (!assetNode) {
|
|
11276
7667
|
return false;
|
|
@@ -11303,18 +7694,18 @@ var CheckPathPlugin = function() {
|
|
|
11303
7694
|
* Get the path of the asset in the view upto
|
|
11304
7695
|
* the asset that matches the query or to the view if no query is provided
|
|
11305
7696
|
*/ key: "getPath",
|
|
11306
|
-
value: function getPath(id,
|
|
7697
|
+
value: function getPath(id, query) {
|
|
11307
7698
|
var _this = this;
|
|
11308
7699
|
var _this_viewInfo;
|
|
11309
7700
|
var assetNode = (_this_viewInfo = this.viewInfo) === null || _this_viewInfo === void 0 ? void 0 : _this_viewInfo.assetIdMap.get(id);
|
|
11310
7701
|
if (!assetNode || !this.viewInfo) {
|
|
11311
7702
|
return;
|
|
11312
7703
|
}
|
|
11313
|
-
var
|
|
7704
|
+
var path = [];
|
|
11314
7705
|
var queryArray = [];
|
|
11315
|
-
if (
|
|
11316
|
-
queryArray = Array.isArray(
|
|
11317
|
-
|
|
7706
|
+
if (query) {
|
|
7707
|
+
queryArray = Array.isArray(query) ? _to_consumable_array(query) : [
|
|
7708
|
+
query
|
|
11318
7709
|
];
|
|
11319
7710
|
}
|
|
11320
7711
|
var parentQuery = queryArray.shift();
|
|
@@ -11334,26 +7725,26 @@ var CheckPathPlugin = function() {
|
|
|
11334
7725
|
var actualIndex = index - parent.values.slice(0, index).reduce(function(undefCount, next) {
|
|
11335
7726
|
return _this.getResolvedValue(next) === void 0 ? undefCount + 1 : undefCount;
|
|
11336
7727
|
}, 0);
|
|
11337
|
-
|
|
7728
|
+
path = [
|
|
11338
7729
|
actualIndex
|
|
11339
|
-
].concat(_to_consumable_array(
|
|
7730
|
+
].concat(_to_consumable_array(path));
|
|
11340
7731
|
}
|
|
11341
7732
|
} else if ("children" in parent) {
|
|
11342
7733
|
var childProp = findWorkingChild(parent);
|
|
11343
7734
|
var _childProp_path;
|
|
11344
|
-
|
|
7735
|
+
path = _to_consumable_array((_childProp_path = childProp === null || childProp === void 0 ? void 0 : childProp.path) !== null && _childProp_path !== void 0 ? _childProp_path : []).concat(_to_consumable_array(path));
|
|
11345
7736
|
}
|
|
11346
7737
|
if (parentQuery) {
|
|
11347
7738
|
var matcher = createMatcher2(parentQuery);
|
|
11348
7739
|
if (matcher(this.getResolvedValue(parent))) {
|
|
11349
7740
|
parentQuery = queryArray.shift();
|
|
11350
|
-
if (!parentQuery) return
|
|
7741
|
+
if (!parentQuery) return path;
|
|
11351
7742
|
}
|
|
11352
7743
|
}
|
|
11353
7744
|
}
|
|
11354
7745
|
working = working.parent;
|
|
11355
7746
|
}
|
|
11356
|
-
return parentQuery ? void 0 :
|
|
7747
|
+
return parentQuery ? void 0 : path;
|
|
11357
7748
|
}
|
|
11358
7749
|
},
|
|
11359
7750
|
{
|
|
@@ -11370,14 +7761,6 @@ var CheckPathPlugin = function() {
|
|
|
11370
7761
|
return __toCommonJS(src_exports);
|
|
11371
7762
|
}(); /*! Bundled license information:
|
|
11372
7763
|
|
|
11373
|
-
arr-flatten/index.js:
|
|
11374
|
-
(*!
|
|
11375
|
-
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
|
|
11376
|
-
*
|
|
11377
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
11378
|
-
* Released under the MIT License.
|
|
11379
|
-
*)
|
|
11380
|
-
|
|
11381
7764
|
timm/lib/timm.js:
|
|
11382
7765
|
(*!
|
|
11383
7766
|
* Timm
|