@player-ui/player 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/Player.native.js +130 -3749
- package/dist/Player.native.js.map +1 -1
- package/dist/cjs/index.cjs +100 -154
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +100 -154
- package/dist/index.mjs +100 -154
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -8
- package/src/binding/__tests__/resolver.test.ts +4 -4
- package/src/binding-grammar/{ebnf → __tests__/ebnf}/index.ts +2 -2
- package/src/binding-grammar/__tests__/parser.test.ts +2 -2
- package/src/binding-grammar/{parsimmon → __tests__/parsimmon}/index.ts +2 -2
- package/src/binding-grammar/index.ts +0 -2
- package/types/binding-grammar/index.d.ts +0 -2
- package/types/binding-grammar/ebnf/index.d.ts +0 -4
- package/types/binding-grammar/ebnf/types.d.ts +0 -75
- package/types/binding-grammar/parsimmon/index.d.ts +0 -4
- /package/src/binding-grammar/{ebnf → __tests__/ebnf}/binding.ebnf +0 -0
- /package/src/binding-grammar/{ebnf → __tests__/ebnf}/types.ts +0 -0
package/dist/Player.native.js
CHANGED
|
@@ -971,17 +971,17 @@ var Player = function() {
|
|
|
971
971
|
break;
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
|
-
var
|
|
975
|
-
if (Object.prototype.hasOwnProperty.call(literals,
|
|
974
|
+
var identifier = expr.slice(start, index);
|
|
975
|
+
if (Object.prototype.hasOwnProperty.call(literals, identifier)) {
|
|
976
976
|
return {
|
|
977
977
|
__id: ExpNodeOpaqueIdentifier,
|
|
978
978
|
type: "Literal",
|
|
979
|
-
value: literals[
|
|
980
|
-
raw:
|
|
979
|
+
value: literals[identifier],
|
|
980
|
+
raw: identifier,
|
|
981
981
|
location: getLocation(start)
|
|
982
982
|
};
|
|
983
983
|
}
|
|
984
|
-
if (
|
|
984
|
+
if (identifier === thisStr) {
|
|
985
985
|
return {
|
|
986
986
|
__id: ExpNodeOpaqueIdentifier,
|
|
987
987
|
type: "ThisExpression",
|
|
@@ -991,7 +991,7 @@ var Player = function() {
|
|
|
991
991
|
return {
|
|
992
992
|
__id: ExpNodeOpaqueIdentifier,
|
|
993
993
|
type: "Identifier",
|
|
994
|
-
name:
|
|
994
|
+
name: identifier,
|
|
995
995
|
location: getLocation(start)
|
|
996
996
|
};
|
|
997
997
|
}
|
|
@@ -1146,19 +1146,19 @@ var Player = function() {
|
|
|
1146
1146
|
var isErrorWithLocation = function isErrorWithLocation(error) {
|
|
1147
1147
|
return error.index !== void 0 && error.description !== void 0;
|
|
1148
1148
|
};
|
|
1149
|
-
var
|
|
1149
|
+
var parse2 = function parse2(schema) {
|
|
1150
1150
|
var _loop = function() {
|
|
1151
1151
|
var next = parseQueue.shift();
|
|
1152
1152
|
if (!next) {
|
|
1153
1153
|
return "break";
|
|
1154
1154
|
}
|
|
1155
|
-
var node = next.node,
|
|
1155
|
+
var node = next.node, path = next.path, visited = next.visited;
|
|
1156
1156
|
Object.entries(node).forEach(function(param) {
|
|
1157
1157
|
var _param = _sliced_to_array(param, 2), prop = _param[0], type = _param[1];
|
|
1158
|
-
var
|
|
1158
|
+
var nestedPath = _to_consumable_array(path).concat([
|
|
1159
1159
|
prop
|
|
1160
1160
|
]);
|
|
1161
|
-
var nestedPathStr =
|
|
1161
|
+
var nestedPathStr = nestedPath.join(".");
|
|
1162
1162
|
if (expandedPaths.has(nestedPathStr)) {
|
|
1163
1163
|
throw new Error("Path has already been processed. There's either a loop somewhere or a bug");
|
|
1164
1164
|
}
|
|
@@ -1167,14 +1167,14 @@ var Player = function() {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
expandedPaths.set(nestedPathStr, type);
|
|
1169
1169
|
if (type.isArray) {
|
|
1170
|
-
|
|
1170
|
+
nestedPath.push("[]");
|
|
1171
1171
|
}
|
|
1172
1172
|
if (type.isRecord) {
|
|
1173
|
-
|
|
1173
|
+
nestedPath.push("{}");
|
|
1174
1174
|
}
|
|
1175
1175
|
if (type.type && schema[type.type]) {
|
|
1176
1176
|
parseQueue.push({
|
|
1177
|
-
path:
|
|
1177
|
+
path: nestedPath,
|
|
1178
1178
|
node: schema[type.type],
|
|
1179
1179
|
visited: /* @__PURE__ */ new Set(_to_consumable_array(visited).concat([
|
|
1180
1180
|
type.type
|
|
@@ -1431,8 +1431,8 @@ var Player = function() {
|
|
|
1431
1431
|
try {
|
|
1432
1432
|
for(var _iterator = Array.from(pairs)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1433
1433
|
var entry = _step.value;
|
|
1434
|
-
var _entry = _sliced_to_array(entry, 2),
|
|
1435
|
-
if (dlv_es_default(searchObj,
|
|
1434
|
+
var _entry = _sliced_to_array(entry, 2), path = _entry[0], value = _entry[1];
|
|
1435
|
+
if (dlv_es_default(searchObj, path) !== value) {
|
|
1436
1436
|
return false;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
@@ -1463,7 +1463,7 @@ var Player = function() {
|
|
|
1463
1463
|
return matcher;
|
|
1464
1464
|
};
|
|
1465
1465
|
var objectToBatchSet = function objectToBatchSet(obj) {
|
|
1466
|
-
var flattenedObj =
|
|
1466
|
+
var flattenedObj = flatten(obj);
|
|
1467
1467
|
var batchTxn = [];
|
|
1468
1468
|
Object.keys(flattenedObj).forEach(function(key) {
|
|
1469
1469
|
batchTxn.push([
|
|
@@ -1641,3588 +1641,6 @@ var Player = function() {
|
|
|
1641
1641
|
exports.toError = toError;
|
|
1642
1642
|
}
|
|
1643
1643
|
});
|
|
1644
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/arr-flatten@1.1.0/node_modules/arr-flatten/index.js
|
|
1645
|
-
var require_arr_flatten = __commonJS({
|
|
1646
|
-
"../../../../../../../../../../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) {
|
|
1647
|
-
"use strict";
|
|
1648
|
-
module.exports = function(arr) {
|
|
1649
|
-
return flat(arr, []);
|
|
1650
|
-
};
|
|
1651
|
-
function flat(arr, res) {
|
|
1652
|
-
var i = 0, cur;
|
|
1653
|
-
var len = arr.length;
|
|
1654
|
-
for(; i < len; i++){
|
|
1655
|
-
cur = arr[i];
|
|
1656
|
-
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
|
|
1657
|
-
}
|
|
1658
|
-
return res;
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
});
|
|
1662
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/parsimmon@1.18.1/node_modules/parsimmon/src/parsimmon.js
|
|
1663
|
-
var require_parsimmon = __commonJS({
|
|
1664
|
-
"../../../../../../../../../../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) {
|
|
1665
|
-
"use strict";
|
|
1666
|
-
function Parsimmon(action) {
|
|
1667
|
-
if (!_instanceof(this, Parsimmon)) {
|
|
1668
|
-
return new Parsimmon(action);
|
|
1669
|
-
}
|
|
1670
|
-
this._ = action;
|
|
1671
|
-
}
|
|
1672
|
-
var _ = Parsimmon.prototype;
|
|
1673
|
-
function times(n, f) {
|
|
1674
|
-
var i = 0;
|
|
1675
|
-
for(i; i < n; i++){
|
|
1676
|
-
f(i);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
function forEach(f, arr) {
|
|
1680
|
-
times(arr.length, function(i) {
|
|
1681
|
-
f(arr[i], i, arr);
|
|
1682
|
-
});
|
|
1683
|
-
}
|
|
1684
|
-
function reduce(f, seed, arr) {
|
|
1685
|
-
forEach(function(elem, i, arr2) {
|
|
1686
|
-
seed = f(seed, elem, i, arr2);
|
|
1687
|
-
}, arr);
|
|
1688
|
-
return seed;
|
|
1689
|
-
}
|
|
1690
|
-
function map(f, arr) {
|
|
1691
|
-
return reduce(function(acc, elem, i, a) {
|
|
1692
|
-
return acc.concat([
|
|
1693
|
-
f(elem, i, a)
|
|
1694
|
-
]);
|
|
1695
|
-
}, [], arr);
|
|
1696
|
-
}
|
|
1697
|
-
function lshiftBuffer(input) {
|
|
1698
|
-
var asTwoBytes = reduce(function(a, v, i, b) {
|
|
1699
|
-
return a.concat(i === b.length - 1 ? Buffer.from([
|
|
1700
|
-
v,
|
|
1701
|
-
0
|
|
1702
|
-
]).readUInt16BE(0) : b.readUInt16BE(i));
|
|
1703
|
-
}, [], input);
|
|
1704
|
-
return Buffer.from(map(function(x) {
|
|
1705
|
-
return (x << 1 & 65535) >> 8;
|
|
1706
|
-
}, asTwoBytes));
|
|
1707
|
-
}
|
|
1708
|
-
function consumeBitsFromBuffer(n, input) {
|
|
1709
|
-
var state = {
|
|
1710
|
-
v: 0,
|
|
1711
|
-
buf: input
|
|
1712
|
-
};
|
|
1713
|
-
times(n, function() {
|
|
1714
|
-
state = {
|
|
1715
|
-
v: state.v << 1 | bitPeekBuffer(state.buf),
|
|
1716
|
-
buf: lshiftBuffer(state.buf)
|
|
1717
|
-
};
|
|
1718
|
-
});
|
|
1719
|
-
return state;
|
|
1720
|
-
}
|
|
1721
|
-
function bitPeekBuffer(input) {
|
|
1722
|
-
return input[0] >> 7;
|
|
1723
|
-
}
|
|
1724
|
-
function sum(numArr) {
|
|
1725
|
-
return reduce(function(x, y) {
|
|
1726
|
-
return x + y;
|
|
1727
|
-
}, 0, numArr);
|
|
1728
|
-
}
|
|
1729
|
-
function find2(pred, arr) {
|
|
1730
|
-
return reduce(function(found, elem) {
|
|
1731
|
-
return found || (pred(elem) ? elem : found);
|
|
1732
|
-
}, null, arr);
|
|
1733
|
-
}
|
|
1734
|
-
function bufferExists() {
|
|
1735
|
-
return typeof Buffer !== "undefined";
|
|
1736
|
-
}
|
|
1737
|
-
function setExists() {
|
|
1738
|
-
if (Parsimmon._supportsSet !== void 0) {
|
|
1739
|
-
return Parsimmon._supportsSet;
|
|
1740
|
-
}
|
|
1741
|
-
var exists = typeof Set !== "undefined";
|
|
1742
|
-
Parsimmon._supportsSet = exists;
|
|
1743
|
-
return exists;
|
|
1744
|
-
}
|
|
1745
|
-
function ensureBuffer() {
|
|
1746
|
-
if (!bufferExists()) {
|
|
1747
|
-
throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.");
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
function bitSeq(alignments) {
|
|
1751
|
-
ensureBuffer();
|
|
1752
|
-
var totalBits = sum(alignments);
|
|
1753
|
-
if (totalBits % 8 !== 0) {
|
|
1754
|
-
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");
|
|
1755
|
-
}
|
|
1756
|
-
var bytes = totalBits / 8;
|
|
1757
|
-
var tooBigRange = find2(function(x) {
|
|
1758
|
-
return x > 48;
|
|
1759
|
-
}, alignments);
|
|
1760
|
-
if (tooBigRange) {
|
|
1761
|
-
throw new Error(tooBigRange + " bit range requested exceeds 48 bit (6 byte) Number max.");
|
|
1762
|
-
}
|
|
1763
|
-
return new Parsimmon(function(input, i) {
|
|
1764
|
-
var newPos = bytes + i;
|
|
1765
|
-
if (newPos > input.length) {
|
|
1766
|
-
return makeFailure(i, bytes.toString() + " bytes");
|
|
1767
|
-
}
|
|
1768
|
-
return makeSuccess(newPos, reduce(function(acc, bits) {
|
|
1769
|
-
var state = consumeBitsFromBuffer(bits, acc.buf);
|
|
1770
|
-
return {
|
|
1771
|
-
coll: acc.coll.concat(state.v),
|
|
1772
|
-
buf: state.buf
|
|
1773
|
-
};
|
|
1774
|
-
}, {
|
|
1775
|
-
coll: [],
|
|
1776
|
-
buf: input.slice(i, newPos)
|
|
1777
|
-
}, alignments).coll);
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
function bitSeqObj(namedAlignments) {
|
|
1781
|
-
ensureBuffer();
|
|
1782
|
-
var seenKeys = {};
|
|
1783
|
-
var totalKeys = 0;
|
|
1784
|
-
var fullAlignments = map(function(item) {
|
|
1785
|
-
if (isArray(item)) {
|
|
1786
|
-
var pair = item;
|
|
1787
|
-
if (pair.length !== 2) {
|
|
1788
|
-
throw new Error("[" + pair.join(", ") + "] should be length 2, got length " + pair.length);
|
|
1789
|
-
}
|
|
1790
|
-
assertString(pair[0]);
|
|
1791
|
-
assertNumber(pair[1]);
|
|
1792
|
-
if (Object.prototype.hasOwnProperty.call(seenKeys, pair[0])) {
|
|
1793
|
-
throw new Error("duplicate key in bitSeqObj: " + pair[0]);
|
|
1794
|
-
}
|
|
1795
|
-
seenKeys[pair[0]] = true;
|
|
1796
|
-
totalKeys++;
|
|
1797
|
-
return pair;
|
|
1798
|
-
} else {
|
|
1799
|
-
assertNumber(item);
|
|
1800
|
-
return [
|
|
1801
|
-
null,
|
|
1802
|
-
item
|
|
1803
|
-
];
|
|
1804
|
-
}
|
|
1805
|
-
}, namedAlignments);
|
|
1806
|
-
if (totalKeys < 1) {
|
|
1807
|
-
throw new Error("bitSeqObj expects at least one named pair, got [" + namedAlignments.join(", ") + "]");
|
|
1808
|
-
}
|
|
1809
|
-
var namesOnly = map(function(pair) {
|
|
1810
|
-
return pair[0];
|
|
1811
|
-
}, fullAlignments);
|
|
1812
|
-
var alignmentsOnly = map(function(pair) {
|
|
1813
|
-
return pair[1];
|
|
1814
|
-
}, fullAlignments);
|
|
1815
|
-
return bitSeq(alignmentsOnly).map(function(parsed) {
|
|
1816
|
-
var namedParsed = map(function(name, i) {
|
|
1817
|
-
return [
|
|
1818
|
-
name,
|
|
1819
|
-
parsed[i]
|
|
1820
|
-
];
|
|
1821
|
-
}, namesOnly);
|
|
1822
|
-
return reduce(function(obj, kv) {
|
|
1823
|
-
if (kv[0] !== null) {
|
|
1824
|
-
obj[kv[0]] = kv[1];
|
|
1825
|
-
}
|
|
1826
|
-
return obj;
|
|
1827
|
-
}, {}, namedParsed);
|
|
1828
|
-
});
|
|
1829
|
-
}
|
|
1830
|
-
function parseBufferFor(other, length) {
|
|
1831
|
-
return new Parsimmon(function(input, i) {
|
|
1832
|
-
ensureBuffer();
|
|
1833
|
-
if (i + length > input.length) {
|
|
1834
|
-
return makeFailure(i, length + " bytes for " + other);
|
|
1835
|
-
}
|
|
1836
|
-
return makeSuccess(i + length, input.slice(i, i + length));
|
|
1837
|
-
});
|
|
1838
|
-
}
|
|
1839
|
-
function parseBuffer(length) {
|
|
1840
|
-
return parseBufferFor("buffer", length).map(function(unsafe) {
|
|
1841
|
-
return Buffer.from(unsafe);
|
|
1842
|
-
});
|
|
1843
|
-
}
|
|
1844
|
-
function encodedString(encoding, length) {
|
|
1845
|
-
return parseBufferFor("string", length).map(function(buff) {
|
|
1846
|
-
return buff.toString(encoding);
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
|
-
function isInteger(value) {
|
|
1850
|
-
return typeof value === "number" && Math.floor(value) === value;
|
|
1851
|
-
}
|
|
1852
|
-
function assertValidIntegerByteLengthFor(who, length) {
|
|
1853
|
-
if (!isInteger(length) || length < 0 || length > 6) {
|
|
1854
|
-
throw new Error(who + " requires integer length in range [0, 6].");
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
function uintBE(length) {
|
|
1858
|
-
assertValidIntegerByteLengthFor("uintBE", length);
|
|
1859
|
-
return parseBufferFor("uintBE(" + length + ")", length).map(function(buff) {
|
|
1860
|
-
return buff.readUIntBE(0, length);
|
|
1861
|
-
});
|
|
1862
|
-
}
|
|
1863
|
-
function uintLE(length) {
|
|
1864
|
-
assertValidIntegerByteLengthFor("uintLE", length);
|
|
1865
|
-
return parseBufferFor("uintLE(" + length + ")", length).map(function(buff) {
|
|
1866
|
-
return buff.readUIntLE(0, length);
|
|
1867
|
-
});
|
|
1868
|
-
}
|
|
1869
|
-
function intBE(length) {
|
|
1870
|
-
assertValidIntegerByteLengthFor("intBE", length);
|
|
1871
|
-
return parseBufferFor("intBE(" + length + ")", length).map(function(buff) {
|
|
1872
|
-
return buff.readIntBE(0, length);
|
|
1873
|
-
});
|
|
1874
|
-
}
|
|
1875
|
-
function intLE(length) {
|
|
1876
|
-
assertValidIntegerByteLengthFor("intLE", length);
|
|
1877
|
-
return parseBufferFor("intLE(" + length + ")", length).map(function(buff) {
|
|
1878
|
-
return buff.readIntLE(0, length);
|
|
1879
|
-
});
|
|
1880
|
-
}
|
|
1881
|
-
function floatBE() {
|
|
1882
|
-
return parseBufferFor("floatBE", 4).map(function(buff) {
|
|
1883
|
-
return buff.readFloatBE(0);
|
|
1884
|
-
});
|
|
1885
|
-
}
|
|
1886
|
-
function floatLE() {
|
|
1887
|
-
return parseBufferFor("floatLE", 4).map(function(buff) {
|
|
1888
|
-
return buff.readFloatLE(0);
|
|
1889
|
-
});
|
|
1890
|
-
}
|
|
1891
|
-
function doubleBE() {
|
|
1892
|
-
return parseBufferFor("doubleBE", 8).map(function(buff) {
|
|
1893
|
-
return buff.readDoubleBE(0);
|
|
1894
|
-
});
|
|
1895
|
-
}
|
|
1896
|
-
function doubleLE() {
|
|
1897
|
-
return parseBufferFor("doubleLE", 8).map(function(buff) {
|
|
1898
|
-
return buff.readDoubleLE(0);
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1901
|
-
function toArray(arrLike) {
|
|
1902
|
-
return Array.prototype.slice.call(arrLike);
|
|
1903
|
-
}
|
|
1904
|
-
function isParser(obj) {
|
|
1905
|
-
return _instanceof(obj, Parsimmon);
|
|
1906
|
-
}
|
|
1907
|
-
function isArray(x) {
|
|
1908
|
-
return ({}).toString.call(x) === "[object Array]";
|
|
1909
|
-
}
|
|
1910
|
-
function isBuffer(x) {
|
|
1911
|
-
return bufferExists() && Buffer.isBuffer(x);
|
|
1912
|
-
}
|
|
1913
|
-
function makeSuccess(index2, value) {
|
|
1914
|
-
return {
|
|
1915
|
-
status: true,
|
|
1916
|
-
index: index2,
|
|
1917
|
-
value: value,
|
|
1918
|
-
furthest: -1,
|
|
1919
|
-
expected: []
|
|
1920
|
-
};
|
|
1921
|
-
}
|
|
1922
|
-
function makeFailure(index2, expected) {
|
|
1923
|
-
if (!isArray(expected)) {
|
|
1924
|
-
expected = [
|
|
1925
|
-
expected
|
|
1926
|
-
];
|
|
1927
|
-
}
|
|
1928
|
-
return {
|
|
1929
|
-
status: false,
|
|
1930
|
-
index: -1,
|
|
1931
|
-
value: null,
|
|
1932
|
-
furthest: index2,
|
|
1933
|
-
expected: expected
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
function mergeReplies(result, last) {
|
|
1937
|
-
if (!last) {
|
|
1938
|
-
return result;
|
|
1939
|
-
}
|
|
1940
|
-
if (result.furthest > last.furthest) {
|
|
1941
|
-
return result;
|
|
1942
|
-
}
|
|
1943
|
-
var expected = result.furthest === last.furthest ? union(result.expected, last.expected) : last.expected;
|
|
1944
|
-
return {
|
|
1945
|
-
status: result.status,
|
|
1946
|
-
index: result.index,
|
|
1947
|
-
value: result.value,
|
|
1948
|
-
furthest: last.furthest,
|
|
1949
|
-
expected: expected
|
|
1950
|
-
};
|
|
1951
|
-
}
|
|
1952
|
-
var lineColumnIndex = {};
|
|
1953
|
-
function makeLineColumnIndex(input, i) {
|
|
1954
|
-
if (isBuffer(input)) {
|
|
1955
|
-
return {
|
|
1956
|
-
offset: i,
|
|
1957
|
-
line: -1,
|
|
1958
|
-
column: -1
|
|
1959
|
-
};
|
|
1960
|
-
}
|
|
1961
|
-
if (!(input in lineColumnIndex)) {
|
|
1962
|
-
lineColumnIndex[input] = {};
|
|
1963
|
-
}
|
|
1964
|
-
var inputIndex = lineColumnIndex[input];
|
|
1965
|
-
var prevLine = 0;
|
|
1966
|
-
var newLines = 0;
|
|
1967
|
-
var lineStart = 0;
|
|
1968
|
-
var j = i;
|
|
1969
|
-
while(j >= 0){
|
|
1970
|
-
if (j in inputIndex) {
|
|
1971
|
-
prevLine = inputIndex[j].line;
|
|
1972
|
-
if (lineStart === 0) {
|
|
1973
|
-
lineStart = inputIndex[j].lineStart;
|
|
1974
|
-
}
|
|
1975
|
-
break;
|
|
1976
|
-
}
|
|
1977
|
-
if (// Unix LF (\n) or Windows CRLF (\r\n) line ending
|
|
1978
|
-
input.charAt(j) === "\n" || // Old Mac CR (\r) line ending
|
|
1979
|
-
input.charAt(j) === "\r" && input.charAt(j + 1) !== "\n") {
|
|
1980
|
-
newLines++;
|
|
1981
|
-
if (lineStart === 0) {
|
|
1982
|
-
lineStart = j + 1;
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
j--;
|
|
1986
|
-
}
|
|
1987
|
-
var lineWeAreUpTo = prevLine + newLines;
|
|
1988
|
-
var columnWeAreUpTo = i - lineStart;
|
|
1989
|
-
inputIndex[i] = {
|
|
1990
|
-
line: lineWeAreUpTo,
|
|
1991
|
-
lineStart: lineStart
|
|
1992
|
-
};
|
|
1993
|
-
return {
|
|
1994
|
-
offset: i,
|
|
1995
|
-
line: lineWeAreUpTo + 1,
|
|
1996
|
-
column: columnWeAreUpTo + 1
|
|
1997
|
-
};
|
|
1998
|
-
}
|
|
1999
|
-
function union(xs, ys) {
|
|
2000
|
-
if (setExists() && Array.from) {
|
|
2001
|
-
var set2 = new Set(xs);
|
|
2002
|
-
for(var y = 0; y < ys.length; y++){
|
|
2003
|
-
set2.add(ys[y]);
|
|
2004
|
-
}
|
|
2005
|
-
var arr = Array.from(set2);
|
|
2006
|
-
arr.sort();
|
|
2007
|
-
return arr;
|
|
2008
|
-
}
|
|
2009
|
-
var obj = {};
|
|
2010
|
-
for(var i = 0; i < xs.length; i++){
|
|
2011
|
-
obj[xs[i]] = true;
|
|
2012
|
-
}
|
|
2013
|
-
for(var j = 0; j < ys.length; j++){
|
|
2014
|
-
obj[ys[j]] = true;
|
|
2015
|
-
}
|
|
2016
|
-
var keys = [];
|
|
2017
|
-
for(var k in obj){
|
|
2018
|
-
if (({}).hasOwnProperty.call(obj, k)) {
|
|
2019
|
-
keys.push(k);
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
keys.sort();
|
|
2023
|
-
return keys;
|
|
2024
|
-
}
|
|
2025
|
-
function assertParser(p) {
|
|
2026
|
-
if (!isParser(p)) {
|
|
2027
|
-
throw new Error("not a parser: " + p);
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
function get(input, i) {
|
|
2031
|
-
if (typeof input === "string") {
|
|
2032
|
-
return input.charAt(i);
|
|
2033
|
-
}
|
|
2034
|
-
return input[i];
|
|
2035
|
-
}
|
|
2036
|
-
function assertArray(x) {
|
|
2037
|
-
if (!isArray(x)) {
|
|
2038
|
-
throw new Error("not an array: " + x);
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
function assertNumber(x) {
|
|
2042
|
-
if (typeof x !== "number") {
|
|
2043
|
-
throw new Error("not a number: " + x);
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
function assertRegexp(x) {
|
|
2047
|
-
if (!_instanceof(x, RegExp)) {
|
|
2048
|
-
throw new Error("not a regexp: " + x);
|
|
2049
|
-
}
|
|
2050
|
-
var f = flags(x);
|
|
2051
|
-
for(var i = 0; i < f.length; i++){
|
|
2052
|
-
var c = f.charAt(i);
|
|
2053
|
-
if (c !== "i" && c !== "m" && c !== "u" && c !== "s") {
|
|
2054
|
-
throw new Error('unsupported regexp flag "' + c + '": ' + x);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
function assertFunction(x) {
|
|
2059
|
-
if (typeof x !== "function") {
|
|
2060
|
-
throw new Error("not a function: " + x);
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
function assertString(x) {
|
|
2064
|
-
if (typeof x !== "string") {
|
|
2065
|
-
throw new Error("not a string: " + x);
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
var linesBeforeStringError = 2;
|
|
2069
|
-
var linesAfterStringError = 3;
|
|
2070
|
-
var bytesPerLine = 8;
|
|
2071
|
-
var bytesBefore = bytesPerLine * 5;
|
|
2072
|
-
var bytesAfter = bytesPerLine * 4;
|
|
2073
|
-
var defaultLinePrefix = " ";
|
|
2074
|
-
function repeat(string2, amount) {
|
|
2075
|
-
return new Array(amount + 1).join(string2);
|
|
2076
|
-
}
|
|
2077
|
-
function formatExpected(expected) {
|
|
2078
|
-
if (expected.length === 1) {
|
|
2079
|
-
return "Expected:\n\n" + expected[0];
|
|
2080
|
-
}
|
|
2081
|
-
return "Expected one of the following: \n\n" + expected.join(", ");
|
|
2082
|
-
}
|
|
2083
|
-
function leftPad(str, pad, char) {
|
|
2084
|
-
var add = pad - str.length;
|
|
2085
|
-
if (add <= 0) {
|
|
2086
|
-
return str;
|
|
2087
|
-
}
|
|
2088
|
-
return repeat(char, add) + str;
|
|
2089
|
-
}
|
|
2090
|
-
function toChunks(arr, chunkSize) {
|
|
2091
|
-
var length = arr.length;
|
|
2092
|
-
var chunks = [];
|
|
2093
|
-
var chunkIndex = 0;
|
|
2094
|
-
if (length <= chunkSize) {
|
|
2095
|
-
return [
|
|
2096
|
-
arr.slice()
|
|
2097
|
-
];
|
|
2098
|
-
}
|
|
2099
|
-
for(var i = 0; i < length; i++){
|
|
2100
|
-
if (!chunks[chunkIndex]) {
|
|
2101
|
-
chunks.push([]);
|
|
2102
|
-
}
|
|
2103
|
-
chunks[chunkIndex].push(arr[i]);
|
|
2104
|
-
if ((i + 1) % chunkSize === 0) {
|
|
2105
|
-
chunkIndex++;
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
return chunks;
|
|
2109
|
-
}
|
|
2110
|
-
function rangeFromIndexAndOffsets(i, before, after, length) {
|
|
2111
|
-
return {
|
|
2112
|
-
// Guard against the negative upper bound for lines included in the output.
|
|
2113
|
-
from: i - before > 0 ? i - before : 0,
|
|
2114
|
-
to: i + after > length ? length : i + after
|
|
2115
|
-
};
|
|
2116
|
-
}
|
|
2117
|
-
function byteRangeToRange(byteRange) {
|
|
2118
|
-
if (byteRange.from === 0 && byteRange.to === 1) {
|
|
2119
|
-
return {
|
|
2120
|
-
from: byteRange.from,
|
|
2121
|
-
to: byteRange.to
|
|
2122
|
-
};
|
|
2123
|
-
}
|
|
2124
|
-
return {
|
|
2125
|
-
from: byteRange.from / bytesPerLine,
|
|
2126
|
-
// Round `to`, so we don't get float if the amount of bytes is not divisible by `bytesPerLine`
|
|
2127
|
-
to: Math.floor(byteRange.to / bytesPerLine)
|
|
2128
|
-
};
|
|
2129
|
-
}
|
|
2130
|
-
function formatGot(input, error) {
|
|
2131
|
-
var index2 = error.index;
|
|
2132
|
-
var i = index2.offset;
|
|
2133
|
-
var verticalMarkerLength = 1;
|
|
2134
|
-
var column;
|
|
2135
|
-
var lineWithErrorIndex;
|
|
2136
|
-
var lines;
|
|
2137
|
-
var lineRange;
|
|
2138
|
-
var lastLineNumberLabelLength;
|
|
2139
|
-
if (i === input.length) {
|
|
2140
|
-
return "Got the end of the input";
|
|
2141
|
-
}
|
|
2142
|
-
if (isBuffer(input)) {
|
|
2143
|
-
var byteLineWithErrorIndex = i - i % bytesPerLine;
|
|
2144
|
-
var columnByteIndex = i - byteLineWithErrorIndex;
|
|
2145
|
-
var byteRange = rangeFromIndexAndOffsets(byteLineWithErrorIndex, bytesBefore, bytesAfter + bytesPerLine, input.length);
|
|
2146
|
-
var bytes = input.slice(byteRange.from, byteRange.to);
|
|
2147
|
-
var bytesInChunks = toChunks(bytes.toJSON().data, bytesPerLine);
|
|
2148
|
-
var byteLines = map(function(byteRow) {
|
|
2149
|
-
return map(function(byteValue) {
|
|
2150
|
-
return leftPad(byteValue.toString(16), 2, "0");
|
|
2151
|
-
}, byteRow);
|
|
2152
|
-
}, bytesInChunks);
|
|
2153
|
-
lineRange = byteRangeToRange(byteRange);
|
|
2154
|
-
lineWithErrorIndex = byteLineWithErrorIndex / bytesPerLine;
|
|
2155
|
-
column = columnByteIndex * 3;
|
|
2156
|
-
if (columnByteIndex >= 4) {
|
|
2157
|
-
column += 1;
|
|
2158
|
-
}
|
|
2159
|
-
verticalMarkerLength = 2;
|
|
2160
|
-
lines = map(function(byteLine) {
|
|
2161
|
-
return byteLine.length <= 4 ? byteLine.join(" ") : byteLine.slice(0, 4).join(" ") + " " + byteLine.slice(4).join(" ");
|
|
2162
|
-
}, byteLines);
|
|
2163
|
-
lastLineNumberLabelLength = ((lineRange.to > 0 ? lineRange.to - 1 : lineRange.to) * 8).toString(16).length;
|
|
2164
|
-
if (lastLineNumberLabelLength < 2) {
|
|
2165
|
-
lastLineNumberLabelLength = 2;
|
|
2166
|
-
}
|
|
2167
|
-
} else {
|
|
2168
|
-
var inputLines = input.split(/\r\n|[\n\r\u2028\u2029]/);
|
|
2169
|
-
column = index2.column - 1;
|
|
2170
|
-
lineWithErrorIndex = index2.line - 1;
|
|
2171
|
-
lineRange = rangeFromIndexAndOffsets(lineWithErrorIndex, linesBeforeStringError, linesAfterStringError, inputLines.length);
|
|
2172
|
-
lines = inputLines.slice(lineRange.from, lineRange.to);
|
|
2173
|
-
lastLineNumberLabelLength = lineRange.to.toString().length;
|
|
2174
|
-
}
|
|
2175
|
-
var lineWithErrorCurrentIndex = lineWithErrorIndex - lineRange.from;
|
|
2176
|
-
if (isBuffer(input)) {
|
|
2177
|
-
lastLineNumberLabelLength = ((lineRange.to > 0 ? lineRange.to - 1 : lineRange.to) * 8).toString(16).length;
|
|
2178
|
-
if (lastLineNumberLabelLength < 2) {
|
|
2179
|
-
lastLineNumberLabelLength = 2;
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
|
-
var linesWithLineNumbers = reduce(function(acc, lineSource, index3) {
|
|
2183
|
-
var isLineWithError = index3 === lineWithErrorCurrentIndex;
|
|
2184
|
-
var prefix = isLineWithError ? "> " : defaultLinePrefix;
|
|
2185
|
-
var lineNumberLabel;
|
|
2186
|
-
if (isBuffer(input)) {
|
|
2187
|
-
lineNumberLabel = leftPad(((lineRange.from + index3) * 8).toString(16), lastLineNumberLabelLength, "0");
|
|
2188
|
-
} else {
|
|
2189
|
-
lineNumberLabel = leftPad((lineRange.from + index3 + 1).toString(), lastLineNumberLabelLength, " ");
|
|
2190
|
-
}
|
|
2191
|
-
return [].concat(acc, [
|
|
2192
|
-
prefix + lineNumberLabel + " | " + lineSource
|
|
2193
|
-
], isLineWithError ? [
|
|
2194
|
-
defaultLinePrefix + repeat(" ", lastLineNumberLabelLength) + " | " + leftPad("", column, " ") + repeat("^", verticalMarkerLength)
|
|
2195
|
-
] : []);
|
|
2196
|
-
}, [], lines);
|
|
2197
|
-
return linesWithLineNumbers.join("\n");
|
|
2198
|
-
}
|
|
2199
|
-
function formatError(input, error) {
|
|
2200
|
-
return [
|
|
2201
|
-
"\n",
|
|
2202
|
-
"-- PARSING FAILED " + repeat("-", 50),
|
|
2203
|
-
"\n\n",
|
|
2204
|
-
formatGot(input, error),
|
|
2205
|
-
"\n\n",
|
|
2206
|
-
formatExpected(error.expected),
|
|
2207
|
-
"\n"
|
|
2208
|
-
].join("");
|
|
2209
|
-
}
|
|
2210
|
-
function flags(re) {
|
|
2211
|
-
if (re.flags !== void 0) {
|
|
2212
|
-
return re.flags;
|
|
2213
|
-
}
|
|
2214
|
-
return [
|
|
2215
|
-
re.global ? "g" : "",
|
|
2216
|
-
re.ignoreCase ? "i" : "",
|
|
2217
|
-
re.multiline ? "m" : "",
|
|
2218
|
-
re.unicode ? "u" : "",
|
|
2219
|
-
re.sticky ? "y" : ""
|
|
2220
|
-
].join("");
|
|
2221
|
-
}
|
|
2222
|
-
function anchoredRegexp(re) {
|
|
2223
|
-
return RegExp("^(?:" + re.source + ")", flags(re));
|
|
2224
|
-
}
|
|
2225
|
-
function seq() {
|
|
2226
|
-
var parsers = [].slice.call(arguments);
|
|
2227
|
-
var numParsers = parsers.length;
|
|
2228
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
2229
|
-
assertParser(parsers[j]);
|
|
2230
|
-
}
|
|
2231
|
-
return Parsimmon(function(input, i) {
|
|
2232
|
-
var result;
|
|
2233
|
-
var accum = new Array(numParsers);
|
|
2234
|
-
for(var j2 = 0; j2 < numParsers; j2 += 1){
|
|
2235
|
-
result = mergeReplies(parsers[j2]._(input, i), result);
|
|
2236
|
-
if (!result.status) {
|
|
2237
|
-
return result;
|
|
2238
|
-
}
|
|
2239
|
-
accum[j2] = result.value;
|
|
2240
|
-
i = result.index;
|
|
2241
|
-
}
|
|
2242
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
2243
|
-
});
|
|
2244
|
-
}
|
|
2245
|
-
function seqObj() {
|
|
2246
|
-
var seenKeys = {};
|
|
2247
|
-
var totalKeys = 0;
|
|
2248
|
-
var parsers = toArray(arguments);
|
|
2249
|
-
var numParsers = parsers.length;
|
|
2250
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
2251
|
-
var p = parsers[j];
|
|
2252
|
-
if (isParser(p)) {
|
|
2253
|
-
continue;
|
|
2254
|
-
}
|
|
2255
|
-
if (isArray(p)) {
|
|
2256
|
-
var isWellFormed = p.length === 2 && typeof p[0] === "string" && isParser(p[1]);
|
|
2257
|
-
if (isWellFormed) {
|
|
2258
|
-
var key = p[0];
|
|
2259
|
-
if (Object.prototype.hasOwnProperty.call(seenKeys, key)) {
|
|
2260
|
-
throw new Error("seqObj: duplicate key " + key);
|
|
2261
|
-
}
|
|
2262
|
-
seenKeys[key] = true;
|
|
2263
|
-
totalKeys++;
|
|
2264
|
-
continue;
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.");
|
|
2268
|
-
}
|
|
2269
|
-
if (totalKeys === 0) {
|
|
2270
|
-
throw new Error("seqObj expects at least one named parser, found zero");
|
|
2271
|
-
}
|
|
2272
|
-
return Parsimmon(function(input, i) {
|
|
2273
|
-
var result;
|
|
2274
|
-
var accum = {};
|
|
2275
|
-
for(var j2 = 0; j2 < numParsers; j2 += 1){
|
|
2276
|
-
var name;
|
|
2277
|
-
var parser2;
|
|
2278
|
-
if (isArray(parsers[j2])) {
|
|
2279
|
-
name = parsers[j2][0];
|
|
2280
|
-
parser2 = parsers[j2][1];
|
|
2281
|
-
} else {
|
|
2282
|
-
name = null;
|
|
2283
|
-
parser2 = parsers[j2];
|
|
2284
|
-
}
|
|
2285
|
-
result = mergeReplies(parser2._(input, i), result);
|
|
2286
|
-
if (!result.status) {
|
|
2287
|
-
return result;
|
|
2288
|
-
}
|
|
2289
|
-
if (name) {
|
|
2290
|
-
accum[name] = result.value;
|
|
2291
|
-
}
|
|
2292
|
-
i = result.index;
|
|
2293
|
-
}
|
|
2294
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
2295
|
-
});
|
|
2296
|
-
}
|
|
2297
|
-
function seqMap() {
|
|
2298
|
-
var args = [].slice.call(arguments);
|
|
2299
|
-
if (args.length === 0) {
|
|
2300
|
-
throw new Error("seqMap needs at least one argument");
|
|
2301
|
-
}
|
|
2302
|
-
var mapper = args.pop();
|
|
2303
|
-
assertFunction(mapper);
|
|
2304
|
-
return seq.apply(null, args).map(function(results) {
|
|
2305
|
-
return mapper.apply(null, results);
|
|
2306
|
-
});
|
|
2307
|
-
}
|
|
2308
|
-
function createLanguage(parsers) {
|
|
2309
|
-
var language = {};
|
|
2310
|
-
for(var key in parsers){
|
|
2311
|
-
if (({}).hasOwnProperty.call(parsers, key)) {
|
|
2312
|
-
(function(key2) {
|
|
2313
|
-
var func = function func() {
|
|
2314
|
-
return parsers[key2](language);
|
|
2315
|
-
};
|
|
2316
|
-
language[key2] = lazy(func);
|
|
2317
|
-
})(key);
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
return language;
|
|
2321
|
-
}
|
|
2322
|
-
function alt() {
|
|
2323
|
-
var parsers = [].slice.call(arguments);
|
|
2324
|
-
var numParsers = parsers.length;
|
|
2325
|
-
if (numParsers === 0) {
|
|
2326
|
-
return fail("zero alternates");
|
|
2327
|
-
}
|
|
2328
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
2329
|
-
assertParser(parsers[j]);
|
|
2330
|
-
}
|
|
2331
|
-
return Parsimmon(function(input, i) {
|
|
2332
|
-
var result;
|
|
2333
|
-
for(var j2 = 0; j2 < parsers.length; j2 += 1){
|
|
2334
|
-
result = mergeReplies(parsers[j2]._(input, i), result);
|
|
2335
|
-
if (result.status) {
|
|
2336
|
-
return result;
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
return result;
|
|
2340
|
-
});
|
|
2341
|
-
}
|
|
2342
|
-
function sepBy(parser2, separator) {
|
|
2343
|
-
return sepBy1(parser2, separator).or(succeed([]));
|
|
2344
|
-
}
|
|
2345
|
-
function sepBy1(parser2, separator) {
|
|
2346
|
-
assertParser(parser2);
|
|
2347
|
-
assertParser(separator);
|
|
2348
|
-
var pairs = separator.then(parser2).many();
|
|
2349
|
-
return seqMap(parser2, pairs, function(r, rs) {
|
|
2350
|
-
return [
|
|
2351
|
-
r
|
|
2352
|
-
].concat(rs);
|
|
2353
|
-
});
|
|
2354
|
-
}
|
|
2355
|
-
_.parse = function(input) {
|
|
2356
|
-
if (typeof input !== "string" && !isBuffer(input)) {
|
|
2357
|
-
throw new Error(".parse must be called with a string or Buffer as its argument");
|
|
2358
|
-
}
|
|
2359
|
-
var parseResult = this.skip(eof)._(input, 0);
|
|
2360
|
-
var result;
|
|
2361
|
-
if (parseResult.status) {
|
|
2362
|
-
result = {
|
|
2363
|
-
status: true,
|
|
2364
|
-
value: parseResult.value
|
|
2365
|
-
};
|
|
2366
|
-
} else {
|
|
2367
|
-
result = {
|
|
2368
|
-
status: false,
|
|
2369
|
-
index: makeLineColumnIndex(input, parseResult.furthest),
|
|
2370
|
-
expected: parseResult.expected
|
|
2371
|
-
};
|
|
2372
|
-
}
|
|
2373
|
-
delete lineColumnIndex[input];
|
|
2374
|
-
return result;
|
|
2375
|
-
};
|
|
2376
|
-
_.tryParse = function(str) {
|
|
2377
|
-
var result = this.parse(str);
|
|
2378
|
-
if (result.status) {
|
|
2379
|
-
return result.value;
|
|
2380
|
-
} else {
|
|
2381
|
-
var msg = formatError(str, result);
|
|
2382
|
-
var err = new Error(msg);
|
|
2383
|
-
err.type = "ParsimmonError";
|
|
2384
|
-
err.result = result;
|
|
2385
|
-
throw err;
|
|
2386
|
-
}
|
|
2387
|
-
};
|
|
2388
|
-
_.assert = function(condition, errorMessage) {
|
|
2389
|
-
return this.chain(function(value) {
|
|
2390
|
-
return condition(value) ? succeed(value) : fail(errorMessage);
|
|
2391
|
-
});
|
|
2392
|
-
};
|
|
2393
|
-
_.or = function(alternative) {
|
|
2394
|
-
return alt(this, alternative);
|
|
2395
|
-
};
|
|
2396
|
-
_.trim = function(parser2) {
|
|
2397
|
-
return this.wrap(parser2, parser2);
|
|
2398
|
-
};
|
|
2399
|
-
_.wrap = function(leftParser, rightParser) {
|
|
2400
|
-
return seqMap(leftParser, this, rightParser, function(left, middle) {
|
|
2401
|
-
return middle;
|
|
2402
|
-
});
|
|
2403
|
-
};
|
|
2404
|
-
_.thru = function(wrapper) {
|
|
2405
|
-
return wrapper(this);
|
|
2406
|
-
};
|
|
2407
|
-
_.then = function(next) {
|
|
2408
|
-
assertParser(next);
|
|
2409
|
-
return seq(this, next).map(function(results) {
|
|
2410
|
-
return results[1];
|
|
2411
|
-
});
|
|
2412
|
-
};
|
|
2413
|
-
_.many = function() {
|
|
2414
|
-
var self = this;
|
|
2415
|
-
return Parsimmon(function(input, i) {
|
|
2416
|
-
var accum = [];
|
|
2417
|
-
var result = void 0;
|
|
2418
|
-
for(;;){
|
|
2419
|
-
result = mergeReplies(self._(input, i), result);
|
|
2420
|
-
if (result.status) {
|
|
2421
|
-
if (i === result.index) {
|
|
2422
|
-
throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");
|
|
2423
|
-
}
|
|
2424
|
-
i = result.index;
|
|
2425
|
-
accum.push(result.value);
|
|
2426
|
-
} else {
|
|
2427
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
});
|
|
2431
|
-
};
|
|
2432
|
-
_.tieWith = function(separator) {
|
|
2433
|
-
assertString(separator);
|
|
2434
|
-
return this.map(function(args) {
|
|
2435
|
-
assertArray(args);
|
|
2436
|
-
if (args.length) {
|
|
2437
|
-
assertString(args[0]);
|
|
2438
|
-
var s = args[0];
|
|
2439
|
-
for(var i = 1; i < args.length; i++){
|
|
2440
|
-
assertString(args[i]);
|
|
2441
|
-
s += separator + args[i];
|
|
2442
|
-
}
|
|
2443
|
-
return s;
|
|
2444
|
-
} else {
|
|
2445
|
-
return "";
|
|
2446
|
-
}
|
|
2447
|
-
});
|
|
2448
|
-
};
|
|
2449
|
-
_.tie = function() {
|
|
2450
|
-
return this.tieWith("");
|
|
2451
|
-
};
|
|
2452
|
-
_.times = function(min, max) {
|
|
2453
|
-
var self = this;
|
|
2454
|
-
if (arguments.length < 2) {
|
|
2455
|
-
max = min;
|
|
2456
|
-
}
|
|
2457
|
-
assertNumber(min);
|
|
2458
|
-
assertNumber(max);
|
|
2459
|
-
return Parsimmon(function(input, i) {
|
|
2460
|
-
var accum = [];
|
|
2461
|
-
var result = void 0;
|
|
2462
|
-
var prevResult = void 0;
|
|
2463
|
-
for(var times2 = 0; times2 < min; times2 += 1){
|
|
2464
|
-
result = self._(input, i);
|
|
2465
|
-
prevResult = mergeReplies(result, prevResult);
|
|
2466
|
-
if (result.status) {
|
|
2467
|
-
i = result.index;
|
|
2468
|
-
accum.push(result.value);
|
|
2469
|
-
} else {
|
|
2470
|
-
return prevResult;
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
for(; times2 < max; times2 += 1){
|
|
2474
|
-
result = self._(input, i);
|
|
2475
|
-
prevResult = mergeReplies(result, prevResult);
|
|
2476
|
-
if (result.status) {
|
|
2477
|
-
i = result.index;
|
|
2478
|
-
accum.push(result.value);
|
|
2479
|
-
} else {
|
|
2480
|
-
break;
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
2483
|
-
return mergeReplies(makeSuccess(i, accum), prevResult);
|
|
2484
|
-
});
|
|
2485
|
-
};
|
|
2486
|
-
_.result = function(res) {
|
|
2487
|
-
return this.map(function() {
|
|
2488
|
-
return res;
|
|
2489
|
-
});
|
|
2490
|
-
};
|
|
2491
|
-
_.atMost = function(n) {
|
|
2492
|
-
return this.times(0, n);
|
|
2493
|
-
};
|
|
2494
|
-
_.atLeast = function(n) {
|
|
2495
|
-
return seqMap(this.times(n), this.many(), function(init, rest) {
|
|
2496
|
-
return init.concat(rest);
|
|
2497
|
-
});
|
|
2498
|
-
};
|
|
2499
|
-
_.map = function(fn) {
|
|
2500
|
-
assertFunction(fn);
|
|
2501
|
-
var self = this;
|
|
2502
|
-
return Parsimmon(function(input, i) {
|
|
2503
|
-
var result = self._(input, i);
|
|
2504
|
-
if (!result.status) {
|
|
2505
|
-
return result;
|
|
2506
|
-
}
|
|
2507
|
-
return mergeReplies(makeSuccess(result.index, fn(result.value)), result);
|
|
2508
|
-
});
|
|
2509
|
-
};
|
|
2510
|
-
_.contramap = function(fn) {
|
|
2511
|
-
assertFunction(fn);
|
|
2512
|
-
var self = this;
|
|
2513
|
-
return Parsimmon(function(input, i) {
|
|
2514
|
-
var result = self.parse(fn(input.slice(i)));
|
|
2515
|
-
if (!result.status) {
|
|
2516
|
-
return result;
|
|
2517
|
-
}
|
|
2518
|
-
return makeSuccess(i + input.length, result.value);
|
|
2519
|
-
});
|
|
2520
|
-
};
|
|
2521
|
-
_.promap = function(f, g) {
|
|
2522
|
-
assertFunction(f);
|
|
2523
|
-
assertFunction(g);
|
|
2524
|
-
return this.contramap(f).map(g);
|
|
2525
|
-
};
|
|
2526
|
-
_.skip = function(next) {
|
|
2527
|
-
return seq(this, next).map(function(results) {
|
|
2528
|
-
return results[0];
|
|
2529
|
-
});
|
|
2530
|
-
};
|
|
2531
|
-
_.mark = function() {
|
|
2532
|
-
return seqMap(index, this, index, function(start, value, end2) {
|
|
2533
|
-
return {
|
|
2534
|
-
start: start,
|
|
2535
|
-
value: value,
|
|
2536
|
-
end: end2
|
|
2537
|
-
};
|
|
2538
|
-
});
|
|
2539
|
-
};
|
|
2540
|
-
_.node = function(name) {
|
|
2541
|
-
return seqMap(index, this, index, function(start, value, end2) {
|
|
2542
|
-
return {
|
|
2543
|
-
name: name,
|
|
2544
|
-
value: value,
|
|
2545
|
-
start: start,
|
|
2546
|
-
end: end2
|
|
2547
|
-
};
|
|
2548
|
-
});
|
|
2549
|
-
};
|
|
2550
|
-
_.sepBy = function(separator) {
|
|
2551
|
-
return sepBy(this, separator);
|
|
2552
|
-
};
|
|
2553
|
-
_.sepBy1 = function(separator) {
|
|
2554
|
-
return sepBy1(this, separator);
|
|
2555
|
-
};
|
|
2556
|
-
_.lookahead = function(x) {
|
|
2557
|
-
return this.skip(lookahead(x));
|
|
2558
|
-
};
|
|
2559
|
-
_.notFollowedBy = function(x) {
|
|
2560
|
-
return this.skip(notFollowedBy(x));
|
|
2561
|
-
};
|
|
2562
|
-
_.desc = function(expected) {
|
|
2563
|
-
if (!isArray(expected)) {
|
|
2564
|
-
expected = [
|
|
2565
|
-
expected
|
|
2566
|
-
];
|
|
2567
|
-
}
|
|
2568
|
-
var self = this;
|
|
2569
|
-
return Parsimmon(function(input, i) {
|
|
2570
|
-
var reply = self._(input, i);
|
|
2571
|
-
if (!reply.status) {
|
|
2572
|
-
reply.expected = expected;
|
|
2573
|
-
}
|
|
2574
|
-
return reply;
|
|
2575
|
-
});
|
|
2576
|
-
};
|
|
2577
|
-
_.fallback = function(result) {
|
|
2578
|
-
return this.or(succeed(result));
|
|
2579
|
-
};
|
|
2580
|
-
_.ap = function(other) {
|
|
2581
|
-
return seqMap(other, this, function(f, x) {
|
|
2582
|
-
return f(x);
|
|
2583
|
-
});
|
|
2584
|
-
};
|
|
2585
|
-
_.chain = function(f) {
|
|
2586
|
-
var self = this;
|
|
2587
|
-
return Parsimmon(function(input, i) {
|
|
2588
|
-
var result = self._(input, i);
|
|
2589
|
-
if (!result.status) {
|
|
2590
|
-
return result;
|
|
2591
|
-
}
|
|
2592
|
-
var nextParser = f(result.value);
|
|
2593
|
-
return mergeReplies(nextParser._(input, result.index), result);
|
|
2594
|
-
});
|
|
2595
|
-
};
|
|
2596
|
-
function string(str) {
|
|
2597
|
-
assertString(str);
|
|
2598
|
-
var expected = "'" + str + "'";
|
|
2599
|
-
return Parsimmon(function(input, i) {
|
|
2600
|
-
var j = i + str.length;
|
|
2601
|
-
var head = input.slice(i, j);
|
|
2602
|
-
if (head === str) {
|
|
2603
|
-
return makeSuccess(j, head);
|
|
2604
|
-
} else {
|
|
2605
|
-
return makeFailure(i, expected);
|
|
2606
|
-
}
|
|
2607
|
-
});
|
|
2608
|
-
}
|
|
2609
|
-
function byte(b) {
|
|
2610
|
-
ensureBuffer();
|
|
2611
|
-
assertNumber(b);
|
|
2612
|
-
if (b > 255) {
|
|
2613
|
-
throw new Error("Value specified to byte constructor (" + b + "=0x" + b.toString(16) + ") is larger in value than a single byte.");
|
|
2614
|
-
}
|
|
2615
|
-
var expected = (b > 15 ? "0x" : "0x0") + b.toString(16);
|
|
2616
|
-
return Parsimmon(function(input, i) {
|
|
2617
|
-
var head = get(input, i);
|
|
2618
|
-
if (head === b) {
|
|
2619
|
-
return makeSuccess(i + 1, head);
|
|
2620
|
-
} else {
|
|
2621
|
-
return makeFailure(i, expected);
|
|
2622
|
-
}
|
|
2623
|
-
});
|
|
2624
|
-
}
|
|
2625
|
-
function regexp(re, group) {
|
|
2626
|
-
assertRegexp(re);
|
|
2627
|
-
if (arguments.length >= 2) {
|
|
2628
|
-
assertNumber(group);
|
|
2629
|
-
} else {
|
|
2630
|
-
group = 0;
|
|
2631
|
-
}
|
|
2632
|
-
var anchored = anchoredRegexp(re);
|
|
2633
|
-
var expected = "" + re;
|
|
2634
|
-
return Parsimmon(function(input, i) {
|
|
2635
|
-
var match = anchored.exec(input.slice(i));
|
|
2636
|
-
if (match) {
|
|
2637
|
-
if (0 <= group && group <= match.length) {
|
|
2638
|
-
var fullMatch = match[0];
|
|
2639
|
-
var groupMatch = match[group];
|
|
2640
|
-
return makeSuccess(i + fullMatch.length, groupMatch);
|
|
2641
|
-
}
|
|
2642
|
-
var message = "valid match group (0 to " + match.length + ") in " + expected;
|
|
2643
|
-
return makeFailure(i, message);
|
|
2644
|
-
}
|
|
2645
|
-
return makeFailure(i, expected);
|
|
2646
|
-
});
|
|
2647
|
-
}
|
|
2648
|
-
function succeed(value) {
|
|
2649
|
-
return Parsimmon(function(input, i) {
|
|
2650
|
-
return makeSuccess(i, value);
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
function fail(expected) {
|
|
2654
|
-
return Parsimmon(function(input, i) {
|
|
2655
|
-
return makeFailure(i, expected);
|
|
2656
|
-
});
|
|
2657
|
-
}
|
|
2658
|
-
function lookahead(x) {
|
|
2659
|
-
if (isParser(x)) {
|
|
2660
|
-
return Parsimmon(function(input, i) {
|
|
2661
|
-
var result = x._(input, i);
|
|
2662
|
-
result.index = i;
|
|
2663
|
-
result.value = "";
|
|
2664
|
-
return result;
|
|
2665
|
-
});
|
|
2666
|
-
} else if (typeof x === "string") {
|
|
2667
|
-
return lookahead(string(x));
|
|
2668
|
-
} else if (_instanceof(x, RegExp)) {
|
|
2669
|
-
return lookahead(regexp(x));
|
|
2670
|
-
}
|
|
2671
|
-
throw new Error("not a string, regexp, or parser: " + x);
|
|
2672
|
-
}
|
|
2673
|
-
function notFollowedBy(parser2) {
|
|
2674
|
-
assertParser(parser2);
|
|
2675
|
-
return Parsimmon(function(input, i) {
|
|
2676
|
-
var result = parser2._(input, i);
|
|
2677
|
-
var text = input.slice(i, result.index);
|
|
2678
|
-
return result.status ? makeFailure(i, 'not "' + text + '"') : makeSuccess(i, null);
|
|
2679
|
-
});
|
|
2680
|
-
}
|
|
2681
|
-
function test(predicate) {
|
|
2682
|
-
assertFunction(predicate);
|
|
2683
|
-
return Parsimmon(function(input, i) {
|
|
2684
|
-
var char = get(input, i);
|
|
2685
|
-
if (i < input.length && predicate(char)) {
|
|
2686
|
-
return makeSuccess(i + 1, char);
|
|
2687
|
-
} else {
|
|
2688
|
-
return makeFailure(i, "a character/byte matching " + predicate);
|
|
2689
|
-
}
|
|
2690
|
-
});
|
|
2691
|
-
}
|
|
2692
|
-
function oneOf(str) {
|
|
2693
|
-
var expected = str.split("");
|
|
2694
|
-
for(var idx = 0; idx < expected.length; idx++){
|
|
2695
|
-
expected[idx] = "'" + expected[idx] + "'";
|
|
2696
|
-
}
|
|
2697
|
-
return test(function(ch) {
|
|
2698
|
-
return str.indexOf(ch) >= 0;
|
|
2699
|
-
}).desc(expected);
|
|
2700
|
-
}
|
|
2701
|
-
function noneOf(str) {
|
|
2702
|
-
return test(function(ch) {
|
|
2703
|
-
return str.indexOf(ch) < 0;
|
|
2704
|
-
}).desc("none of '" + str + "'");
|
|
2705
|
-
}
|
|
2706
|
-
function custom(parsingFunction) {
|
|
2707
|
-
return Parsimmon(parsingFunction(makeSuccess, makeFailure));
|
|
2708
|
-
}
|
|
2709
|
-
function range(begin, end2) {
|
|
2710
|
-
return test(function(ch) {
|
|
2711
|
-
return begin <= ch && ch <= end2;
|
|
2712
|
-
}).desc(begin + "-" + end2);
|
|
2713
|
-
}
|
|
2714
|
-
function takeWhile(predicate) {
|
|
2715
|
-
assertFunction(predicate);
|
|
2716
|
-
return Parsimmon(function(input, i) {
|
|
2717
|
-
var j = i;
|
|
2718
|
-
while(j < input.length && predicate(get(input, j))){
|
|
2719
|
-
j++;
|
|
2720
|
-
}
|
|
2721
|
-
return makeSuccess(j, input.slice(i, j));
|
|
2722
|
-
});
|
|
2723
|
-
}
|
|
2724
|
-
function lazy(desc, f) {
|
|
2725
|
-
if (arguments.length < 2) {
|
|
2726
|
-
f = desc;
|
|
2727
|
-
desc = void 0;
|
|
2728
|
-
}
|
|
2729
|
-
var parser2 = Parsimmon(function(input, i) {
|
|
2730
|
-
parser2._ = f()._;
|
|
2731
|
-
return parser2._(input, i);
|
|
2732
|
-
});
|
|
2733
|
-
if (desc) {
|
|
2734
|
-
return parser2.desc(desc);
|
|
2735
|
-
} else {
|
|
2736
|
-
return parser2;
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
function empty() {
|
|
2740
|
-
return fail("fantasy-land/empty");
|
|
2741
|
-
}
|
|
2742
|
-
_.concat = _.or;
|
|
2743
|
-
_.empty = empty;
|
|
2744
|
-
_.of = succeed;
|
|
2745
|
-
_["fantasy-land/ap"] = _.ap;
|
|
2746
|
-
_["fantasy-land/chain"] = _.chain;
|
|
2747
|
-
_["fantasy-land/concat"] = _.concat;
|
|
2748
|
-
_["fantasy-land/empty"] = _.empty;
|
|
2749
|
-
_["fantasy-land/of"] = _.of;
|
|
2750
|
-
_["fantasy-land/map"] = _.map;
|
|
2751
|
-
var index = Parsimmon(function(input, i) {
|
|
2752
|
-
return makeSuccess(i, makeLineColumnIndex(input, i));
|
|
2753
|
-
});
|
|
2754
|
-
var any = Parsimmon(function(input, i) {
|
|
2755
|
-
if (i >= input.length) {
|
|
2756
|
-
return makeFailure(i, "any character/byte");
|
|
2757
|
-
}
|
|
2758
|
-
return makeSuccess(i + 1, get(input, i));
|
|
2759
|
-
});
|
|
2760
|
-
var all = Parsimmon(function(input, i) {
|
|
2761
|
-
return makeSuccess(input.length, input.slice(i));
|
|
2762
|
-
});
|
|
2763
|
-
var eof = Parsimmon(function(input, i) {
|
|
2764
|
-
if (i < input.length) {
|
|
2765
|
-
return makeFailure(i, "EOF");
|
|
2766
|
-
}
|
|
2767
|
-
return makeSuccess(i, null);
|
|
2768
|
-
});
|
|
2769
|
-
var digit = regexp(/[0-9]/).desc("a digit");
|
|
2770
|
-
var digits = regexp(/[0-9]*/).desc("optional digits");
|
|
2771
|
-
var letter = regexp(/[a-z]/i).desc("a letter");
|
|
2772
|
-
var letters = regexp(/[a-z]*/i).desc("optional letters");
|
|
2773
|
-
var optWhitespace = regexp(/\s*/).desc("optional whitespace");
|
|
2774
|
-
var whitespace = regexp(/\s+/).desc("whitespace");
|
|
2775
|
-
var cr = string("\r");
|
|
2776
|
-
var lf = string("\n");
|
|
2777
|
-
var crlf = string("\r\n");
|
|
2778
|
-
var newline = alt(crlf, lf, cr).desc("newline");
|
|
2779
|
-
var end = alt(newline, eof);
|
|
2780
|
-
Parsimmon.all = all;
|
|
2781
|
-
Parsimmon.alt = alt;
|
|
2782
|
-
Parsimmon.any = any;
|
|
2783
|
-
Parsimmon.cr = cr;
|
|
2784
|
-
Parsimmon.createLanguage = createLanguage;
|
|
2785
|
-
Parsimmon.crlf = crlf;
|
|
2786
|
-
Parsimmon.custom = custom;
|
|
2787
|
-
Parsimmon.digit = digit;
|
|
2788
|
-
Parsimmon.digits = digits;
|
|
2789
|
-
Parsimmon.empty = empty;
|
|
2790
|
-
Parsimmon.end = end;
|
|
2791
|
-
Parsimmon.eof = eof;
|
|
2792
|
-
Parsimmon.fail = fail;
|
|
2793
|
-
Parsimmon.formatError = formatError;
|
|
2794
|
-
Parsimmon.index = index;
|
|
2795
|
-
Parsimmon.isParser = isParser;
|
|
2796
|
-
Parsimmon.lazy = lazy;
|
|
2797
|
-
Parsimmon.letter = letter;
|
|
2798
|
-
Parsimmon.letters = letters;
|
|
2799
|
-
Parsimmon.lf = lf;
|
|
2800
|
-
Parsimmon.lookahead = lookahead;
|
|
2801
|
-
Parsimmon.makeFailure = makeFailure;
|
|
2802
|
-
Parsimmon.makeSuccess = makeSuccess;
|
|
2803
|
-
Parsimmon.newline = newline;
|
|
2804
|
-
Parsimmon.noneOf = noneOf;
|
|
2805
|
-
Parsimmon.notFollowedBy = notFollowedBy;
|
|
2806
|
-
Parsimmon.of = succeed;
|
|
2807
|
-
Parsimmon.oneOf = oneOf;
|
|
2808
|
-
Parsimmon.optWhitespace = optWhitespace;
|
|
2809
|
-
Parsimmon.Parser = Parsimmon;
|
|
2810
|
-
Parsimmon.range = range;
|
|
2811
|
-
Parsimmon.regex = regexp;
|
|
2812
|
-
Parsimmon.regexp = regexp;
|
|
2813
|
-
Parsimmon.sepBy = sepBy;
|
|
2814
|
-
Parsimmon.sepBy1 = sepBy1;
|
|
2815
|
-
Parsimmon.seq = seq;
|
|
2816
|
-
Parsimmon.seqMap = seqMap;
|
|
2817
|
-
Parsimmon.seqObj = seqObj;
|
|
2818
|
-
Parsimmon.string = string;
|
|
2819
|
-
Parsimmon.succeed = succeed;
|
|
2820
|
-
Parsimmon.takeWhile = takeWhile;
|
|
2821
|
-
Parsimmon.test = test;
|
|
2822
|
-
Parsimmon.whitespace = whitespace;
|
|
2823
|
-
Parsimmon["fantasy-land/empty"] = empty;
|
|
2824
|
-
Parsimmon["fantasy-land/of"] = succeed;
|
|
2825
|
-
Parsimmon.Binary = {
|
|
2826
|
-
bitSeq: bitSeq,
|
|
2827
|
-
bitSeqObj: bitSeqObj,
|
|
2828
|
-
byte: byte,
|
|
2829
|
-
buffer: parseBuffer,
|
|
2830
|
-
encodedString: encodedString,
|
|
2831
|
-
uintBE: uintBE,
|
|
2832
|
-
uint8BE: uintBE(1),
|
|
2833
|
-
uint16BE: uintBE(2),
|
|
2834
|
-
uint32BE: uintBE(4),
|
|
2835
|
-
uintLE: uintLE,
|
|
2836
|
-
uint8LE: uintLE(1),
|
|
2837
|
-
uint16LE: uintLE(2),
|
|
2838
|
-
uint32LE: uintLE(4),
|
|
2839
|
-
intBE: intBE,
|
|
2840
|
-
int8BE: intBE(1),
|
|
2841
|
-
int16BE: intBE(2),
|
|
2842
|
-
int32BE: intBE(4),
|
|
2843
|
-
intLE: intLE,
|
|
2844
|
-
int8LE: intLE(1),
|
|
2845
|
-
int16LE: intLE(2),
|
|
2846
|
-
int32LE: intLE(4),
|
|
2847
|
-
floatBE: floatBE(),
|
|
2848
|
-
floatLE: floatLE(),
|
|
2849
|
-
doubleBE: doubleBE(),
|
|
2850
|
-
doubleLE: doubleLE()
|
|
2851
|
-
};
|
|
2852
|
-
module.exports = Parsimmon;
|
|
2853
|
-
}
|
|
2854
|
-
});
|
|
2855
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/TokenError.js
|
|
2856
|
-
var require_TokenError = __commonJS({
|
|
2857
|
-
"../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/TokenError.js": function(exports) {
|
|
2858
|
-
"use strict";
|
|
2859
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2860
|
-
value: true
|
|
2861
|
-
});
|
|
2862
|
-
exports.TokenError = void 0;
|
|
2863
|
-
var TokenError = /*#__PURE__*/ function(Error1) {
|
|
2864
|
-
_inherits(TokenError, Error1);
|
|
2865
|
-
var _super = _create_super(TokenError);
|
|
2866
|
-
function TokenError(message, token) {
|
|
2867
|
-
_class_call_check(this, TokenError);
|
|
2868
|
-
var _this;
|
|
2869
|
-
_this = _super.call(this, message);
|
|
2870
|
-
_this.message = message;
|
|
2871
|
-
_this.token = token;
|
|
2872
|
-
if (token && token.errors) token.errors.push(_assert_this_initialized(_this));
|
|
2873
|
-
else throw _assert_this_initialized(_this);
|
|
2874
|
-
return _this;
|
|
2875
|
-
}
|
|
2876
|
-
_create_class(TokenError, [
|
|
2877
|
-
{
|
|
2878
|
-
key: "inspect",
|
|
2879
|
-
value: function inspect() {
|
|
2880
|
-
return "SyntaxError: " + this.message;
|
|
2881
|
-
}
|
|
2882
|
-
}
|
|
2883
|
-
]);
|
|
2884
|
-
return TokenError;
|
|
2885
|
-
}(_wrap_native_super(Error));
|
|
2886
|
-
exports.TokenError = TokenError;
|
|
2887
|
-
}
|
|
2888
|
-
});
|
|
2889
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Parser.js
|
|
2890
|
-
var require_Parser = __commonJS({
|
|
2891
|
-
"../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Parser.js": function(exports) {
|
|
2892
|
-
"use strict";
|
|
2893
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2894
|
-
value: true
|
|
2895
|
-
});
|
|
2896
|
-
exports.Parser = exports.findRuleByName = exports.parseRuleName = exports.escapeRegExp = exports.readToken = void 0;
|
|
2897
|
-
var UPPER_SNAKE_RE = /^[A-Z0-9_]+$/;
|
|
2898
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
2899
|
-
var preDecorationRE = /^(@|&|!)/;
|
|
2900
|
-
var WS_RULE = "WS";
|
|
2901
|
-
var TokenError_1 = require_TokenError();
|
|
2902
|
-
function readToken(txt, expr) {
|
|
2903
|
-
var result = expr.exec(txt);
|
|
2904
|
-
if (result && result.index == 0) {
|
|
2905
|
-
if (result[0].length == 0 && expr.source.length > 0) return null;
|
|
2906
|
-
return {
|
|
2907
|
-
type: null,
|
|
2908
|
-
text: result[0],
|
|
2909
|
-
rest: txt.substr(result[0].length),
|
|
2910
|
-
start: 0,
|
|
2911
|
-
end: result[0].length - 1,
|
|
2912
|
-
fullText: result[0],
|
|
2913
|
-
errors: [],
|
|
2914
|
-
children: [],
|
|
2915
|
-
parent: null
|
|
2916
|
-
};
|
|
2917
|
-
}
|
|
2918
|
-
return null;
|
|
2919
|
-
}
|
|
2920
|
-
exports.readToken = readToken;
|
|
2921
|
-
function escapeRegExp(str) {
|
|
2922
|
-
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
2923
|
-
}
|
|
2924
|
-
exports.escapeRegExp = escapeRegExp;
|
|
2925
|
-
function fixRest(token) {
|
|
2926
|
-
token.rest = "";
|
|
2927
|
-
token.children && token.children.forEach(function(c) {
|
|
2928
|
-
return fixRest(c);
|
|
2929
|
-
});
|
|
2930
|
-
}
|
|
2931
|
-
function fixPositions(token, start) {
|
|
2932
|
-
token.start += start;
|
|
2933
|
-
token.end += start;
|
|
2934
|
-
token.children && token.children.forEach(function(c) {
|
|
2935
|
-
return fixPositions(c, token.start);
|
|
2936
|
-
});
|
|
2937
|
-
}
|
|
2938
|
-
function agregateErrors(errors, token) {
|
|
2939
|
-
if (token.errors && token.errors.length) token.errors.forEach(function(err) {
|
|
2940
|
-
return errors.push(err);
|
|
2941
|
-
});
|
|
2942
|
-
token.children && token.children.forEach(function(tok) {
|
|
2943
|
-
return agregateErrors(errors, tok);
|
|
2944
|
-
});
|
|
2945
|
-
}
|
|
2946
|
-
function parseRuleName(name) {
|
|
2947
|
-
var postDecoration = decorationRE.exec(name);
|
|
2948
|
-
var preDecoration = preDecorationRE.exec(name);
|
|
2949
|
-
var postDecorationText = postDecoration && postDecoration[0] || "";
|
|
2950
|
-
var preDecorationText = preDecoration && preDecoration[0] || "";
|
|
2951
|
-
var out = {
|
|
2952
|
-
raw: name,
|
|
2953
|
-
name: name.replace(decorationRE, "").replace(preDecorationRE, ""),
|
|
2954
|
-
isOptional: postDecorationText == "?" || postDecorationText == "*",
|
|
2955
|
-
allowRepetition: postDecorationText == "+" || postDecorationText == "*",
|
|
2956
|
-
atLeastOne: postDecorationText == "+",
|
|
2957
|
-
lookupPositive: preDecorationText == "&",
|
|
2958
|
-
lookupNegative: preDecorationText == "!",
|
|
2959
|
-
pinned: preDecorationText == "@",
|
|
2960
|
-
lookup: false,
|
|
2961
|
-
isLiteral: false
|
|
2962
|
-
};
|
|
2963
|
-
out.isLiteral = out.name[0] == "'" || out.name[0] == '"';
|
|
2964
|
-
out.lookup = out.lookupNegative || out.lookupPositive;
|
|
2965
|
-
return out;
|
|
2966
|
-
}
|
|
2967
|
-
exports.parseRuleName = parseRuleName;
|
|
2968
|
-
function findRuleByName(name, parser2) {
|
|
2969
|
-
var parsed = parseRuleName(name);
|
|
2970
|
-
return parser2.cachedRules[parsed.name] || null;
|
|
2971
|
-
}
|
|
2972
|
-
exports.findRuleByName = findRuleByName;
|
|
2973
|
-
function stripRules(token, re) {
|
|
2974
|
-
if (token.children) {
|
|
2975
|
-
var localRules = token.children.filter(function(x) {
|
|
2976
|
-
return x.type && re.test(x.type);
|
|
2977
|
-
});
|
|
2978
|
-
for(var i = 0; i < localRules.length; i++){
|
|
2979
|
-
var indexOnChildren = token.children.indexOf(localRules[i]);
|
|
2980
|
-
if (indexOnChildren != -1) {
|
|
2981
|
-
token.children.splice(indexOnChildren, 1);
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
|
-
token.children.forEach(function(c) {
|
|
2985
|
-
return stripRules(c, re);
|
|
2986
|
-
});
|
|
2987
|
-
}
|
|
2988
|
-
}
|
|
2989
|
-
var ignoreMissingRules = [
|
|
2990
|
-
"EOF"
|
|
2991
|
-
];
|
|
2992
|
-
var Parser2 = /*#__PURE__*/ function() {
|
|
2993
|
-
function Parser2(grammarRules, options) {
|
|
2994
|
-
var _this = this;
|
|
2995
|
-
_class_call_check(this, Parser2);
|
|
2996
|
-
this.grammarRules = grammarRules;
|
|
2997
|
-
this.options = options;
|
|
2998
|
-
this.cachedRules = {};
|
|
2999
|
-
this.debug = options ? options.debug === true : false;
|
|
3000
|
-
var errors = [];
|
|
3001
|
-
var neededRules = [];
|
|
3002
|
-
grammarRules.forEach(function(rule) {
|
|
3003
|
-
var parsedName = parseRuleName(rule.name);
|
|
3004
|
-
if (parsedName.name in _this.cachedRules) {
|
|
3005
|
-
errors.push("Duplicated rule " + parsedName.name);
|
|
3006
|
-
return;
|
|
3007
|
-
} else {
|
|
3008
|
-
_this.cachedRules[parsedName.name] = rule;
|
|
3009
|
-
}
|
|
3010
|
-
if (!rule.bnf || !rule.bnf.length) {
|
|
3011
|
-
var error = "Missing rule content, rule: " + rule.name;
|
|
3012
|
-
if (errors.indexOf(error) == -1) errors.push(error);
|
|
3013
|
-
} else {
|
|
3014
|
-
rule.bnf.forEach(function(options2) {
|
|
3015
|
-
if (typeof options2[0] === "string") {
|
|
3016
|
-
var parsed = parseRuleName(options2[0]);
|
|
3017
|
-
if (parsed.name == rule.name) {
|
|
3018
|
-
var error = "Left recursion is not allowed, rule: " + rule.name;
|
|
3019
|
-
if (errors.indexOf(error) == -1) errors.push(error);
|
|
3020
|
-
}
|
|
3021
|
-
}
|
|
3022
|
-
options2.forEach(function(option) {
|
|
3023
|
-
if (typeof option == "string") {
|
|
3024
|
-
var name = parseRuleName(option);
|
|
3025
|
-
if (!name.isLiteral && neededRules.indexOf(name.name) == -1 && ignoreMissingRules.indexOf(name.name) == -1) neededRules.push(name.name);
|
|
3026
|
-
}
|
|
3027
|
-
});
|
|
3028
|
-
});
|
|
3029
|
-
}
|
|
3030
|
-
if (WS_RULE == rule.name) rule.implicitWs = false;
|
|
3031
|
-
if (rule.implicitWs) {
|
|
3032
|
-
if (neededRules.indexOf(WS_RULE) == -1) neededRules.push(WS_RULE);
|
|
3033
|
-
}
|
|
3034
|
-
if (rule.recover) {
|
|
3035
|
-
if (neededRules.indexOf(rule.recover) == -1) neededRules.push(rule.recover);
|
|
3036
|
-
}
|
|
3037
|
-
});
|
|
3038
|
-
neededRules.forEach(function(ruleName) {
|
|
3039
|
-
if (!(ruleName in _this.cachedRules)) {
|
|
3040
|
-
errors.push("Missing rule " + ruleName);
|
|
3041
|
-
}
|
|
3042
|
-
});
|
|
3043
|
-
if (errors.length) throw new Error(errors.join("\n"));
|
|
3044
|
-
}
|
|
3045
|
-
_create_class(Parser2, [
|
|
3046
|
-
{
|
|
3047
|
-
key: "getAST",
|
|
3048
|
-
value: function getAST(txt, target) {
|
|
3049
|
-
if (!target) {
|
|
3050
|
-
target = this.grammarRules.filter(function(x) {
|
|
3051
|
-
return !x.fragment && x.name.indexOf("%") != 0;
|
|
3052
|
-
})[0].name;
|
|
3053
|
-
}
|
|
3054
|
-
var result = this.parse(txt, target);
|
|
3055
|
-
if (result) {
|
|
3056
|
-
agregateErrors(result.errors, result);
|
|
3057
|
-
fixPositions(result, 0);
|
|
3058
|
-
stripRules(result, /^%/);
|
|
3059
|
-
if (!this.options || !this.options.keepUpperRules) stripRules(result, UPPER_SNAKE_RE);
|
|
3060
|
-
var rest = result.rest;
|
|
3061
|
-
if (rest) {
|
|
3062
|
-
new TokenError_1.TokenError("Unexpected end of input: \n" + rest, result);
|
|
3063
|
-
}
|
|
3064
|
-
fixRest(result);
|
|
3065
|
-
result.rest = rest;
|
|
3066
|
-
}
|
|
3067
|
-
return result;
|
|
3068
|
-
}
|
|
3069
|
-
},
|
|
3070
|
-
{
|
|
3071
|
-
key: "emitSource",
|
|
3072
|
-
value: function emitSource() {
|
|
3073
|
-
return "CANNOT EMIT SOURCE FROM BASE Parser";
|
|
3074
|
-
}
|
|
3075
|
-
},
|
|
3076
|
-
{
|
|
3077
|
-
key: "parse",
|
|
3078
|
-
value: function parse(txt, target) {
|
|
3079
|
-
var _this = this;
|
|
3080
|
-
var recursion = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
3081
|
-
var out = null;
|
|
3082
|
-
var type = parseRuleName(target);
|
|
3083
|
-
var expr;
|
|
3084
|
-
var printable = this.debug && /*!isLiteral &*/ !UPPER_SNAKE_RE.test(type.name);
|
|
3085
|
-
printable && console.log(new Array(recursion).join("\u2502 ") + "Trying to get " + target + " from " + JSON.stringify(txt.split("\n")[0]));
|
|
3086
|
-
var realType = type.name;
|
|
3087
|
-
var targetLex = findRuleByName(type.name, this);
|
|
3088
|
-
if (type.name == "EOF") {
|
|
3089
|
-
if (txt.length) {
|
|
3090
|
-
return null;
|
|
3091
|
-
} else if (txt.length == 0) {
|
|
3092
|
-
return {
|
|
3093
|
-
type: "EOF",
|
|
3094
|
-
text: "",
|
|
3095
|
-
rest: "",
|
|
3096
|
-
start: 0,
|
|
3097
|
-
end: 0,
|
|
3098
|
-
fullText: "",
|
|
3099
|
-
errors: [],
|
|
3100
|
-
children: [],
|
|
3101
|
-
parent: null
|
|
3102
|
-
};
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3105
|
-
try {
|
|
3106
|
-
if (!targetLex && type.isLiteral) {
|
|
3107
|
-
var src = type.name.trim();
|
|
3108
|
-
if (src.startsWith('"')) {
|
|
3109
|
-
src = JSON.parse(src);
|
|
3110
|
-
} else if (src.startsWith("'")) {
|
|
3111
|
-
src = src.replace(/^'(.+)'$/, "$1").replace(/\\'/g, "'");
|
|
3112
|
-
}
|
|
3113
|
-
if (src === "") {
|
|
3114
|
-
return {
|
|
3115
|
-
type: "%%EMPTY%%",
|
|
3116
|
-
text: "",
|
|
3117
|
-
rest: txt,
|
|
3118
|
-
start: 0,
|
|
3119
|
-
end: 0,
|
|
3120
|
-
fullText: "",
|
|
3121
|
-
errors: [],
|
|
3122
|
-
children: [],
|
|
3123
|
-
parent: null
|
|
3124
|
-
};
|
|
3125
|
-
}
|
|
3126
|
-
expr = new RegExp(escapeRegExp(src));
|
|
3127
|
-
realType = null;
|
|
3128
|
-
}
|
|
3129
|
-
} catch (e) {
|
|
3130
|
-
if (_instanceof(e, ReferenceError)) {
|
|
3131
|
-
console.error(e);
|
|
3132
|
-
}
|
|
3133
|
-
return null;
|
|
3134
|
-
}
|
|
3135
|
-
if (expr) {
|
|
3136
|
-
var result = readToken(txt, expr);
|
|
3137
|
-
if (result) {
|
|
3138
|
-
result.type = realType;
|
|
3139
|
-
return result;
|
|
3140
|
-
}
|
|
3141
|
-
} else {
|
|
3142
|
-
var options = targetLex.bnf;
|
|
3143
|
-
if (_instanceof(options, Array)) {
|
|
3144
|
-
options.forEach(function(phases) {
|
|
3145
|
-
var _loop = function(i) {
|
|
3146
|
-
if (typeof phases[i] == "string") {
|
|
3147
|
-
var _loop = function() {
|
|
3148
|
-
got = null;
|
|
3149
|
-
if (targetLex.implicitWs) {
|
|
3150
|
-
got = _this.parse(tmpTxt, localTarget.name, recursion + 1);
|
|
3151
|
-
if (!got) {
|
|
3152
|
-
var WS = void 0;
|
|
3153
|
-
do {
|
|
3154
|
-
WS = _this.parse(tmpTxt, WS_RULE, recursion + 1);
|
|
3155
|
-
if (WS) {
|
|
3156
|
-
tmp.text = tmp.text + WS.text;
|
|
3157
|
-
tmp.end = tmp.text.length;
|
|
3158
|
-
WS.parent = tmp;
|
|
3159
|
-
tmp.children.push(WS);
|
|
3160
|
-
tmpTxt = tmpTxt.substr(WS.text.length);
|
|
3161
|
-
position += WS.text.length;
|
|
3162
|
-
} else {
|
|
3163
|
-
break;
|
|
3164
|
-
}
|
|
3165
|
-
}while (WS && WS.text.length);
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
got = got || _this.parse(tmpTxt, localTarget.name, recursion + 1);
|
|
3169
|
-
if (localTarget.lookupNegative) {
|
|
3170
|
-
if (got) return {
|
|
3171
|
-
v: void void 0
|
|
3172
|
-
};
|
|
3173
|
-
return "break";
|
|
3174
|
-
}
|
|
3175
|
-
if (localTarget.lookupPositive) {
|
|
3176
|
-
if (!got) return {
|
|
3177
|
-
v: void void 0
|
|
3178
|
-
};
|
|
3179
|
-
}
|
|
3180
|
-
if (!got) {
|
|
3181
|
-
if (localTarget.isOptional) return "break";
|
|
3182
|
-
if (localTarget.atLeastOne && foundAtLeastOne) return "break";
|
|
3183
|
-
}
|
|
3184
|
-
if (got && targetLex.pinned == i + 1) {
|
|
3185
|
-
pinned = got;
|
|
3186
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " PINNED");
|
|
3187
|
-
}
|
|
3188
|
-
if (!got) got = _this.parseRecovery(targetLex, tmpTxt, recursion + 1);
|
|
3189
|
-
if (!got) {
|
|
3190
|
-
if (pinned) {
|
|
3191
|
-
out = tmp;
|
|
3192
|
-
got = {
|
|
3193
|
-
type: "SyntaxError",
|
|
3194
|
-
text: tmpTxt,
|
|
3195
|
-
children: [],
|
|
3196
|
-
end: tmpTxt.length,
|
|
3197
|
-
errors: [],
|
|
3198
|
-
fullText: "",
|
|
3199
|
-
parent: null,
|
|
3200
|
-
start: 0,
|
|
3201
|
-
rest: ""
|
|
3202
|
-
};
|
|
3203
|
-
if (tmpTxt.length) {
|
|
3204
|
-
new TokenError_1.TokenError("Unexpected end of input. Expecting ".concat(localTarget.name, " Got: ").concat(tmpTxt), got);
|
|
3205
|
-
} else {
|
|
3206
|
-
new TokenError_1.TokenError("Unexpected end of input. Missing ".concat(localTarget.name), got);
|
|
3207
|
-
}
|
|
3208
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text));
|
|
3209
|
-
} else {
|
|
3210
|
-
return {
|
|
3211
|
-
v: void void 0
|
|
3212
|
-
};
|
|
3213
|
-
}
|
|
3214
|
-
}
|
|
3215
|
-
foundAtLeastOne = true;
|
|
3216
|
-
foundSomething = true;
|
|
3217
|
-
if (got.type == "%%EMPTY%%") {
|
|
3218
|
-
return "break";
|
|
3219
|
-
}
|
|
3220
|
-
got.start += position;
|
|
3221
|
-
got.end += position;
|
|
3222
|
-
if (!localTarget.lookupPositive && got.type) {
|
|
3223
|
-
if (got.fragment) {
|
|
3224
|
-
got.children && got.children.forEach(function(x) {
|
|
3225
|
-
x.start += position;
|
|
3226
|
-
x.end += position;
|
|
3227
|
-
x.parent = tmp;
|
|
3228
|
-
tmp.children.push(x);
|
|
3229
|
-
});
|
|
3230
|
-
} else {
|
|
3231
|
-
got.parent = tmp;
|
|
3232
|
-
tmp.children.push(got);
|
|
3233
|
-
}
|
|
3234
|
-
}
|
|
3235
|
-
if (localTarget.lookup) got.lookup = true;
|
|
3236
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text));
|
|
3237
|
-
if (!localTarget.lookup && !got.lookup) {
|
|
3238
|
-
tmp.text = tmp.text + got.text;
|
|
3239
|
-
tmp.end = tmp.text.length;
|
|
3240
|
-
tmpTxt = tmpTxt.substr(got.text.length);
|
|
3241
|
-
position += got.text.length;
|
|
3242
|
-
}
|
|
3243
|
-
tmp.rest = tmpTxt;
|
|
3244
|
-
};
|
|
3245
|
-
var localTarget = parseRuleName(phases[i]);
|
|
3246
|
-
allOptional = allOptional && localTarget.isOptional;
|
|
3247
|
-
var got = void 0;
|
|
3248
|
-
var foundAtLeastOne = false;
|
|
3249
|
-
do {
|
|
3250
|
-
var _ret = _loop();
|
|
3251
|
-
if (_type_of(_ret) === "object") return {
|
|
3252
|
-
v: _ret.v
|
|
3253
|
-
};
|
|
3254
|
-
if (_ret === "break") break;
|
|
3255
|
-
}while (got && localTarget.allowRepetition && tmpTxt.length && !got.lookup);
|
|
3256
|
-
} else {
|
|
3257
|
-
var got1 = readToken(tmpTxt, phases[i]);
|
|
3258
|
-
if (!got1) {
|
|
3259
|
-
return {
|
|
3260
|
-
v: void void 0
|
|
3261
|
-
};
|
|
3262
|
-
}
|
|
3263
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514> " + JSON.stringify(got1.text) + phases[i].source);
|
|
3264
|
-
foundSomething = true;
|
|
3265
|
-
got1.start += position;
|
|
3266
|
-
got1.end += position;
|
|
3267
|
-
tmp.text = tmp.text + got1.text;
|
|
3268
|
-
tmp.end = tmp.text.length;
|
|
3269
|
-
tmpTxt = tmpTxt.substr(got1.text.length);
|
|
3270
|
-
position += got1.text.length;
|
|
3271
|
-
tmp.rest = tmpTxt;
|
|
3272
|
-
}
|
|
3273
|
-
};
|
|
3274
|
-
if (out) return;
|
|
3275
|
-
var pinned = null;
|
|
3276
|
-
var tmp = {
|
|
3277
|
-
type: type.name,
|
|
3278
|
-
text: "",
|
|
3279
|
-
children: [],
|
|
3280
|
-
end: 0,
|
|
3281
|
-
errors: [],
|
|
3282
|
-
fullText: "",
|
|
3283
|
-
parent: null,
|
|
3284
|
-
start: 0,
|
|
3285
|
-
rest: txt
|
|
3286
|
-
};
|
|
3287
|
-
if (targetLex.fragment) tmp.fragment = true;
|
|
3288
|
-
var tmpTxt = txt;
|
|
3289
|
-
var position = 0;
|
|
3290
|
-
var allOptional = phases.length > 0;
|
|
3291
|
-
var foundSomething = false;
|
|
3292
|
-
for(var i = 0; i < phases.length; i++){
|
|
3293
|
-
var _ret = _loop(i);
|
|
3294
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
3295
|
-
}
|
|
3296
|
-
if (foundSomething) {
|
|
3297
|
-
out = tmp;
|
|
3298
|
-
printable && console.log(new Array(recursion).join("\u2502 ") + "\u251C<\u2500\u2534< PUSHING " + out.type + " " + JSON.stringify(out.text));
|
|
3299
|
-
}
|
|
3300
|
-
});
|
|
3301
|
-
}
|
|
3302
|
-
if (out && targetLex.simplifyWhenOneChildren && out.children.length == 1) {
|
|
3303
|
-
out = out.children[0];
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3306
|
-
if (!out) {
|
|
3307
|
-
printable && console.log(target + " NOT RESOLVED FROM " + txt);
|
|
3308
|
-
}
|
|
3309
|
-
return out;
|
|
3310
|
-
}
|
|
3311
|
-
},
|
|
3312
|
-
{
|
|
3313
|
-
key: "parseRecovery",
|
|
3314
|
-
value: function parseRecovery(recoverableToken, tmpTxt, recursion) {
|
|
3315
|
-
if (recoverableToken.recover && tmpTxt.length) {
|
|
3316
|
-
var printable = this.debug;
|
|
3317
|
-
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]));
|
|
3318
|
-
var tmp = {
|
|
3319
|
-
type: "SyntaxError",
|
|
3320
|
-
text: "",
|
|
3321
|
-
children: [],
|
|
3322
|
-
end: 0,
|
|
3323
|
-
errors: [],
|
|
3324
|
-
fullText: "",
|
|
3325
|
-
parent: null,
|
|
3326
|
-
start: 0,
|
|
3327
|
-
rest: ""
|
|
3328
|
-
};
|
|
3329
|
-
var got;
|
|
3330
|
-
do {
|
|
3331
|
-
got = this.parse(tmpTxt, recoverableToken.recover, recursion + 1);
|
|
3332
|
-
if (got) {
|
|
3333
|
-
new TokenError_1.TokenError('Unexpected input: "' + tmp.text + '" Expecting: '.concat(recoverableToken.name), tmp);
|
|
3334
|
-
break;
|
|
3335
|
-
} else {
|
|
3336
|
-
tmp.text = tmp.text + tmpTxt[0];
|
|
3337
|
-
tmp.end = tmp.text.length;
|
|
3338
|
-
tmpTxt = tmpTxt.substr(1);
|
|
3339
|
-
}
|
|
3340
|
-
}while (!got && tmpTxt.length > 0);
|
|
3341
|
-
if (tmp.text.length > 0 && got) {
|
|
3342
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "Recovered text: " + JSON.stringify(tmp.text));
|
|
3343
|
-
return tmp;
|
|
3344
|
-
}
|
|
3345
|
-
}
|
|
3346
|
-
return null;
|
|
3347
|
-
}
|
|
3348
|
-
}
|
|
3349
|
-
]);
|
|
3350
|
-
return Parser2;
|
|
3351
|
-
}();
|
|
3352
|
-
exports.Parser = Parser2;
|
|
3353
|
-
exports.default = Parser2;
|
|
3354
|
-
}
|
|
3355
|
-
});
|
|
3356
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/SemanticHelpers.js
|
|
3357
|
-
var require_SemanticHelpers = __commonJS({
|
|
3358
|
-
"../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/SemanticHelpers.js": function(exports) {
|
|
3359
|
-
"use strict";
|
|
3360
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3361
|
-
value: true
|
|
3362
|
-
});
|
|
3363
|
-
exports.findChildrenByType = void 0;
|
|
3364
|
-
function findChildrenByType(token, type) {
|
|
3365
|
-
return token.children ? token.children.filter(function(x) {
|
|
3366
|
-
return x.type == type;
|
|
3367
|
-
}) : [];
|
|
3368
|
-
}
|
|
3369
|
-
exports.findChildrenByType = findChildrenByType;
|
|
3370
|
-
}
|
|
3371
|
-
});
|
|
3372
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/BNF.js
|
|
3373
|
-
var require_BNF = __commonJS({
|
|
3374
|
-
"../../../../../../../../../../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) {
|
|
3375
|
-
"use strict";
|
|
3376
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3377
|
-
value: true
|
|
3378
|
-
});
|
|
3379
|
-
var SemanticHelpers_1 = require_SemanticHelpers();
|
|
3380
|
-
var Parser_1 = require_Parser();
|
|
3381
|
-
var BNF;
|
|
3382
|
-
(function(BNF2) {
|
|
3383
|
-
BNF2.RULES = [
|
|
3384
|
-
{
|
|
3385
|
-
name: "syntax",
|
|
3386
|
-
bnf: [
|
|
3387
|
-
[
|
|
3388
|
-
"RULE_EOL*",
|
|
3389
|
-
"rule+"
|
|
3390
|
-
]
|
|
3391
|
-
]
|
|
3392
|
-
},
|
|
3393
|
-
{
|
|
3394
|
-
name: "rule",
|
|
3395
|
-
bnf: [
|
|
3396
|
-
[
|
|
3397
|
-
'" "*',
|
|
3398
|
-
'"<"',
|
|
3399
|
-
"rule-name",
|
|
3400
|
-
'">"',
|
|
3401
|
-
'" "*',
|
|
3402
|
-
'"::="',
|
|
3403
|
-
"firstExpression",
|
|
3404
|
-
"otherExpression*",
|
|
3405
|
-
'" "*',
|
|
3406
|
-
"RULE_EOL+",
|
|
3407
|
-
'" "*'
|
|
3408
|
-
]
|
|
3409
|
-
]
|
|
3410
|
-
},
|
|
3411
|
-
{
|
|
3412
|
-
name: "firstExpression",
|
|
3413
|
-
bnf: [
|
|
3414
|
-
[
|
|
3415
|
-
'" "*',
|
|
3416
|
-
"list"
|
|
3417
|
-
]
|
|
3418
|
-
]
|
|
3419
|
-
},
|
|
3420
|
-
{
|
|
3421
|
-
name: "otherExpression",
|
|
3422
|
-
bnf: [
|
|
3423
|
-
[
|
|
3424
|
-
'" "*',
|
|
3425
|
-
'"|"',
|
|
3426
|
-
'" "*',
|
|
3427
|
-
"list"
|
|
3428
|
-
]
|
|
3429
|
-
]
|
|
3430
|
-
},
|
|
3431
|
-
{
|
|
3432
|
-
name: "RULE_EOL",
|
|
3433
|
-
bnf: [
|
|
3434
|
-
[
|
|
3435
|
-
'"\\r"'
|
|
3436
|
-
],
|
|
3437
|
-
[
|
|
3438
|
-
'"\\n"'
|
|
3439
|
-
]
|
|
3440
|
-
]
|
|
3441
|
-
},
|
|
3442
|
-
{
|
|
3443
|
-
name: "list",
|
|
3444
|
-
bnf: [
|
|
3445
|
-
[
|
|
3446
|
-
"term",
|
|
3447
|
-
'" "*',
|
|
3448
|
-
"list"
|
|
3449
|
-
],
|
|
3450
|
-
[
|
|
3451
|
-
"term"
|
|
3452
|
-
]
|
|
3453
|
-
]
|
|
3454
|
-
},
|
|
3455
|
-
{
|
|
3456
|
-
name: "term",
|
|
3457
|
-
bnf: [
|
|
3458
|
-
[
|
|
3459
|
-
"literal"
|
|
3460
|
-
],
|
|
3461
|
-
[
|
|
3462
|
-
'"<"',
|
|
3463
|
-
"rule-name",
|
|
3464
|
-
'">"'
|
|
3465
|
-
]
|
|
3466
|
-
]
|
|
3467
|
-
},
|
|
3468
|
-
{
|
|
3469
|
-
name: "literal",
|
|
3470
|
-
bnf: [
|
|
3471
|
-
[
|
|
3472
|
-
"'\"'",
|
|
3473
|
-
"RULE_CHARACTER1*",
|
|
3474
|
-
"'\"'"
|
|
3475
|
-
],
|
|
3476
|
-
[
|
|
3477
|
-
'"\'"',
|
|
3478
|
-
"RULE_CHARACTER2*",
|
|
3479
|
-
'"\'"'
|
|
3480
|
-
]
|
|
3481
|
-
]
|
|
3482
|
-
},
|
|
3483
|
-
{
|
|
3484
|
-
name: "RULE_CHARACTER",
|
|
3485
|
-
bnf: [
|
|
3486
|
-
[
|
|
3487
|
-
'" "'
|
|
3488
|
-
],
|
|
3489
|
-
[
|
|
3490
|
-
"RULE_LETTER"
|
|
3491
|
-
],
|
|
3492
|
-
[
|
|
3493
|
-
"RULE_DIGIT"
|
|
3494
|
-
],
|
|
3495
|
-
[
|
|
3496
|
-
"RULE_SYMBOL"
|
|
3497
|
-
]
|
|
3498
|
-
]
|
|
3499
|
-
},
|
|
3500
|
-
{
|
|
3501
|
-
name: "RULE_LETTER",
|
|
3502
|
-
bnf: [
|
|
3503
|
-
[
|
|
3504
|
-
'"A"'
|
|
3505
|
-
],
|
|
3506
|
-
[
|
|
3507
|
-
'"B"'
|
|
3508
|
-
],
|
|
3509
|
-
[
|
|
3510
|
-
'"C"'
|
|
3511
|
-
],
|
|
3512
|
-
[
|
|
3513
|
-
'"D"'
|
|
3514
|
-
],
|
|
3515
|
-
[
|
|
3516
|
-
'"E"'
|
|
3517
|
-
],
|
|
3518
|
-
[
|
|
3519
|
-
'"F"'
|
|
3520
|
-
],
|
|
3521
|
-
[
|
|
3522
|
-
'"G"'
|
|
3523
|
-
],
|
|
3524
|
-
[
|
|
3525
|
-
'"H"'
|
|
3526
|
-
],
|
|
3527
|
-
[
|
|
3528
|
-
'"I"'
|
|
3529
|
-
],
|
|
3530
|
-
[
|
|
3531
|
-
'"J"'
|
|
3532
|
-
],
|
|
3533
|
-
[
|
|
3534
|
-
'"K"'
|
|
3535
|
-
],
|
|
3536
|
-
[
|
|
3537
|
-
'"L"'
|
|
3538
|
-
],
|
|
3539
|
-
[
|
|
3540
|
-
'"M"'
|
|
3541
|
-
],
|
|
3542
|
-
[
|
|
3543
|
-
'"N"'
|
|
3544
|
-
],
|
|
3545
|
-
[
|
|
3546
|
-
'"O"'
|
|
3547
|
-
],
|
|
3548
|
-
[
|
|
3549
|
-
'"P"'
|
|
3550
|
-
],
|
|
3551
|
-
[
|
|
3552
|
-
'"Q"'
|
|
3553
|
-
],
|
|
3554
|
-
[
|
|
3555
|
-
'"R"'
|
|
3556
|
-
],
|
|
3557
|
-
[
|
|
3558
|
-
'"S"'
|
|
3559
|
-
],
|
|
3560
|
-
[
|
|
3561
|
-
'"T"'
|
|
3562
|
-
],
|
|
3563
|
-
[
|
|
3564
|
-
'"U"'
|
|
3565
|
-
],
|
|
3566
|
-
[
|
|
3567
|
-
'"V"'
|
|
3568
|
-
],
|
|
3569
|
-
[
|
|
3570
|
-
'"W"'
|
|
3571
|
-
],
|
|
3572
|
-
[
|
|
3573
|
-
'"X"'
|
|
3574
|
-
],
|
|
3575
|
-
[
|
|
3576
|
-
'"Y"'
|
|
3577
|
-
],
|
|
3578
|
-
[
|
|
3579
|
-
'"Z"'
|
|
3580
|
-
],
|
|
3581
|
-
[
|
|
3582
|
-
'"a"'
|
|
3583
|
-
],
|
|
3584
|
-
[
|
|
3585
|
-
'"b"'
|
|
3586
|
-
],
|
|
3587
|
-
[
|
|
3588
|
-
'"c"'
|
|
3589
|
-
],
|
|
3590
|
-
[
|
|
3591
|
-
'"d"'
|
|
3592
|
-
],
|
|
3593
|
-
[
|
|
3594
|
-
'"e"'
|
|
3595
|
-
],
|
|
3596
|
-
[
|
|
3597
|
-
'"f"'
|
|
3598
|
-
],
|
|
3599
|
-
[
|
|
3600
|
-
'"g"'
|
|
3601
|
-
],
|
|
3602
|
-
[
|
|
3603
|
-
'"h"'
|
|
3604
|
-
],
|
|
3605
|
-
[
|
|
3606
|
-
'"i"'
|
|
3607
|
-
],
|
|
3608
|
-
[
|
|
3609
|
-
'"j"'
|
|
3610
|
-
],
|
|
3611
|
-
[
|
|
3612
|
-
'"k"'
|
|
3613
|
-
],
|
|
3614
|
-
[
|
|
3615
|
-
'"l"'
|
|
3616
|
-
],
|
|
3617
|
-
[
|
|
3618
|
-
'"m"'
|
|
3619
|
-
],
|
|
3620
|
-
[
|
|
3621
|
-
'"n"'
|
|
3622
|
-
],
|
|
3623
|
-
[
|
|
3624
|
-
'"o"'
|
|
3625
|
-
],
|
|
3626
|
-
[
|
|
3627
|
-
'"p"'
|
|
3628
|
-
],
|
|
3629
|
-
[
|
|
3630
|
-
'"q"'
|
|
3631
|
-
],
|
|
3632
|
-
[
|
|
3633
|
-
'"r"'
|
|
3634
|
-
],
|
|
3635
|
-
[
|
|
3636
|
-
'"s"'
|
|
3637
|
-
],
|
|
3638
|
-
[
|
|
3639
|
-
'"t"'
|
|
3640
|
-
],
|
|
3641
|
-
[
|
|
3642
|
-
'"u"'
|
|
3643
|
-
],
|
|
3644
|
-
[
|
|
3645
|
-
'"v"'
|
|
3646
|
-
],
|
|
3647
|
-
[
|
|
3648
|
-
'"w"'
|
|
3649
|
-
],
|
|
3650
|
-
[
|
|
3651
|
-
'"x"'
|
|
3652
|
-
],
|
|
3653
|
-
[
|
|
3654
|
-
'"y"'
|
|
3655
|
-
],
|
|
3656
|
-
[
|
|
3657
|
-
'"z"'
|
|
3658
|
-
]
|
|
3659
|
-
]
|
|
3660
|
-
},
|
|
3661
|
-
{
|
|
3662
|
-
name: "RULE_DIGIT",
|
|
3663
|
-
bnf: [
|
|
3664
|
-
[
|
|
3665
|
-
'"0"'
|
|
3666
|
-
],
|
|
3667
|
-
[
|
|
3668
|
-
'"1"'
|
|
3669
|
-
],
|
|
3670
|
-
[
|
|
3671
|
-
'"2"'
|
|
3672
|
-
],
|
|
3673
|
-
[
|
|
3674
|
-
'"3"'
|
|
3675
|
-
],
|
|
3676
|
-
[
|
|
3677
|
-
'"4"'
|
|
3678
|
-
],
|
|
3679
|
-
[
|
|
3680
|
-
'"5"'
|
|
3681
|
-
],
|
|
3682
|
-
[
|
|
3683
|
-
'"6"'
|
|
3684
|
-
],
|
|
3685
|
-
[
|
|
3686
|
-
'"7"'
|
|
3687
|
-
],
|
|
3688
|
-
[
|
|
3689
|
-
'"8"'
|
|
3690
|
-
],
|
|
3691
|
-
[
|
|
3692
|
-
'"9"'
|
|
3693
|
-
]
|
|
3694
|
-
]
|
|
3695
|
-
},
|
|
3696
|
-
{
|
|
3697
|
-
name: "RULE_SYMBOL",
|
|
3698
|
-
bnf: [
|
|
3699
|
-
[
|
|
3700
|
-
'"-"'
|
|
3701
|
-
],
|
|
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
|
-
name: "RULE_CHARACTER1",
|
|
3799
|
-
bnf: [
|
|
3800
|
-
[
|
|
3801
|
-
"RULE_CHARACTER"
|
|
3802
|
-
],
|
|
3803
|
-
[
|
|
3804
|
-
'"\'"'
|
|
3805
|
-
]
|
|
3806
|
-
]
|
|
3807
|
-
},
|
|
3808
|
-
{
|
|
3809
|
-
name: "RULE_CHARACTER2",
|
|
3810
|
-
bnf: [
|
|
3811
|
-
[
|
|
3812
|
-
"RULE_CHARACTER"
|
|
3813
|
-
],
|
|
3814
|
-
[
|
|
3815
|
-
"'\"'"
|
|
3816
|
-
]
|
|
3817
|
-
]
|
|
3818
|
-
},
|
|
3819
|
-
{
|
|
3820
|
-
name: "rule-name",
|
|
3821
|
-
bnf: [
|
|
3822
|
-
[
|
|
3823
|
-
"RULE_LETTER",
|
|
3824
|
-
"RULE_CHAR*"
|
|
3825
|
-
]
|
|
3826
|
-
]
|
|
3827
|
-
},
|
|
3828
|
-
{
|
|
3829
|
-
name: "RULE_CHAR",
|
|
3830
|
-
bnf: [
|
|
3831
|
-
[
|
|
3832
|
-
"RULE_LETTER"
|
|
3833
|
-
],
|
|
3834
|
-
[
|
|
3835
|
-
"RULE_DIGIT"
|
|
3836
|
-
],
|
|
3837
|
-
[
|
|
3838
|
-
'"_"'
|
|
3839
|
-
],
|
|
3840
|
-
[
|
|
3841
|
-
'"-"'
|
|
3842
|
-
]
|
|
3843
|
-
]
|
|
3844
|
-
}
|
|
3845
|
-
];
|
|
3846
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
3847
|
-
debug: false
|
|
3848
|
-
});
|
|
3849
|
-
function getAllTerms(expr) {
|
|
3850
|
-
var terms = SemanticHelpers_1.findChildrenByType(expr, "term").map(function(term) {
|
|
3851
|
-
return SemanticHelpers_1.findChildrenByType(term, "literal").concat(SemanticHelpers_1.findChildrenByType(term, "rule-name"))[0].text;
|
|
3852
|
-
});
|
|
3853
|
-
SemanticHelpers_1.findChildrenByType(expr, "list").forEach(function(expr2) {
|
|
3854
|
-
terms = terms.concat(getAllTerms(expr2));
|
|
3855
|
-
});
|
|
3856
|
-
return terms;
|
|
3857
|
-
}
|
|
3858
|
-
function getRules(source) {
|
|
3859
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
3860
|
-
var ast = parser2.getAST(source);
|
|
3861
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
3862
|
-
if (ast.errors && ast.errors.length) {
|
|
3863
|
-
throw ast.errors[0];
|
|
3864
|
-
}
|
|
3865
|
-
var rules = SemanticHelpers_1.findChildrenByType(ast, "rule");
|
|
3866
|
-
var ret = rules.map(function(rule) {
|
|
3867
|
-
var name = SemanticHelpers_1.findChildrenByType(rule, "rule-name")[0].text;
|
|
3868
|
-
var expressions = SemanticHelpers_1.findChildrenByType(rule, "firstExpression").concat(SemanticHelpers_1.findChildrenByType(rule, "otherExpression"));
|
|
3869
|
-
var bnf = [];
|
|
3870
|
-
expressions.forEach(function(expr) {
|
|
3871
|
-
bnf.push(getAllTerms(expr));
|
|
3872
|
-
});
|
|
3873
|
-
return {
|
|
3874
|
-
name: name,
|
|
3875
|
-
bnf: bnf
|
|
3876
|
-
};
|
|
3877
|
-
});
|
|
3878
|
-
if (!ret.some(function(x) {
|
|
3879
|
-
return x.name == "EOL";
|
|
3880
|
-
})) {
|
|
3881
|
-
ret.push({
|
|
3882
|
-
name: "EOL",
|
|
3883
|
-
bnf: [
|
|
3884
|
-
[
|
|
3885
|
-
'"\\r\\n"',
|
|
3886
|
-
'"\\r"',
|
|
3887
|
-
'"\\n"'
|
|
3888
|
-
]
|
|
3889
|
-
]
|
|
3890
|
-
});
|
|
3891
|
-
}
|
|
3892
|
-
return ret;
|
|
3893
|
-
}
|
|
3894
|
-
BNF2.getRules = getRules;
|
|
3895
|
-
function Transform(source) {
|
|
3896
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
3897
|
-
return getRules(source.join(""), subParser);
|
|
3898
|
-
}
|
|
3899
|
-
BNF2.Transform = Transform;
|
|
3900
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
3901
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
3902
|
-
var _super = _create_super(Parser2);
|
|
3903
|
-
function Parser2(source, options) {
|
|
3904
|
-
_class_call_check(this, Parser2);
|
|
3905
|
-
var _this;
|
|
3906
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
3907
|
-
debug: true
|
|
3908
|
-
}) : BNF2.defaultParser;
|
|
3909
|
-
_this = _super.call(this, getRules(source, subParser), options);
|
|
3910
|
-
_this.source = source;
|
|
3911
|
-
return _this;
|
|
3912
|
-
}
|
|
3913
|
-
_create_class(Parser2, [
|
|
3914
|
-
{
|
|
3915
|
-
key: "emitSource",
|
|
3916
|
-
value: function emitSource() {
|
|
3917
|
-
return this.source;
|
|
3918
|
-
}
|
|
3919
|
-
}
|
|
3920
|
-
]);
|
|
3921
|
-
return Parser2;
|
|
3922
|
-
}(Parser_1.Parser);
|
|
3923
|
-
BNF2.Parser = Parser2;
|
|
3924
|
-
})(BNF || (BNF = {}));
|
|
3925
|
-
exports.default = BNF;
|
|
3926
|
-
}
|
|
3927
|
-
});
|
|
3928
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/W3CEBNF.js
|
|
3929
|
-
var require_W3CEBNF = __commonJS({
|
|
3930
|
-
"../../../../../../../../../../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) {
|
|
3931
|
-
"use strict";
|
|
3932
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3933
|
-
value: true
|
|
3934
|
-
});
|
|
3935
|
-
var Parser_1 = require_Parser();
|
|
3936
|
-
var BNF;
|
|
3937
|
-
(function(BNF2) {
|
|
3938
|
-
BNF2.RULES = [
|
|
3939
|
-
{
|
|
3940
|
-
name: "Grammar",
|
|
3941
|
-
bnf: [
|
|
3942
|
-
[
|
|
3943
|
-
"RULE_S*",
|
|
3944
|
-
"%Atomic*",
|
|
3945
|
-
"EOF"
|
|
3946
|
-
]
|
|
3947
|
-
]
|
|
3948
|
-
},
|
|
3949
|
-
{
|
|
3950
|
-
name: "%Atomic",
|
|
3951
|
-
bnf: [
|
|
3952
|
-
[
|
|
3953
|
-
"Production",
|
|
3954
|
-
"RULE_S*"
|
|
3955
|
-
]
|
|
3956
|
-
],
|
|
3957
|
-
fragment: true
|
|
3958
|
-
},
|
|
3959
|
-
{
|
|
3960
|
-
name: "Production",
|
|
3961
|
-
bnf: [
|
|
3962
|
-
[
|
|
3963
|
-
"NCName",
|
|
3964
|
-
"RULE_S*",
|
|
3965
|
-
'"::="',
|
|
3966
|
-
"RULE_WHITESPACE*",
|
|
3967
|
-
"Choice",
|
|
3968
|
-
"RULE_WHITESPACE*",
|
|
3969
|
-
"RULE_EOL+",
|
|
3970
|
-
"RULE_S*"
|
|
3971
|
-
]
|
|
3972
|
-
]
|
|
3973
|
-
},
|
|
3974
|
-
{
|
|
3975
|
-
name: "NCName",
|
|
3976
|
-
bnf: [
|
|
3977
|
-
[
|
|
3978
|
-
/[a-zA-Z][a-zA-Z_0-9]*/
|
|
3979
|
-
]
|
|
3980
|
-
]
|
|
3981
|
-
},
|
|
3982
|
-
{
|
|
3983
|
-
name: "Choice",
|
|
3984
|
-
bnf: [
|
|
3985
|
-
[
|
|
3986
|
-
"SequenceOrDifference",
|
|
3987
|
-
"%_Choice_1*"
|
|
3988
|
-
]
|
|
3989
|
-
],
|
|
3990
|
-
fragment: true
|
|
3991
|
-
},
|
|
3992
|
-
{
|
|
3993
|
-
name: "%_Choice_1",
|
|
3994
|
-
bnf: [
|
|
3995
|
-
[
|
|
3996
|
-
"RULE_WHITESPACE*",
|
|
3997
|
-
'"|"',
|
|
3998
|
-
"RULE_WHITESPACE*",
|
|
3999
|
-
"SequenceOrDifference"
|
|
4000
|
-
]
|
|
4001
|
-
],
|
|
4002
|
-
fragment: true
|
|
4003
|
-
},
|
|
4004
|
-
{
|
|
4005
|
-
name: "SequenceOrDifference",
|
|
4006
|
-
bnf: [
|
|
4007
|
-
[
|
|
4008
|
-
"Item",
|
|
4009
|
-
"RULE_WHITESPACE*",
|
|
4010
|
-
"%_Item_1?"
|
|
4011
|
-
]
|
|
4012
|
-
]
|
|
4013
|
-
},
|
|
4014
|
-
{
|
|
4015
|
-
name: "%_Item_1",
|
|
4016
|
-
bnf: [
|
|
4017
|
-
[
|
|
4018
|
-
"Minus",
|
|
4019
|
-
"Item"
|
|
4020
|
-
],
|
|
4021
|
-
[
|
|
4022
|
-
"Item*"
|
|
4023
|
-
]
|
|
4024
|
-
],
|
|
4025
|
-
fragment: true
|
|
4026
|
-
},
|
|
4027
|
-
{
|
|
4028
|
-
name: "Minus",
|
|
4029
|
-
bnf: [
|
|
4030
|
-
[
|
|
4031
|
-
'"-"'
|
|
4032
|
-
]
|
|
4033
|
-
]
|
|
4034
|
-
},
|
|
4035
|
-
{
|
|
4036
|
-
name: "Item",
|
|
4037
|
-
bnf: [
|
|
4038
|
-
[
|
|
4039
|
-
"RULE_WHITESPACE*",
|
|
4040
|
-
"%Primary",
|
|
4041
|
-
"PrimaryDecoration?"
|
|
4042
|
-
]
|
|
4043
|
-
],
|
|
4044
|
-
fragment: true
|
|
4045
|
-
},
|
|
4046
|
-
{
|
|
4047
|
-
name: "PrimaryDecoration",
|
|
4048
|
-
bnf: [
|
|
4049
|
-
[
|
|
4050
|
-
'"?"'
|
|
4051
|
-
],
|
|
4052
|
-
[
|
|
4053
|
-
'"*"'
|
|
4054
|
-
],
|
|
4055
|
-
[
|
|
4056
|
-
'"+"'
|
|
4057
|
-
]
|
|
4058
|
-
]
|
|
4059
|
-
},
|
|
4060
|
-
{
|
|
4061
|
-
name: "DecorationName",
|
|
4062
|
-
bnf: [
|
|
4063
|
-
[
|
|
4064
|
-
'"ebnf://"',
|
|
4065
|
-
/[^\x5D#]+/
|
|
4066
|
-
]
|
|
4067
|
-
]
|
|
4068
|
-
},
|
|
4069
|
-
{
|
|
4070
|
-
name: "%Primary",
|
|
4071
|
-
bnf: [
|
|
4072
|
-
[
|
|
4073
|
-
"NCName"
|
|
4074
|
-
],
|
|
4075
|
-
[
|
|
4076
|
-
"StringLiteral"
|
|
4077
|
-
],
|
|
4078
|
-
[
|
|
4079
|
-
"CharCode"
|
|
4080
|
-
],
|
|
4081
|
-
[
|
|
4082
|
-
"CharClass"
|
|
4083
|
-
],
|
|
4084
|
-
[
|
|
4085
|
-
"SubItem"
|
|
4086
|
-
]
|
|
4087
|
-
],
|
|
4088
|
-
fragment: true
|
|
4089
|
-
},
|
|
4090
|
-
{
|
|
4091
|
-
name: "SubItem",
|
|
4092
|
-
bnf: [
|
|
4093
|
-
[
|
|
4094
|
-
'"("',
|
|
4095
|
-
"RULE_WHITESPACE*",
|
|
4096
|
-
"Choice",
|
|
4097
|
-
"RULE_WHITESPACE*",
|
|
4098
|
-
'")"'
|
|
4099
|
-
]
|
|
4100
|
-
]
|
|
4101
|
-
},
|
|
4102
|
-
{
|
|
4103
|
-
name: "StringLiteral",
|
|
4104
|
-
bnf: [
|
|
4105
|
-
[
|
|
4106
|
-
"'\"'",
|
|
4107
|
-
/[^"]*/,
|
|
4108
|
-
"'\"'"
|
|
4109
|
-
],
|
|
4110
|
-
[
|
|
4111
|
-
'"\'"',
|
|
4112
|
-
/[^']*/,
|
|
4113
|
-
'"\'"'
|
|
4114
|
-
]
|
|
4115
|
-
],
|
|
4116
|
-
pinned: 1
|
|
4117
|
-
},
|
|
4118
|
-
{
|
|
4119
|
-
name: "CharCode",
|
|
4120
|
-
bnf: [
|
|
4121
|
-
[
|
|
4122
|
-
'"#x"',
|
|
4123
|
-
/[0-9a-zA-Z]+/
|
|
4124
|
-
]
|
|
4125
|
-
]
|
|
4126
|
-
},
|
|
4127
|
-
{
|
|
4128
|
-
name: "CharClass",
|
|
4129
|
-
bnf: [
|
|
4130
|
-
[
|
|
4131
|
-
"'['",
|
|
4132
|
-
"'^'?",
|
|
4133
|
-
"%RULE_CharClass_1+",
|
|
4134
|
-
'"]"'
|
|
4135
|
-
]
|
|
4136
|
-
]
|
|
4137
|
-
},
|
|
4138
|
-
{
|
|
4139
|
-
name: "%RULE_CharClass_1",
|
|
4140
|
-
bnf: [
|
|
4141
|
-
[
|
|
4142
|
-
"CharCodeRange"
|
|
4143
|
-
],
|
|
4144
|
-
[
|
|
4145
|
-
"CharRange"
|
|
4146
|
-
],
|
|
4147
|
-
[
|
|
4148
|
-
"CharCode"
|
|
4149
|
-
],
|
|
4150
|
-
[
|
|
4151
|
-
"RULE_Char"
|
|
4152
|
-
]
|
|
4153
|
-
],
|
|
4154
|
-
fragment: true
|
|
4155
|
-
},
|
|
4156
|
-
{
|
|
4157
|
-
name: "RULE_Char",
|
|
4158
|
-
bnf: [
|
|
4159
|
-
[
|
|
4160
|
-
/\x09/
|
|
4161
|
-
],
|
|
4162
|
-
[
|
|
4163
|
-
/\x0A/
|
|
4164
|
-
],
|
|
4165
|
-
[
|
|
4166
|
-
/\x0D/
|
|
4167
|
-
],
|
|
4168
|
-
[
|
|
4169
|
-
/[\x20-\x5c]/
|
|
4170
|
-
],
|
|
4171
|
-
[
|
|
4172
|
-
/[\x5e-\uD7FF]/
|
|
4173
|
-
],
|
|
4174
|
-
[
|
|
4175
|
-
/[\uE000-\uFFFD]/
|
|
4176
|
-
]
|
|
4177
|
-
]
|
|
4178
|
-
},
|
|
4179
|
-
{
|
|
4180
|
-
name: "CharRange",
|
|
4181
|
-
bnf: [
|
|
4182
|
-
[
|
|
4183
|
-
"RULE_Char",
|
|
4184
|
-
'"-"',
|
|
4185
|
-
"RULE_Char"
|
|
4186
|
-
]
|
|
4187
|
-
]
|
|
4188
|
-
},
|
|
4189
|
-
{
|
|
4190
|
-
name: "CharCodeRange",
|
|
4191
|
-
bnf: [
|
|
4192
|
-
[
|
|
4193
|
-
"CharCode",
|
|
4194
|
-
'"-"',
|
|
4195
|
-
"CharCode"
|
|
4196
|
-
]
|
|
4197
|
-
]
|
|
4198
|
-
},
|
|
4199
|
-
{
|
|
4200
|
-
name: "RULE_WHITESPACE",
|
|
4201
|
-
bnf: [
|
|
4202
|
-
[
|
|
4203
|
-
"%RULE_WHITESPACE_CHAR*"
|
|
4204
|
-
],
|
|
4205
|
-
[
|
|
4206
|
-
"Comment",
|
|
4207
|
-
"RULE_WHITESPACE*"
|
|
4208
|
-
]
|
|
4209
|
-
]
|
|
4210
|
-
},
|
|
4211
|
-
{
|
|
4212
|
-
name: "RULE_S",
|
|
4213
|
-
bnf: [
|
|
4214
|
-
[
|
|
4215
|
-
"RULE_WHITESPACE",
|
|
4216
|
-
"RULE_S*"
|
|
4217
|
-
],
|
|
4218
|
-
[
|
|
4219
|
-
"RULE_EOL",
|
|
4220
|
-
"RULE_S*"
|
|
4221
|
-
]
|
|
4222
|
-
]
|
|
4223
|
-
},
|
|
4224
|
-
{
|
|
4225
|
-
name: "%RULE_WHITESPACE_CHAR",
|
|
4226
|
-
bnf: [
|
|
4227
|
-
[
|
|
4228
|
-
/\x09/
|
|
4229
|
-
],
|
|
4230
|
-
[
|
|
4231
|
-
/\x20/
|
|
4232
|
-
]
|
|
4233
|
-
],
|
|
4234
|
-
fragment: true
|
|
4235
|
-
},
|
|
4236
|
-
{
|
|
4237
|
-
name: "Comment",
|
|
4238
|
-
bnf: [
|
|
4239
|
-
[
|
|
4240
|
-
'"/*"',
|
|
4241
|
-
"%RULE_Comment_Body*",
|
|
4242
|
-
'"*/"'
|
|
4243
|
-
]
|
|
4244
|
-
]
|
|
4245
|
-
},
|
|
4246
|
-
{
|
|
4247
|
-
name: "%RULE_Comment_Body",
|
|
4248
|
-
bnf: [
|
|
4249
|
-
[
|
|
4250
|
-
'!"*/"',
|
|
4251
|
-
/[^*]/
|
|
4252
|
-
]
|
|
4253
|
-
],
|
|
4254
|
-
fragment: true
|
|
4255
|
-
},
|
|
4256
|
-
{
|
|
4257
|
-
name: "RULE_EOL",
|
|
4258
|
-
bnf: [
|
|
4259
|
-
[
|
|
4260
|
-
/\x0D/,
|
|
4261
|
-
/\x0A/
|
|
4262
|
-
],
|
|
4263
|
-
[
|
|
4264
|
-
/\x0A/
|
|
4265
|
-
],
|
|
4266
|
-
[
|
|
4267
|
-
/\x0D/
|
|
4268
|
-
]
|
|
4269
|
-
]
|
|
4270
|
-
},
|
|
4271
|
-
{
|
|
4272
|
-
name: "Link",
|
|
4273
|
-
bnf: [
|
|
4274
|
-
[
|
|
4275
|
-
"'['",
|
|
4276
|
-
"Url",
|
|
4277
|
-
"']'"
|
|
4278
|
-
]
|
|
4279
|
-
]
|
|
4280
|
-
},
|
|
4281
|
-
{
|
|
4282
|
-
name: "Url",
|
|
4283
|
-
bnf: [
|
|
4284
|
-
[
|
|
4285
|
-
/[^\x5D:/?#]/,
|
|
4286
|
-
'"://"',
|
|
4287
|
-
/[^\x5D#]+/,
|
|
4288
|
-
"%Url1?"
|
|
4289
|
-
]
|
|
4290
|
-
]
|
|
4291
|
-
},
|
|
4292
|
-
{
|
|
4293
|
-
name: "%Url1",
|
|
4294
|
-
bnf: [
|
|
4295
|
-
[
|
|
4296
|
-
'"#"',
|
|
4297
|
-
"NCName"
|
|
4298
|
-
]
|
|
4299
|
-
],
|
|
4300
|
-
fragment: true
|
|
4301
|
-
}
|
|
4302
|
-
];
|
|
4303
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
4304
|
-
debug: false
|
|
4305
|
-
});
|
|
4306
|
-
var preDecorationRE = /^(!|&)/;
|
|
4307
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
4308
|
-
var subExpressionRE = /^%/;
|
|
4309
|
-
function getBNFRule(name, parser2) {
|
|
4310
|
-
if (typeof name == "string") {
|
|
4311
|
-
if (preDecorationRE.test(name)) return "";
|
|
4312
|
-
var subexpression = subExpressionRE.test(name);
|
|
4313
|
-
if (subexpression) {
|
|
4314
|
-
var decoration = decorationRE.exec(name);
|
|
4315
|
-
var decorationText = decoration ? decoration[0] + " " : "";
|
|
4316
|
-
var lonely = isLonelyRule(name, parser2);
|
|
4317
|
-
if (lonely) return getBNFBody(name, parser2) + decorationText;
|
|
4318
|
-
return "(" + getBNFBody(name, parser2) + ")" + decorationText;
|
|
4319
|
-
}
|
|
4320
|
-
return name;
|
|
4321
|
-
} else {
|
|
4322
|
-
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]");
|
|
4323
|
-
}
|
|
4324
|
-
}
|
|
4325
|
-
function isLonelyRule(name, parser2) {
|
|
4326
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4327
|
-
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] == "'");
|
|
4328
|
-
}
|
|
4329
|
-
function getBNFChoice(rules, parser2) {
|
|
4330
|
-
return rules.map(function(x) {
|
|
4331
|
-
return getBNFRule(x, parser2);
|
|
4332
|
-
}).join(" ");
|
|
4333
|
-
}
|
|
4334
|
-
function getBNFBody(name, parser2) {
|
|
4335
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4336
|
-
if (rule) return rule.bnf.map(function(x) {
|
|
4337
|
-
return getBNFChoice(x, parser2);
|
|
4338
|
-
}).join(" | ");
|
|
4339
|
-
return "RULE_NOT_FOUND {" + name + "}";
|
|
4340
|
-
}
|
|
4341
|
-
function emit(parser2) {
|
|
4342
|
-
var acumulator = [];
|
|
4343
|
-
parser2.grammarRules.forEach(function(l) {
|
|
4344
|
-
if (!/^%/.test(l.name)) {
|
|
4345
|
-
var recover = l.recover ? " /* { recoverUntil=" + l.recover + " } */" : "";
|
|
4346
|
-
acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser2) + recover);
|
|
4347
|
-
}
|
|
4348
|
-
});
|
|
4349
|
-
return acumulator.join("\n");
|
|
4350
|
-
}
|
|
4351
|
-
BNF2.emit = emit;
|
|
4352
|
-
var subitems = 0;
|
|
4353
|
-
function restar(total, resta) {
|
|
4354
|
-
console.log("reberia restar " + resta + " a " + total);
|
|
4355
|
-
throw new Error("Difference not supported yet");
|
|
4356
|
-
}
|
|
4357
|
-
function convertRegex(txt) {
|
|
4358
|
-
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"));
|
|
4359
|
-
}
|
|
4360
|
-
function getSubItems(tmpRules, seq, parentName) {
|
|
4361
|
-
var anterior = null;
|
|
4362
|
-
var bnfSeq = [];
|
|
4363
|
-
seq.children.forEach(function(x, i) {
|
|
4364
|
-
if (x.type == "Minus") {
|
|
4365
|
-
restar(anterior, x);
|
|
4366
|
-
} else {}
|
|
4367
|
-
var decoration = seq.children[i + 1];
|
|
4368
|
-
decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || "";
|
|
4369
|
-
var preDecoration = "";
|
|
4370
|
-
switch(x.type){
|
|
4371
|
-
case "SubItem":
|
|
4372
|
-
var name = "%" + (parentName + subitems++);
|
|
4373
|
-
createRule(tmpRules, x, name);
|
|
4374
|
-
bnfSeq.push(preDecoration + name + decoration);
|
|
4375
|
-
break;
|
|
4376
|
-
case "NCName":
|
|
4377
|
-
case "StringLiteral":
|
|
4378
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
4379
|
-
break;
|
|
4380
|
-
case "CharCode":
|
|
4381
|
-
case "CharClass":
|
|
4382
|
-
if (decoration || preDecoration) {
|
|
4383
|
-
var newRule = {
|
|
4384
|
-
name: "%" + (parentName + subitems++),
|
|
4385
|
-
bnf: [
|
|
4386
|
-
[
|
|
4387
|
-
convertRegex(x.text)
|
|
4388
|
-
]
|
|
4389
|
-
]
|
|
4390
|
-
};
|
|
4391
|
-
tmpRules.push(newRule);
|
|
4392
|
-
bnfSeq.push(preDecoration + newRule.name + decoration);
|
|
4393
|
-
} else {
|
|
4394
|
-
bnfSeq.push(convertRegex(x.text));
|
|
4395
|
-
}
|
|
4396
|
-
break;
|
|
4397
|
-
case "PrimaryDecoration":
|
|
4398
|
-
break;
|
|
4399
|
-
default:
|
|
4400
|
-
throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text));
|
|
4401
|
-
}
|
|
4402
|
-
anterior = x;
|
|
4403
|
-
});
|
|
4404
|
-
return bnfSeq;
|
|
4405
|
-
}
|
|
4406
|
-
function createRule(tmpRules, token, name) {
|
|
4407
|
-
var bnf = token.children.filter(function(x) {
|
|
4408
|
-
return x.type == "SequenceOrDifference";
|
|
4409
|
-
}).map(function(s) {
|
|
4410
|
-
return getSubItems(tmpRules, s, name);
|
|
4411
|
-
});
|
|
4412
|
-
var rule = {
|
|
4413
|
-
name: name,
|
|
4414
|
-
bnf: bnf
|
|
4415
|
-
};
|
|
4416
|
-
var recover = null;
|
|
4417
|
-
bnf.forEach(function(x) {
|
|
4418
|
-
recover = recover || x["recover"];
|
|
4419
|
-
delete x["recover"];
|
|
4420
|
-
});
|
|
4421
|
-
if (name.indexOf("%") == 0) rule.fragment = true;
|
|
4422
|
-
if (recover) rule.recover = recover;
|
|
4423
|
-
tmpRules.push(rule);
|
|
4424
|
-
}
|
|
4425
|
-
function getRules(source) {
|
|
4426
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
4427
|
-
var ast = parser2.getAST(source);
|
|
4428
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
4429
|
-
if (ast.errors && ast.errors.length) {
|
|
4430
|
-
throw ast.errors[0];
|
|
4431
|
-
}
|
|
4432
|
-
var tmpRules = [];
|
|
4433
|
-
ast.children.filter(function(x) {
|
|
4434
|
-
return x.type == "Production";
|
|
4435
|
-
}).map(function(x) {
|
|
4436
|
-
var name = x.children.filter(function(x2) {
|
|
4437
|
-
return x2.type == "NCName";
|
|
4438
|
-
})[0].text;
|
|
4439
|
-
createRule(tmpRules, x, name);
|
|
4440
|
-
});
|
|
4441
|
-
return tmpRules;
|
|
4442
|
-
}
|
|
4443
|
-
BNF2.getRules = getRules;
|
|
4444
|
-
function Transform(source) {
|
|
4445
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
4446
|
-
return getRules(source.join(""), subParser);
|
|
4447
|
-
}
|
|
4448
|
-
BNF2.Transform = Transform;
|
|
4449
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
4450
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
4451
|
-
var _super = _create_super(Parser2);
|
|
4452
|
-
function Parser2(source, options) {
|
|
4453
|
-
_class_call_check(this, Parser2);
|
|
4454
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
4455
|
-
debug: true
|
|
4456
|
-
}) : BNF2.defaultParser;
|
|
4457
|
-
return _super.call(this, getRules(source, subParser), options);
|
|
4458
|
-
}
|
|
4459
|
-
_create_class(Parser2, [
|
|
4460
|
-
{
|
|
4461
|
-
key: "emitSource",
|
|
4462
|
-
value: function emitSource() {
|
|
4463
|
-
return emit(this);
|
|
4464
|
-
}
|
|
4465
|
-
}
|
|
4466
|
-
]);
|
|
4467
|
-
return Parser2;
|
|
4468
|
-
}(Parser_1.Parser);
|
|
4469
|
-
BNF2.Parser = Parser2;
|
|
4470
|
-
})(BNF || (BNF = {}));
|
|
4471
|
-
exports.default = BNF;
|
|
4472
|
-
}
|
|
4473
|
-
});
|
|
4474
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/Custom.js
|
|
4475
|
-
var require_Custom = __commonJS({
|
|
4476
|
-
"../../../../../../../../../../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) {
|
|
4477
|
-
"use strict";
|
|
4478
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4479
|
-
value: true
|
|
4480
|
-
});
|
|
4481
|
-
var TokenError_1 = require_TokenError();
|
|
4482
|
-
var Parser_1 = require_Parser();
|
|
4483
|
-
var BNF;
|
|
4484
|
-
(function(BNF2) {
|
|
4485
|
-
BNF2.RULES = [
|
|
4486
|
-
{
|
|
4487
|
-
name: "Grammar",
|
|
4488
|
-
bnf: [
|
|
4489
|
-
[
|
|
4490
|
-
"RULE_S*",
|
|
4491
|
-
"Attributes?",
|
|
4492
|
-
"RULE_S*",
|
|
4493
|
-
"%Atomic*",
|
|
4494
|
-
"EOF"
|
|
4495
|
-
]
|
|
4496
|
-
]
|
|
4497
|
-
},
|
|
4498
|
-
{
|
|
4499
|
-
name: "%Atomic",
|
|
4500
|
-
bnf: [
|
|
4501
|
-
[
|
|
4502
|
-
"Production",
|
|
4503
|
-
"RULE_S*"
|
|
4504
|
-
]
|
|
4505
|
-
],
|
|
4506
|
-
fragment: true
|
|
4507
|
-
},
|
|
4508
|
-
{
|
|
4509
|
-
name: "Production",
|
|
4510
|
-
bnf: [
|
|
4511
|
-
[
|
|
4512
|
-
"NCName",
|
|
4513
|
-
"RULE_S*",
|
|
4514
|
-
'"::="',
|
|
4515
|
-
"RULE_WHITESPACE*",
|
|
4516
|
-
"%Choice",
|
|
4517
|
-
"RULE_WHITESPACE*",
|
|
4518
|
-
"Attributes?",
|
|
4519
|
-
"RULE_EOL+",
|
|
4520
|
-
"RULE_S*"
|
|
4521
|
-
]
|
|
4522
|
-
]
|
|
4523
|
-
},
|
|
4524
|
-
{
|
|
4525
|
-
name: "NCName",
|
|
4526
|
-
bnf: [
|
|
4527
|
-
[
|
|
4528
|
-
/[a-zA-Z][a-zA-Z_0-9]*/
|
|
4529
|
-
]
|
|
4530
|
-
]
|
|
4531
|
-
},
|
|
4532
|
-
{
|
|
4533
|
-
name: "Attributes",
|
|
4534
|
-
bnf: [
|
|
4535
|
-
[
|
|
4536
|
-
'"{"',
|
|
4537
|
-
"Attribute",
|
|
4538
|
-
"%Attributes*",
|
|
4539
|
-
"RULE_S*",
|
|
4540
|
-
'"}"'
|
|
4541
|
-
]
|
|
4542
|
-
]
|
|
4543
|
-
},
|
|
4544
|
-
{
|
|
4545
|
-
name: "%Attributes",
|
|
4546
|
-
bnf: [
|
|
4547
|
-
[
|
|
4548
|
-
"RULE_S*",
|
|
4549
|
-
'","',
|
|
4550
|
-
"Attribute"
|
|
4551
|
-
]
|
|
4552
|
-
],
|
|
4553
|
-
fragment: true
|
|
4554
|
-
},
|
|
4555
|
-
{
|
|
4556
|
-
name: "Attribute",
|
|
4557
|
-
bnf: [
|
|
4558
|
-
[
|
|
4559
|
-
"RULE_S*",
|
|
4560
|
-
"NCName",
|
|
4561
|
-
"RULE_WHITESPACE*",
|
|
4562
|
-
'"="',
|
|
4563
|
-
"RULE_WHITESPACE*",
|
|
4564
|
-
"AttributeValue"
|
|
4565
|
-
]
|
|
4566
|
-
]
|
|
4567
|
-
},
|
|
4568
|
-
{
|
|
4569
|
-
name: "AttributeValue",
|
|
4570
|
-
bnf: [
|
|
4571
|
-
[
|
|
4572
|
-
"NCName"
|
|
4573
|
-
],
|
|
4574
|
-
[
|
|
4575
|
-
/[1-9][0-9]*/
|
|
4576
|
-
]
|
|
4577
|
-
]
|
|
4578
|
-
},
|
|
4579
|
-
{
|
|
4580
|
-
name: "%Choice",
|
|
4581
|
-
bnf: [
|
|
4582
|
-
[
|
|
4583
|
-
"SequenceOrDifference",
|
|
4584
|
-
"%_Choice_1*"
|
|
4585
|
-
]
|
|
4586
|
-
],
|
|
4587
|
-
fragment: true
|
|
4588
|
-
},
|
|
4589
|
-
{
|
|
4590
|
-
name: "%_Choice_1",
|
|
4591
|
-
bnf: [
|
|
4592
|
-
[
|
|
4593
|
-
"RULE_S*",
|
|
4594
|
-
'"|"',
|
|
4595
|
-
"RULE_S*",
|
|
4596
|
-
"SequenceOrDifference"
|
|
4597
|
-
]
|
|
4598
|
-
],
|
|
4599
|
-
fragment: true
|
|
4600
|
-
},
|
|
4601
|
-
{
|
|
4602
|
-
name: "SequenceOrDifference",
|
|
4603
|
-
bnf: [
|
|
4604
|
-
[
|
|
4605
|
-
"%Item",
|
|
4606
|
-
"RULE_WHITESPACE*",
|
|
4607
|
-
"%_Item_1?"
|
|
4608
|
-
]
|
|
4609
|
-
]
|
|
4610
|
-
},
|
|
4611
|
-
{
|
|
4612
|
-
name: "%_Item_1",
|
|
4613
|
-
bnf: [
|
|
4614
|
-
[
|
|
4615
|
-
"Minus",
|
|
4616
|
-
"%Item"
|
|
4617
|
-
],
|
|
4618
|
-
[
|
|
4619
|
-
"%Item*"
|
|
4620
|
-
]
|
|
4621
|
-
],
|
|
4622
|
-
fragment: true
|
|
4623
|
-
},
|
|
4624
|
-
{
|
|
4625
|
-
name: "Minus",
|
|
4626
|
-
bnf: [
|
|
4627
|
-
[
|
|
4628
|
-
'"-"'
|
|
4629
|
-
]
|
|
4630
|
-
]
|
|
4631
|
-
},
|
|
4632
|
-
{
|
|
4633
|
-
name: "%Item",
|
|
4634
|
-
bnf: [
|
|
4635
|
-
[
|
|
4636
|
-
"RULE_WHITESPACE*",
|
|
4637
|
-
"PrimaryPreDecoration?",
|
|
4638
|
-
"%Primary",
|
|
4639
|
-
"PrimaryDecoration?"
|
|
4640
|
-
]
|
|
4641
|
-
],
|
|
4642
|
-
fragment: true
|
|
4643
|
-
},
|
|
4644
|
-
{
|
|
4645
|
-
name: "PrimaryDecoration",
|
|
4646
|
-
bnf: [
|
|
4647
|
-
[
|
|
4648
|
-
'"?"'
|
|
4649
|
-
],
|
|
4650
|
-
[
|
|
4651
|
-
'"*"'
|
|
4652
|
-
],
|
|
4653
|
-
[
|
|
4654
|
-
'"+"'
|
|
4655
|
-
]
|
|
4656
|
-
]
|
|
4657
|
-
},
|
|
4658
|
-
{
|
|
4659
|
-
name: "PrimaryPreDecoration",
|
|
4660
|
-
bnf: [
|
|
4661
|
-
[
|
|
4662
|
-
'"&"'
|
|
4663
|
-
],
|
|
4664
|
-
[
|
|
4665
|
-
'"!"'
|
|
4666
|
-
],
|
|
4667
|
-
[
|
|
4668
|
-
'"~"'
|
|
4669
|
-
]
|
|
4670
|
-
]
|
|
4671
|
-
},
|
|
4672
|
-
{
|
|
4673
|
-
name: "%Primary",
|
|
4674
|
-
bnf: [
|
|
4675
|
-
[
|
|
4676
|
-
"NCName"
|
|
4677
|
-
],
|
|
4678
|
-
[
|
|
4679
|
-
"StringLiteral"
|
|
4680
|
-
],
|
|
4681
|
-
[
|
|
4682
|
-
"CharCode"
|
|
4683
|
-
],
|
|
4684
|
-
[
|
|
4685
|
-
"CharClass"
|
|
4686
|
-
],
|
|
4687
|
-
[
|
|
4688
|
-
"SubItem"
|
|
4689
|
-
]
|
|
4690
|
-
],
|
|
4691
|
-
fragment: true
|
|
4692
|
-
},
|
|
4693
|
-
{
|
|
4694
|
-
name: "SubItem",
|
|
4695
|
-
bnf: [
|
|
4696
|
-
[
|
|
4697
|
-
'"("',
|
|
4698
|
-
"RULE_S*",
|
|
4699
|
-
"%Choice",
|
|
4700
|
-
"RULE_S*",
|
|
4701
|
-
'")"'
|
|
4702
|
-
]
|
|
4703
|
-
]
|
|
4704
|
-
},
|
|
4705
|
-
{
|
|
4706
|
-
name: "StringLiteral",
|
|
4707
|
-
bnf: [
|
|
4708
|
-
[
|
|
4709
|
-
"'\"'",
|
|
4710
|
-
/[^"]*/,
|
|
4711
|
-
"'\"'"
|
|
4712
|
-
],
|
|
4713
|
-
[
|
|
4714
|
-
'"\'"',
|
|
4715
|
-
/[^']*/,
|
|
4716
|
-
'"\'"'
|
|
4717
|
-
]
|
|
4718
|
-
]
|
|
4719
|
-
},
|
|
4720
|
-
{
|
|
4721
|
-
name: "CharCode",
|
|
4722
|
-
bnf: [
|
|
4723
|
-
[
|
|
4724
|
-
'"#x"',
|
|
4725
|
-
/[0-9a-zA-Z]+/
|
|
4726
|
-
]
|
|
4727
|
-
]
|
|
4728
|
-
},
|
|
4729
|
-
{
|
|
4730
|
-
name: "CharClass",
|
|
4731
|
-
bnf: [
|
|
4732
|
-
[
|
|
4733
|
-
"'['",
|
|
4734
|
-
"'^'?",
|
|
4735
|
-
"%RULE_CharClass_1+",
|
|
4736
|
-
'"]"'
|
|
4737
|
-
]
|
|
4738
|
-
]
|
|
4739
|
-
},
|
|
4740
|
-
{
|
|
4741
|
-
name: "%RULE_CharClass_1",
|
|
4742
|
-
bnf: [
|
|
4743
|
-
[
|
|
4744
|
-
"CharCodeRange"
|
|
4745
|
-
],
|
|
4746
|
-
[
|
|
4747
|
-
"CharRange"
|
|
4748
|
-
],
|
|
4749
|
-
[
|
|
4750
|
-
"CharCode"
|
|
4751
|
-
],
|
|
4752
|
-
[
|
|
4753
|
-
"RULE_Char"
|
|
4754
|
-
]
|
|
4755
|
-
],
|
|
4756
|
-
fragment: true
|
|
4757
|
-
},
|
|
4758
|
-
{
|
|
4759
|
-
name: "RULE_Char",
|
|
4760
|
-
bnf: [
|
|
4761
|
-
[
|
|
4762
|
-
/\x09/
|
|
4763
|
-
],
|
|
4764
|
-
[
|
|
4765
|
-
/\x0A/
|
|
4766
|
-
],
|
|
4767
|
-
[
|
|
4768
|
-
/\x0D/
|
|
4769
|
-
],
|
|
4770
|
-
[
|
|
4771
|
-
/[\x20-\x5c]/
|
|
4772
|
-
],
|
|
4773
|
-
[
|
|
4774
|
-
/[\x5e-\uD7FF]/
|
|
4775
|
-
],
|
|
4776
|
-
[
|
|
4777
|
-
/[\uE000-\uFFFD]/
|
|
4778
|
-
]
|
|
4779
|
-
]
|
|
4780
|
-
},
|
|
4781
|
-
{
|
|
4782
|
-
name: "CharRange",
|
|
4783
|
-
bnf: [
|
|
4784
|
-
[
|
|
4785
|
-
"RULE_Char",
|
|
4786
|
-
'"-"',
|
|
4787
|
-
"RULE_Char"
|
|
4788
|
-
]
|
|
4789
|
-
]
|
|
4790
|
-
},
|
|
4791
|
-
{
|
|
4792
|
-
name: "CharCodeRange",
|
|
4793
|
-
bnf: [
|
|
4794
|
-
[
|
|
4795
|
-
"CharCode",
|
|
4796
|
-
'"-"',
|
|
4797
|
-
"CharCode"
|
|
4798
|
-
]
|
|
4799
|
-
]
|
|
4800
|
-
},
|
|
4801
|
-
{
|
|
4802
|
-
name: "RULE_WHITESPACE",
|
|
4803
|
-
bnf: [
|
|
4804
|
-
[
|
|
4805
|
-
"%RULE_WHITESPACE_CHAR*"
|
|
4806
|
-
],
|
|
4807
|
-
[
|
|
4808
|
-
"Comment",
|
|
4809
|
-
"RULE_WHITESPACE*"
|
|
4810
|
-
]
|
|
4811
|
-
]
|
|
4812
|
-
},
|
|
4813
|
-
{
|
|
4814
|
-
name: "RULE_S",
|
|
4815
|
-
bnf: [
|
|
4816
|
-
[
|
|
4817
|
-
"RULE_WHITESPACE",
|
|
4818
|
-
"RULE_S*"
|
|
4819
|
-
],
|
|
4820
|
-
[
|
|
4821
|
-
"RULE_EOL",
|
|
4822
|
-
"RULE_S*"
|
|
4823
|
-
]
|
|
4824
|
-
]
|
|
4825
|
-
},
|
|
4826
|
-
{
|
|
4827
|
-
name: "%RULE_WHITESPACE_CHAR",
|
|
4828
|
-
bnf: [
|
|
4829
|
-
[
|
|
4830
|
-
/\x09/
|
|
4831
|
-
],
|
|
4832
|
-
[
|
|
4833
|
-
/\x20/
|
|
4834
|
-
]
|
|
4835
|
-
],
|
|
4836
|
-
fragment: true
|
|
4837
|
-
},
|
|
4838
|
-
{
|
|
4839
|
-
name: "Comment",
|
|
4840
|
-
bnf: [
|
|
4841
|
-
[
|
|
4842
|
-
'"/*"',
|
|
4843
|
-
"%RULE_Comment_Body*",
|
|
4844
|
-
'"*/"'
|
|
4845
|
-
]
|
|
4846
|
-
]
|
|
4847
|
-
},
|
|
4848
|
-
{
|
|
4849
|
-
name: "%RULE_Comment_Body",
|
|
4850
|
-
bnf: [
|
|
4851
|
-
[
|
|
4852
|
-
/[^*]/
|
|
4853
|
-
],
|
|
4854
|
-
[
|
|
4855
|
-
'"*"+',
|
|
4856
|
-
/[^/]*/
|
|
4857
|
-
]
|
|
4858
|
-
],
|
|
4859
|
-
fragment: true
|
|
4860
|
-
},
|
|
4861
|
-
{
|
|
4862
|
-
name: "RULE_EOL",
|
|
4863
|
-
bnf: [
|
|
4864
|
-
[
|
|
4865
|
-
/\x0D/,
|
|
4866
|
-
/\x0A/
|
|
4867
|
-
],
|
|
4868
|
-
[
|
|
4869
|
-
/\x0A/
|
|
4870
|
-
],
|
|
4871
|
-
[
|
|
4872
|
-
/\x0D/
|
|
4873
|
-
]
|
|
4874
|
-
]
|
|
4875
|
-
},
|
|
4876
|
-
{
|
|
4877
|
-
name: "Link",
|
|
4878
|
-
bnf: [
|
|
4879
|
-
[
|
|
4880
|
-
"'['",
|
|
4881
|
-
"Url",
|
|
4882
|
-
"']'"
|
|
4883
|
-
]
|
|
4884
|
-
]
|
|
4885
|
-
},
|
|
4886
|
-
{
|
|
4887
|
-
name: "Url",
|
|
4888
|
-
bnf: [
|
|
4889
|
-
[
|
|
4890
|
-
/[^\x5D:/?#]/,
|
|
4891
|
-
'"://"',
|
|
4892
|
-
/[^\x5D#]+/,
|
|
4893
|
-
"%Url1?"
|
|
4894
|
-
]
|
|
4895
|
-
]
|
|
4896
|
-
},
|
|
4897
|
-
{
|
|
4898
|
-
name: "%Url1",
|
|
4899
|
-
bnf: [
|
|
4900
|
-
[
|
|
4901
|
-
'"#"',
|
|
4902
|
-
"NCName"
|
|
4903
|
-
]
|
|
4904
|
-
],
|
|
4905
|
-
fragment: true
|
|
4906
|
-
}
|
|
4907
|
-
];
|
|
4908
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
4909
|
-
debug: false
|
|
4910
|
-
});
|
|
4911
|
-
var preDecorationRE = /^(!|&)/;
|
|
4912
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
4913
|
-
var subExpressionRE = /^%/;
|
|
4914
|
-
function getBNFRule(name, parser2) {
|
|
4915
|
-
if (typeof name == "string") {
|
|
4916
|
-
var decoration = decorationRE.exec(name);
|
|
4917
|
-
var preDecoration = preDecorationRE.exec(name);
|
|
4918
|
-
var preDecorationText = preDecoration ? preDecoration[0] : "";
|
|
4919
|
-
var decorationText = decoration ? decoration[0] + " " : "";
|
|
4920
|
-
var subexpression = subExpressionRE.test(name);
|
|
4921
|
-
if (subexpression) {
|
|
4922
|
-
var lonely = isLonelyRule(name, parser2);
|
|
4923
|
-
if (lonely) return preDecorationText + getBNFBody(name, parser2) + decorationText;
|
|
4924
|
-
return preDecorationText + "(" + getBNFBody(name, parser2) + ")" + decorationText;
|
|
4925
|
-
}
|
|
4926
|
-
return name.replace(preDecorationRE, preDecorationText);
|
|
4927
|
-
} else {
|
|
4928
|
-
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]");
|
|
4929
|
-
}
|
|
4930
|
-
}
|
|
4931
|
-
function isLonelyRule(name, parser2) {
|
|
4932
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4933
|
-
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] == "'");
|
|
4934
|
-
}
|
|
4935
|
-
function getBNFChoice(rules, parser2) {
|
|
4936
|
-
return rules.map(function(x) {
|
|
4937
|
-
return getBNFRule(x, parser2);
|
|
4938
|
-
}).join(" ");
|
|
4939
|
-
}
|
|
4940
|
-
function getBNFBody(name, parser2) {
|
|
4941
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
4942
|
-
if (rule) return rule.bnf.map(function(x) {
|
|
4943
|
-
return getBNFChoice(x, parser2);
|
|
4944
|
-
}).join(" | ");
|
|
4945
|
-
return "RULE_NOT_FOUND {" + name + "}";
|
|
4946
|
-
}
|
|
4947
|
-
function emit(parser2) {
|
|
4948
|
-
var acumulator = [];
|
|
4949
|
-
parser2.grammarRules.forEach(function(l) {
|
|
4950
|
-
if (!/^%/.test(l.name)) {
|
|
4951
|
-
var recover = l.recover ? " { recoverUntil=" + l.recover + " }" : "";
|
|
4952
|
-
acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser2) + recover);
|
|
4953
|
-
}
|
|
4954
|
-
});
|
|
4955
|
-
return acumulator.join("\n");
|
|
4956
|
-
}
|
|
4957
|
-
BNF2.emit = emit;
|
|
4958
|
-
var subitems = 0;
|
|
4959
|
-
function restar(total, resta) {
|
|
4960
|
-
console.log("reberia restar " + resta + " a " + total);
|
|
4961
|
-
throw new Error("Difference not supported yet");
|
|
4962
|
-
}
|
|
4963
|
-
function convertRegex(txt) {
|
|
4964
|
-
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"));
|
|
4965
|
-
}
|
|
4966
|
-
function getSubItems(tmpRules, seq, parentName, parentAttributes) {
|
|
4967
|
-
var anterior = null;
|
|
4968
|
-
var bnfSeq = [];
|
|
4969
|
-
seq.children.forEach(function(x, i) {
|
|
4970
|
-
if (x.type == "Minus") {
|
|
4971
|
-
restar(anterior, x);
|
|
4972
|
-
} else {}
|
|
4973
|
-
var decoration = seq.children[i + 1];
|
|
4974
|
-
decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || "";
|
|
4975
|
-
var preDecoration = "";
|
|
4976
|
-
if (anterior && anterior.type == "PrimaryPreDecoration") {
|
|
4977
|
-
preDecoration = anterior.text;
|
|
4978
|
-
}
|
|
4979
|
-
var pinned = preDecoration == "~" ? 1 : void 0;
|
|
4980
|
-
if (pinned) {
|
|
4981
|
-
preDecoration = "";
|
|
4982
|
-
}
|
|
4983
|
-
switch(x.type){
|
|
4984
|
-
case "SubItem":
|
|
4985
|
-
var name = "%" + (parentName + subitems++);
|
|
4986
|
-
createRule(tmpRules, x, name, parentAttributes);
|
|
4987
|
-
bnfSeq.push(preDecoration + name + decoration);
|
|
4988
|
-
break;
|
|
4989
|
-
case "NCName":
|
|
4990
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
4991
|
-
break;
|
|
4992
|
-
case "StringLiteral":
|
|
4993
|
-
if (decoration || preDecoration || !/^['"/()a-zA-Z0-9&_.:=,+*\-\^\\]+$/.test(x.text)) {
|
|
4994
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
4995
|
-
} else {
|
|
4996
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4997
|
-
try {
|
|
4998
|
-
for(var _iterator = x.text.slice(1, -1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4999
|
-
var c = _step.value;
|
|
5000
|
-
if (parentAttributes && parentAttributes["ignoreCase"] == "true" && /[a-zA-Z]/.test(c)) {
|
|
5001
|
-
bnfSeq.push(new RegExp("[" + c.toUpperCase() + c.toLowerCase() + "]"));
|
|
5002
|
-
} else {
|
|
5003
|
-
bnfSeq.push(new RegExp(Parser_1.escapeRegExp(c)));
|
|
5004
|
-
}
|
|
5005
|
-
}
|
|
5006
|
-
} catch (err) {
|
|
5007
|
-
_didIteratorError = true;
|
|
5008
|
-
_iteratorError = err;
|
|
5009
|
-
} finally{
|
|
5010
|
-
try {
|
|
5011
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5012
|
-
_iterator.return();
|
|
5013
|
-
}
|
|
5014
|
-
} finally{
|
|
5015
|
-
if (_didIteratorError) {
|
|
5016
|
-
throw _iteratorError;
|
|
5017
|
-
}
|
|
5018
|
-
}
|
|
5019
|
-
}
|
|
5020
|
-
}
|
|
5021
|
-
break;
|
|
5022
|
-
case "CharCode":
|
|
5023
|
-
case "CharClass":
|
|
5024
|
-
if (decoration || preDecoration) {
|
|
5025
|
-
var newRule = {
|
|
5026
|
-
name: "%" + (parentName + subitems++),
|
|
5027
|
-
bnf: [
|
|
5028
|
-
[
|
|
5029
|
-
convertRegex(x.text)
|
|
5030
|
-
]
|
|
5031
|
-
],
|
|
5032
|
-
pinned: pinned
|
|
5033
|
-
};
|
|
5034
|
-
tmpRules.push(newRule);
|
|
5035
|
-
bnfSeq.push(preDecoration + newRule.name + decoration);
|
|
5036
|
-
} else {
|
|
5037
|
-
bnfSeq.push(convertRegex(x.text));
|
|
5038
|
-
}
|
|
5039
|
-
break;
|
|
5040
|
-
case "PrimaryPreDecoration":
|
|
5041
|
-
case "PrimaryDecoration":
|
|
5042
|
-
break;
|
|
5043
|
-
default:
|
|
5044
|
-
throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text));
|
|
5045
|
-
}
|
|
5046
|
-
anterior = x;
|
|
5047
|
-
});
|
|
5048
|
-
return bnfSeq;
|
|
5049
|
-
}
|
|
5050
|
-
function createRule(tmpRules, token, name) {
|
|
5051
|
-
var parentAttributes = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : void 0;
|
|
5052
|
-
var attrNode = token.children.filter(function(x) {
|
|
5053
|
-
return x.type == "Attributes";
|
|
5054
|
-
})[0];
|
|
5055
|
-
var attributes = {};
|
|
5056
|
-
if (attrNode) {
|
|
5057
|
-
attrNode.children.forEach(function(x) {
|
|
5058
|
-
var name2 = x.children.filter(function(x2) {
|
|
5059
|
-
return x2.type == "NCName";
|
|
5060
|
-
})[0].text;
|
|
5061
|
-
if (name2 in attributes) {
|
|
5062
|
-
throw new TokenError_1.TokenError("Duplicated attribute " + name2, x);
|
|
5063
|
-
} else {
|
|
5064
|
-
attributes[name2] = x.children.filter(function(x2) {
|
|
5065
|
-
return x2.type == "AttributeValue";
|
|
5066
|
-
})[0].text;
|
|
5067
|
-
}
|
|
5068
|
-
});
|
|
5069
|
-
}
|
|
5070
|
-
var bnf = token.children.filter(function(x) {
|
|
5071
|
-
return x.type == "SequenceOrDifference";
|
|
5072
|
-
}).map(function(s) {
|
|
5073
|
-
return getSubItems(tmpRules, s, name, parentAttributes ? parentAttributes : attributes);
|
|
5074
|
-
});
|
|
5075
|
-
var rule = {
|
|
5076
|
-
name: name,
|
|
5077
|
-
bnf: bnf
|
|
5078
|
-
};
|
|
5079
|
-
if (name.indexOf("%") == 0) rule.fragment = true;
|
|
5080
|
-
if (attributes["recoverUntil"]) {
|
|
5081
|
-
rule.recover = attributes["recoverUntil"];
|
|
5082
|
-
if (rule.bnf.length > 1) throw new TokenError_1.TokenError("only one-option productions are suitable for error recovering", token);
|
|
5083
|
-
}
|
|
5084
|
-
if ("pin" in attributes) {
|
|
5085
|
-
var num = parseInt(attributes["pin"]);
|
|
5086
|
-
if (!isNaN(num)) {
|
|
5087
|
-
rule.pinned = num;
|
|
5088
|
-
}
|
|
5089
|
-
if (rule.bnf.length > 1) throw new TokenError_1.TokenError("only one-option productions are suitable for pinning", token);
|
|
5090
|
-
}
|
|
5091
|
-
if ("ws" in attributes) {
|
|
5092
|
-
rule.implicitWs = attributes["ws"] != "explicit";
|
|
5093
|
-
} else {
|
|
5094
|
-
rule.implicitWs = null;
|
|
5095
|
-
}
|
|
5096
|
-
rule.fragment = rule.fragment || attributes["fragment"] == "true";
|
|
5097
|
-
rule.simplifyWhenOneChildren = attributes["simplifyWhenOneChildren"] == "true";
|
|
5098
|
-
tmpRules.push(rule);
|
|
5099
|
-
}
|
|
5100
|
-
function getRules(source) {
|
|
5101
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
5102
|
-
var ast = parser2.getAST(source);
|
|
5103
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
5104
|
-
if (ast.errors && ast.errors.length) {
|
|
5105
|
-
throw ast.errors[0];
|
|
5106
|
-
}
|
|
5107
|
-
var implicitWs = null;
|
|
5108
|
-
var attrNode = ast.children.filter(function(x) {
|
|
5109
|
-
return x.type == "Attributes";
|
|
5110
|
-
})[0];
|
|
5111
|
-
var attributes = {};
|
|
5112
|
-
if (attrNode) {
|
|
5113
|
-
attrNode.children.forEach(function(x) {
|
|
5114
|
-
var name = x.children.filter(function(x2) {
|
|
5115
|
-
return x2.type == "NCName";
|
|
5116
|
-
})[0].text;
|
|
5117
|
-
if (name in attributes) {
|
|
5118
|
-
throw new TokenError_1.TokenError("Duplicated attribute " + name, x);
|
|
5119
|
-
} else {
|
|
5120
|
-
attributes[name] = x.children.filter(function(x2) {
|
|
5121
|
-
return x2.type == "AttributeValue";
|
|
5122
|
-
})[0].text;
|
|
5123
|
-
}
|
|
5124
|
-
});
|
|
5125
|
-
}
|
|
5126
|
-
implicitWs = attributes["ws"] == "implicit";
|
|
5127
|
-
var tmpRules = [];
|
|
5128
|
-
ast.children.filter(function(x) {
|
|
5129
|
-
return x.type == "Production";
|
|
5130
|
-
}).map(function(x) {
|
|
5131
|
-
var name = x.children.filter(function(x2) {
|
|
5132
|
-
return x2.type == "NCName";
|
|
5133
|
-
})[0].text;
|
|
5134
|
-
createRule(tmpRules, x, name);
|
|
5135
|
-
});
|
|
5136
|
-
tmpRules.forEach(function(rule) {
|
|
5137
|
-
if (rule.implicitWs === null) rule.implicitWs = implicitWs;
|
|
5138
|
-
});
|
|
5139
|
-
return tmpRules;
|
|
5140
|
-
}
|
|
5141
|
-
BNF2.getRules = getRules;
|
|
5142
|
-
function Transform(source) {
|
|
5143
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
5144
|
-
return getRules(source.join(""), subParser);
|
|
5145
|
-
}
|
|
5146
|
-
BNF2.Transform = Transform;
|
|
5147
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
5148
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
5149
|
-
var _super = _create_super(Parser2);
|
|
5150
|
-
function Parser2(source, options) {
|
|
5151
|
-
_class_call_check(this, Parser2);
|
|
5152
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
5153
|
-
debug: true
|
|
5154
|
-
}) : BNF2.defaultParser;
|
|
5155
|
-
return _super.call(this, getRules(source, subParser), options);
|
|
5156
|
-
}
|
|
5157
|
-
_create_class(Parser2, [
|
|
5158
|
-
{
|
|
5159
|
-
key: "emitSource",
|
|
5160
|
-
value: function emitSource() {
|
|
5161
|
-
return emit(this);
|
|
5162
|
-
}
|
|
5163
|
-
}
|
|
5164
|
-
]);
|
|
5165
|
-
return Parser2;
|
|
5166
|
-
}(Parser_1.Parser);
|
|
5167
|
-
BNF2.Parser = Parser2;
|
|
5168
|
-
})(BNF || (BNF = {}));
|
|
5169
|
-
exports.default = BNF;
|
|
5170
|
-
}
|
|
5171
|
-
});
|
|
5172
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/index.js
|
|
5173
|
-
var require_Grammars = __commonJS({
|
|
5174
|
-
"../../../../../../../../../../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) {
|
|
5175
|
-
"use strict";
|
|
5176
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5177
|
-
value: true
|
|
5178
|
-
});
|
|
5179
|
-
var BNF_1 = require_BNF();
|
|
5180
|
-
Object.defineProperty(exports, "BNF", {
|
|
5181
|
-
enumerable: true,
|
|
5182
|
-
get: function get() {
|
|
5183
|
-
return BNF_1.default;
|
|
5184
|
-
}
|
|
5185
|
-
});
|
|
5186
|
-
var W3CEBNF_1 = require_W3CEBNF();
|
|
5187
|
-
Object.defineProperty(exports, "W3C", {
|
|
5188
|
-
enumerable: true,
|
|
5189
|
-
get: function get() {
|
|
5190
|
-
return W3CEBNF_1.default;
|
|
5191
|
-
}
|
|
5192
|
-
});
|
|
5193
|
-
var Custom_1 = require_Custom();
|
|
5194
|
-
Object.defineProperty(exports, "Custom", {
|
|
5195
|
-
enumerable: true,
|
|
5196
|
-
get: function get() {
|
|
5197
|
-
return Custom_1.default;
|
|
5198
|
-
}
|
|
5199
|
-
});
|
|
5200
|
-
}
|
|
5201
|
-
});
|
|
5202
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/index.js
|
|
5203
|
-
var require_dist = __commonJS({
|
|
5204
|
-
"../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/index.js": function(exports) {
|
|
5205
|
-
"use strict";
|
|
5206
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5207
|
-
value: true
|
|
5208
|
-
});
|
|
5209
|
-
var Parser_1 = require_Parser();
|
|
5210
|
-
Object.defineProperty(exports, "Parser", {
|
|
5211
|
-
enumerable: true,
|
|
5212
|
-
get: function get() {
|
|
5213
|
-
return Parser_1.Parser;
|
|
5214
|
-
}
|
|
5215
|
-
});
|
|
5216
|
-
var TokenError_1 = require_TokenError();
|
|
5217
|
-
Object.defineProperty(exports, "TokenError", {
|
|
5218
|
-
enumerable: true,
|
|
5219
|
-
get: function get() {
|
|
5220
|
-
return TokenError_1.TokenError;
|
|
5221
|
-
}
|
|
5222
|
-
});
|
|
5223
|
-
exports.Grammars = require_Grammars();
|
|
5224
|
-
}
|
|
5225
|
-
});
|
|
5226
1644
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/timm@1.7.1/node_modules/timm/lib/timm.js
|
|
5227
1645
|
var require_timm = __commonJS({
|
|
5228
1646
|
"../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/timm@1.7.1/node_modules/timm/lib/timm.js": function(exports) {
|
|
@@ -5315,14 +1733,14 @@ var Player = function() {
|
|
|
5315
1733
|
result[idx] = newItem;
|
|
5316
1734
|
return result;
|
|
5317
1735
|
}
|
|
5318
|
-
function getIn(obj,
|
|
5319
|
-
if (!Array.isArray(
|
|
1736
|
+
function getIn(obj, path) {
|
|
1737
|
+
if (!Array.isArray(path)) {
|
|
5320
1738
|
throwStr(IS_DEV ? "A path array should be provided when calling getIn()" : INVALID_ARGS);
|
|
5321
1739
|
}
|
|
5322
1740
|
if (obj == null) return void 0;
|
|
5323
1741
|
var ptr = obj;
|
|
5324
|
-
for(var i = 0; i <
|
|
5325
|
-
var key =
|
|
1742
|
+
for(var i = 0; i < path.length; i++){
|
|
1743
|
+
var key = path[i];
|
|
5326
1744
|
ptr = ptr != null ? ptr[key] : void 0;
|
|
5327
1745
|
if (ptr === void 0) return ptr;
|
|
5328
1746
|
}
|
|
@@ -5336,18 +1754,18 @@ var Player = function() {
|
|
|
5336
1754
|
obj2[key] = val;
|
|
5337
1755
|
return obj2;
|
|
5338
1756
|
}
|
|
5339
|
-
function setIn8(obj,
|
|
5340
|
-
if (!
|
|
5341
|
-
return doSetIn(obj,
|
|
1757
|
+
function setIn8(obj, path, val) {
|
|
1758
|
+
if (!path.length) return val;
|
|
1759
|
+
return doSetIn(obj, path, val, 0);
|
|
5342
1760
|
}
|
|
5343
|
-
function doSetIn(obj,
|
|
1761
|
+
function doSetIn(obj, path, val, idx) {
|
|
5344
1762
|
var newValue;
|
|
5345
|
-
var key =
|
|
5346
|
-
if (idx ===
|
|
1763
|
+
var key = path[idx];
|
|
1764
|
+
if (idx === path.length - 1) {
|
|
5347
1765
|
newValue = val;
|
|
5348
1766
|
} else {
|
|
5349
|
-
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof
|
|
5350
|
-
newValue = doSetIn(nestedObj,
|
|
1767
|
+
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === "number" ? [] : {};
|
|
1768
|
+
newValue = doSetIn(nestedObj, path, val, idx + 1);
|
|
5351
1769
|
}
|
|
5352
1770
|
return set2(obj, key, newValue);
|
|
5353
1771
|
}
|
|
@@ -5356,10 +1774,10 @@ var Player = function() {
|
|
|
5356
1774
|
var nextVal = fnUpdate(prevVal);
|
|
5357
1775
|
return set2(obj, key, nextVal);
|
|
5358
1776
|
}
|
|
5359
|
-
function updateIn(obj,
|
|
5360
|
-
var prevVal = getIn(obj,
|
|
1777
|
+
function updateIn(obj, path, fnUpdate) {
|
|
1778
|
+
var prevVal = getIn(obj, path);
|
|
5361
1779
|
var nextVal = fnUpdate(prevVal);
|
|
5362
|
-
return setIn8(obj,
|
|
1780
|
+
return setIn8(obj, path, nextVal);
|
|
5363
1781
|
}
|
|
5364
1782
|
function merge(a, b, c, d, e, f) {
|
|
5365
1783
|
for(var _len = arguments.length, rest = new Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++){
|
|
@@ -5395,11 +1813,11 @@ var Player = function() {
|
|
|
5395
1813
|
f
|
|
5396
1814
|
].concat(_to_consumable_array(rest))) : doMerge(false, true, a, b, c, d, e, f);
|
|
5397
1815
|
}
|
|
5398
|
-
function mergeIn(a,
|
|
1816
|
+
function mergeIn(a, path, b, c, d, e, f) {
|
|
5399
1817
|
for(var _len = arguments.length, rest = new Array(_len > 7 ? _len - 7 : 0), _key = 7; _key < _len; _key++){
|
|
5400
1818
|
rest[_key - 7] = arguments[_key];
|
|
5401
1819
|
}
|
|
5402
|
-
var prevVal = getIn(a,
|
|
1820
|
+
var prevVal = getIn(a, path);
|
|
5403
1821
|
if (prevVal == null) prevVal = {};
|
|
5404
1822
|
var nextVal;
|
|
5405
1823
|
if (rest.length) {
|
|
@@ -5418,7 +1836,7 @@ var Player = function() {
|
|
|
5418
1836
|
} else {
|
|
5419
1837
|
nextVal = doMerge(false, false, prevVal, b, c, d, e, f);
|
|
5420
1838
|
}
|
|
5421
|
-
return setIn8(a,
|
|
1839
|
+
return setIn8(a, path, nextVal);
|
|
5422
1840
|
}
|
|
5423
1841
|
function omit4(obj, attrs) {
|
|
5424
1842
|
var omitList = Array.isArray(attrs) ? attrs : [
|
|
@@ -5804,7 +2222,7 @@ var Player = function() {
|
|
|
5804
2222
|
return maybeConvertToNum;
|
|
5805
2223
|
},
|
|
5806
2224
|
parse: function() {
|
|
5807
|
-
return
|
|
2225
|
+
return parse2;
|
|
5808
2226
|
},
|
|
5809
2227
|
parseExpression: function() {
|
|
5810
2228
|
return parseExpression;
|
|
@@ -6143,10 +2561,10 @@ var Player = function() {
|
|
|
6143
2561
|
value: value
|
|
6144
2562
|
};
|
|
6145
2563
|
};
|
|
6146
|
-
var toPath = function(
|
|
2564
|
+
var toPath = function(path) {
|
|
6147
2565
|
return {
|
|
6148
2566
|
name: "PathNode",
|
|
6149
|
-
path:
|
|
2567
|
+
path: path
|
|
6150
2568
|
};
|
|
6151
2569
|
};
|
|
6152
2570
|
var toQuery = function(key, value) {
|
|
@@ -6165,35 +2583,6 @@ var Player = function() {
|
|
|
6165
2583
|
value: values
|
|
6166
2584
|
};
|
|
6167
2585
|
};
|
|
6168
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/parsimmon/index.ts
|
|
6169
|
-
var import_arr_flatten = __toESM(require_arr_flatten());
|
|
6170
|
-
var import_parsimmon = __toESM(require_parsimmon());
|
|
6171
|
-
var doubleQuote = import_parsimmon.default.string('"');
|
|
6172
|
-
var singleQuote = import_parsimmon.default.string("'");
|
|
6173
|
-
var backTick = import_parsimmon.default.string("`");
|
|
6174
|
-
var identifier = import_parsimmon.default.regex(/[\w\-@]+/).desc("identifier").map(toValue);
|
|
6175
|
-
var path;
|
|
6176
|
-
var futurePath = import_parsimmon.default.lazy(function() {
|
|
6177
|
-
return path;
|
|
6178
|
-
});
|
|
6179
|
-
var nestedPath = futurePath.trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("{{"), import_parsimmon.default.string("}}")).map(toPath);
|
|
6180
|
-
var nestedExpression = import_parsimmon.default.regex(/[^`]*/).wrap(backTick, backTick).map(toExpression);
|
|
6181
|
-
var segment = import_parsimmon.default.alt(identifier, nestedPath, nestedExpression).atLeast(1).map(import_arr_flatten.default).map(toConcatenatedNode);
|
|
6182
|
-
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);
|
|
6183
|
-
var query = import_parsimmon.default.seq(optionallyQuotedSegment, import_parsimmon.default.string("=").times(1, 3).trim(import_parsimmon.default.optWhitespace), optionallyQuotedSegment).map(function(param) {
|
|
6184
|
-
var _param = _sliced_to_array(param, 3), key = _param[0], value = _param[2];
|
|
6185
|
-
return toQuery(key, value);
|
|
6186
|
-
});
|
|
6187
|
-
var brackets = import_parsimmon.default.alt(query, optionallyQuotedSegment).trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("["), import_parsimmon.default.string("]")).many();
|
|
6188
|
-
var segmentAndBrackets = import_parsimmon.default.seqMap(segment, brackets, function(s, bs) {
|
|
6189
|
-
return [
|
|
6190
|
-
s
|
|
6191
|
-
].concat(_to_consumable_array(bs));
|
|
6192
|
-
});
|
|
6193
|
-
path = import_parsimmon.default.sepBy(segmentAndBrackets, import_parsimmon.default.string(".")).map(import_arr_flatten.default);
|
|
6194
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/ebnf/index.ts
|
|
6195
|
-
var import_ebnf = __toESM(require_dist());
|
|
6196
|
-
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');
|
|
6197
2586
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/custom/index.ts
|
|
6198
2587
|
var SEGMENT_SEPARATOR = ".";
|
|
6199
2588
|
var OPEN_CURL = "{";
|
|
@@ -6224,14 +2613,14 @@ var Player = function() {
|
|
|
6224
2613
|
charCode === 125;
|
|
6225
2614
|
return !matches;
|
|
6226
2615
|
};
|
|
6227
|
-
var parse = function(
|
|
2616
|
+
var parse = function(path) {
|
|
6228
2617
|
var index = 1;
|
|
6229
|
-
var ch =
|
|
2618
|
+
var ch = path.charAt(0);
|
|
6230
2619
|
var next = function(expected) {
|
|
6231
2620
|
if (expected && ch !== expected) {
|
|
6232
2621
|
throw new Error("Expected char: ".concat(expected, " but got: ").concat(ch));
|
|
6233
2622
|
}
|
|
6234
|
-
ch =
|
|
2623
|
+
ch = path.charAt(index);
|
|
6235
2624
|
index += 1;
|
|
6236
2625
|
return ch;
|
|
6237
2626
|
};
|
|
@@ -6240,7 +2629,7 @@ var Player = function() {
|
|
|
6240
2629
|
next();
|
|
6241
2630
|
}
|
|
6242
2631
|
};
|
|
6243
|
-
var
|
|
2632
|
+
var identifier = function() {
|
|
6244
2633
|
if (!isIdentifierChar(ch)) {
|
|
6245
2634
|
return;
|
|
6246
2635
|
}
|
|
@@ -6286,7 +2675,7 @@ var Player = function() {
|
|
|
6286
2675
|
return toValue(value);
|
|
6287
2676
|
}
|
|
6288
2677
|
};
|
|
6289
|
-
var
|
|
2678
|
+
var nestedPath = function() {
|
|
6290
2679
|
if (ch === OPEN_CURL) {
|
|
6291
2680
|
next(OPEN_CURL);
|
|
6292
2681
|
next(OPEN_CURL);
|
|
@@ -6297,10 +2686,10 @@ var Player = function() {
|
|
|
6297
2686
|
}
|
|
6298
2687
|
};
|
|
6299
2688
|
var simpleSegment = function() {
|
|
6300
|
-
var
|
|
6301
|
-
return (_ref = (
|
|
2689
|
+
var _nestedPath, _ref;
|
|
2690
|
+
return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
|
|
6302
2691
|
};
|
|
6303
|
-
var
|
|
2692
|
+
var segment = function() {
|
|
6304
2693
|
var segments = [];
|
|
6305
2694
|
var nextSegment = simpleSegment();
|
|
6306
2695
|
while(nextSegment !== void 0){
|
|
@@ -6312,13 +2701,13 @@ var Player = function() {
|
|
|
6312
2701
|
}
|
|
6313
2702
|
return toConcatenatedNode(segments);
|
|
6314
2703
|
};
|
|
6315
|
-
var
|
|
2704
|
+
var optionallyQuotedSegment = function() {
|
|
6316
2705
|
whitespace();
|
|
6317
2706
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
6318
|
-
var
|
|
6319
|
-
next(
|
|
2707
|
+
var singleQuote = ch === SINGLE_QUOTE;
|
|
2708
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
6320
2709
|
var id = regex(/[^'"]+/);
|
|
6321
|
-
next(
|
|
2710
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
6322
2711
|
return id;
|
|
6323
2712
|
}
|
|
6324
2713
|
return simpleSegment();
|
|
@@ -6336,12 +2725,12 @@ var Player = function() {
|
|
|
6336
2725
|
if (ch === OPEN_BRACKET) {
|
|
6337
2726
|
next(OPEN_BRACKET);
|
|
6338
2727
|
whitespace();
|
|
6339
|
-
var value =
|
|
2728
|
+
var value = optionallyQuotedSegment();
|
|
6340
2729
|
if (value) {
|
|
6341
2730
|
whitespace();
|
|
6342
2731
|
if (equals()) {
|
|
6343
2732
|
whitespace();
|
|
6344
|
-
var second =
|
|
2733
|
+
var second = optionallyQuotedSegment();
|
|
6345
2734
|
value = toQuery(value, second);
|
|
6346
2735
|
whitespace();
|
|
6347
2736
|
}
|
|
@@ -6356,7 +2745,7 @@ var Player = function() {
|
|
|
6356
2745
|
};
|
|
6357
2746
|
var parseSegmentAndBrackets = function() {
|
|
6358
2747
|
var parsed = [];
|
|
6359
|
-
var firstSegment =
|
|
2748
|
+
var firstSegment = segment();
|
|
6360
2749
|
if (firstSegment) {
|
|
6361
2750
|
parsed.push(firstSegment);
|
|
6362
2751
|
var bracketSegment = parseBracket();
|
|
@@ -6405,12 +2794,12 @@ var Player = function() {
|
|
|
6405
2794
|
};
|
|
6406
2795
|
_class_call_check(this, _BindingInstance);
|
|
6407
2796
|
var split = Array.isArray(raw) ? raw : raw.split(".");
|
|
6408
|
-
this.split = split.map(function(
|
|
6409
|
-
if (typeof
|
|
6410
|
-
return
|
|
2797
|
+
this.split = split.map(function(segment) {
|
|
2798
|
+
if (typeof segment === "number") {
|
|
2799
|
+
return segment;
|
|
6411
2800
|
}
|
|
6412
|
-
var tryNum = Number(
|
|
6413
|
-
return isNaN(tryNum) ?
|
|
2801
|
+
var tryNum = Number(segment);
|
|
2802
|
+
return isNaN(tryNum) ? segment : tryNum;
|
|
6414
2803
|
});
|
|
6415
2804
|
Object.freeze(this.split);
|
|
6416
2805
|
this.joined = this.split.join(".");
|
|
@@ -6510,13 +2899,13 @@ var Player = function() {
|
|
|
6510
2899
|
}
|
|
6511
2900
|
throw new Error("Unable to resolve value for node: ".concat(node.name));
|
|
6512
2901
|
}
|
|
6513
|
-
function appendPathSegments(
|
|
6514
|
-
if (typeof
|
|
6515
|
-
|
|
2902
|
+
function appendPathSegments(segment) {
|
|
2903
|
+
if (typeof segment === "string" && segment.indexOf(".") > -1) {
|
|
2904
|
+
segment.split(".").forEach(function(i) {
|
|
6516
2905
|
context.path.push(maybeConvertToNum(i));
|
|
6517
2906
|
});
|
|
6518
2907
|
} else {
|
|
6519
|
-
context.path.push(
|
|
2908
|
+
context.path.push(segment);
|
|
6520
2909
|
}
|
|
6521
2910
|
}
|
|
6522
2911
|
function resolveNode(_node) {
|
|
@@ -6596,24 +2985,24 @@ var Player = function() {
|
|
|
6596
2985
|
* Takes a binding path, parses it, and returns an equivalent, normalized
|
|
6597
2986
|
* representation of that path.
|
|
6598
2987
|
*/ key: "normalizePath",
|
|
6599
|
-
value: function normalizePath(
|
|
6600
|
-
if (!BINDING_BRACKETS_REGEX.test(
|
|
2988
|
+
value: function normalizePath(path, resolveOptions) {
|
|
2989
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
6601
2990
|
return {
|
|
6602
|
-
path:
|
|
2991
|
+
path: path.split("."),
|
|
6603
2992
|
updates: void 0
|
|
6604
2993
|
};
|
|
6605
2994
|
}
|
|
6606
|
-
var
|
|
6607
|
-
var ast = (
|
|
6608
|
-
this.parseCache[
|
|
2995
|
+
var _this_parseCache_path;
|
|
2996
|
+
var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
|
|
2997
|
+
this.parseCache[path] = ast;
|
|
6609
2998
|
if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
|
|
6610
2999
|
var _ast_error;
|
|
6611
|
-
throw new TypeError('Cannot normalize path "'.concat(
|
|
3000
|
+
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."));
|
|
6612
3001
|
}
|
|
6613
3002
|
try {
|
|
6614
3003
|
return resolveBindingAST(ast.path, resolveOptions, this.hooks);
|
|
6615
3004
|
} catch (e) {
|
|
6616
|
-
throw new import_ts_nested_error2.NestedError("Cannot resolve binding: ".concat(
|
|
3005
|
+
throw new import_ts_nested_error2.NestedError("Cannot resolve binding: ".concat(path), e);
|
|
6617
3006
|
}
|
|
6618
3007
|
}
|
|
6619
3008
|
},
|
|
@@ -6641,21 +3030,21 @@ var Player = function() {
|
|
|
6641
3030
|
var updates = {};
|
|
6642
3031
|
var joined = Array.isArray(rawBinding) ? rawBinding.join(".") : String(rawBinding);
|
|
6643
3032
|
var normalizeConfig = {
|
|
6644
|
-
getValue: function(
|
|
6645
|
-
var normalized2 = _this.normalizePath(
|
|
3033
|
+
getValue: function(path) {
|
|
3034
|
+
var normalized2 = _this.normalizePath(path.join("."), normalizeConfig);
|
|
6646
3035
|
return options.get(_this.getBindingForNormalizedResult(normalized2));
|
|
6647
3036
|
},
|
|
6648
3037
|
evaluate: function(exp) {
|
|
6649
3038
|
return options.evaluate(exp);
|
|
6650
3039
|
},
|
|
6651
|
-
convertToPath: function(
|
|
6652
|
-
if (
|
|
3040
|
+
convertToPath: function(path) {
|
|
3041
|
+
if (path === void 0) {
|
|
6653
3042
|
throw new Error("Attempted to convert undefined value to binding path");
|
|
6654
3043
|
}
|
|
6655
|
-
if (typeof
|
|
6656
|
-
throw new Error("Attempting to convert ".concat(typeof
|
|
3044
|
+
if (typeof path !== "string" && typeof path !== "number" && typeof path !== "boolean") {
|
|
3045
|
+
throw new Error("Attempting to convert ".concat(typeof path === "undefined" ? "undefined" : _type_of(path), " to a binding path."));
|
|
6657
3046
|
}
|
|
6658
|
-
var normalized2 = _this.normalizePath(String(
|
|
3047
|
+
var normalized2 = _this.normalizePath(String(path), normalizeConfig);
|
|
6659
3048
|
if (normalized2.updates) {
|
|
6660
3049
|
updates = _object_spread({}, updates, normalized2.updates);
|
|
6661
3050
|
}
|
|
@@ -7764,7 +4153,7 @@ var Player = function() {
|
|
|
7764
4153
|
this.hooks = {
|
|
7765
4154
|
resolveTypeForBinding: new SyncWaterfallHook()
|
|
7766
4155
|
};
|
|
7767
|
-
this.schema = schema ?
|
|
4156
|
+
this.schema = schema ? parse2(schema) : /* @__PURE__ */ new Map();
|
|
7768
4157
|
}
|
|
7769
4158
|
_create_class(SchemaController, [
|
|
7770
4159
|
{
|
|
@@ -8271,7 +4660,7 @@ var Player = function() {
|
|
|
8271
4660
|
}
|
|
8272
4661
|
}
|
|
8273
4662
|
var parseLocalObject = function(currentValue, objToParse) {
|
|
8274
|
-
var
|
|
4663
|
+
var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
8275
4664
|
if (typeof objToParse !== "object" || objToParse === null) {
|
|
8276
4665
|
return {
|
|
8277
4666
|
value: objToParse,
|
|
@@ -8308,7 +4697,7 @@ var Player = function() {
|
|
|
8308
4697
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8309
4698
|
children: _to_consumable_array(children2).concat([
|
|
8310
4699
|
{
|
|
8311
|
-
path: _to_consumable_array(
|
|
4700
|
+
path: _to_consumable_array(path).concat([
|
|
8312
4701
|
"asset"
|
|
8313
4702
|
]),
|
|
8314
4703
|
value: assetAST
|
|
@@ -8333,7 +4722,7 @@ var Player = function() {
|
|
|
8333
4722
|
}
|
|
8334
4723
|
if (templateAST) {
|
|
8335
4724
|
return {
|
|
8336
|
-
path: _to_consumable_array(
|
|
4725
|
+
path: _to_consumable_array(path).concat([
|
|
8337
4726
|
template.output
|
|
8338
4727
|
]),
|
|
8339
4728
|
value: templateAST
|
|
@@ -8354,7 +4743,7 @@ var Player = function() {
|
|
|
8354
4743
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8355
4744
|
children: _to_consumable_array(children2).concat([
|
|
8356
4745
|
{
|
|
8357
|
-
path: _to_consumable_array(
|
|
4746
|
+
path: _to_consumable_array(path).concat([
|
|
8358
4747
|
localKey
|
|
8359
4748
|
], _to_consumable_array(firstChild.path)),
|
|
8360
4749
|
value: firstChild.value
|
|
@@ -8366,7 +4755,7 @@ var Player = function() {
|
|
|
8366
4755
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8367
4756
|
children: _to_consumable_array(children2).concat([
|
|
8368
4757
|
{
|
|
8369
|
-
path: _to_consumable_array(
|
|
4758
|
+
path: _to_consumable_array(path).concat([
|
|
8370
4759
|
localKey
|
|
8371
4760
|
]),
|
|
8372
4761
|
value: localSwitch
|
|
@@ -8378,7 +4767,7 @@ var Player = function() {
|
|
|
8378
4767
|
var localAsync = _this.parseAsync(localValue, "value" /* Value */ , options);
|
|
8379
4768
|
if (localAsync) {
|
|
8380
4769
|
children2.push({
|
|
8381
|
-
path: _to_consumable_array(
|
|
4770
|
+
path: _to_consumable_array(path).concat([
|
|
8382
4771
|
localKey
|
|
8383
4772
|
]),
|
|
8384
4773
|
value: localAsync
|
|
@@ -8405,7 +4794,7 @@ var Player = function() {
|
|
|
8405
4794
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8406
4795
|
children: _to_consumable_array(children2).concat([
|
|
8407
4796
|
{
|
|
8408
|
-
path: _to_consumable_array(
|
|
4797
|
+
path: _to_consumable_array(path).concat([
|
|
8409
4798
|
localKey
|
|
8410
4799
|
]),
|
|
8411
4800
|
value: multiNode
|
|
@@ -8422,7 +4811,7 @@ var Player = function() {
|
|
|
8422
4811
|
return _object_spread_props(_object_spread({}, rest), {
|
|
8423
4812
|
children: _to_consumable_array(children2).concat([
|
|
8424
4813
|
{
|
|
8425
|
-
path: _to_consumable_array(
|
|
4814
|
+
path: _to_consumable_array(path).concat([
|
|
8426
4815
|
localKey
|
|
8427
4816
|
]),
|
|
8428
4817
|
value: parsedNode
|
|
@@ -8431,7 +4820,7 @@ var Player = function() {
|
|
|
8431
4820
|
});
|
|
8432
4821
|
}
|
|
8433
4822
|
} else {
|
|
8434
|
-
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(
|
|
4823
|
+
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
8435
4824
|
localKey
|
|
8436
4825
|
]));
|
|
8437
4826
|
return {
|
|
@@ -8440,7 +4829,7 @@ var Player = function() {
|
|
|
8440
4829
|
};
|
|
8441
4830
|
}
|
|
8442
4831
|
} else {
|
|
8443
|
-
var value2 = (0, import_timm4.setIn)(accumulation.value, _to_consumable_array(
|
|
4832
|
+
var value2 = (0, import_timm4.setIn)(accumulation.value, _to_consumable_array(path).concat([
|
|
8444
4833
|
localKey
|
|
8445
4834
|
]), localValue);
|
|
8446
4835
|
return {
|
|
@@ -8747,17 +5136,17 @@ var Player = function() {
|
|
|
8747
5136
|
}();
|
|
8748
5137
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/view.ts
|
|
8749
5138
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
8750
|
-
function CrossfieldProvider(initialView,
|
|
5139
|
+
function CrossfieldProvider(initialView, parser, logger) {
|
|
8751
5140
|
_class_call_check(this, CrossfieldProvider);
|
|
8752
5141
|
this.allValidations = /* @__PURE__ */ new Set();
|
|
8753
5142
|
this.byBinding = /* @__PURE__ */ new Map();
|
|
8754
5143
|
this.logger = logger;
|
|
8755
|
-
this.parse(initialView,
|
|
5144
|
+
this.parse(initialView, parser);
|
|
8756
5145
|
}
|
|
8757
5146
|
_create_class(CrossfieldProvider, [
|
|
8758
5147
|
{
|
|
8759
5148
|
key: "parse",
|
|
8760
|
-
value: function parse(contentView,
|
|
5149
|
+
value: function parse(contentView, parser) {
|
|
8761
5150
|
var _this = this;
|
|
8762
5151
|
var xfieldRefs = contentView.validation;
|
|
8763
5152
|
if (xfieldRefs === void 0) {
|
|
@@ -8776,7 +5165,7 @@ var Player = function() {
|
|
|
8776
5165
|
_this.allValidations.add(withDefaults);
|
|
8777
5166
|
var ref = vRef.ref;
|
|
8778
5167
|
if (ref) {
|
|
8779
|
-
var parsed =
|
|
5168
|
+
var parsed = parser(ref);
|
|
8780
5169
|
if (_this.byBinding.has(parsed)) {
|
|
8781
5170
|
var _this_byBinding_get;
|
|
8782
5171
|
(_this_byBinding_get = _this.byBinding.get(parsed)) === null || _this_byBinding_get === void 0 ? void 0 : _this_byBinding_get.push(withDefaults);
|
|
@@ -8837,11 +5226,11 @@ var Player = function() {
|
|
|
8837
5226
|
var _this_resolverOptions_logger;
|
|
8838
5227
|
(_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");
|
|
8839
5228
|
}
|
|
8840
|
-
var
|
|
8841
|
-
this.hooks.parser.call(
|
|
8842
|
-
this.rootNode =
|
|
5229
|
+
var parser = new Parser();
|
|
5230
|
+
this.hooks.parser.call(parser);
|
|
5231
|
+
this.rootNode = parser.parseView(this.initialView);
|
|
8843
5232
|
this.resolver = new Resolver(this.rootNode, _object_spread_props(_object_spread({}, this.resolverOptions), {
|
|
8844
|
-
parseNode:
|
|
5233
|
+
parseNode: parser.parseObject.bind(parser)
|
|
8845
5234
|
}));
|
|
8846
5235
|
this.hooks.resolver.call(this.resolver);
|
|
8847
5236
|
}
|
|
@@ -8926,11 +5315,11 @@ var Player = function() {
|
|
|
8926
5315
|
* @param node - The node to add a child to
|
|
8927
5316
|
* @param path - The path at which to add the child
|
|
8928
5317
|
* @param child - The child node
|
|
8929
|
-
*/ function addChild(node,
|
|
5318
|
+
*/ function addChild(node, path, child) {
|
|
8930
5319
|
child.parent = node;
|
|
8931
5320
|
var newChild = {
|
|
8932
|
-
path: Array.isArray(
|
|
8933
|
-
|
|
5321
|
+
path: Array.isArray(path) ? path : [
|
|
5322
|
+
path
|
|
8934
5323
|
],
|
|
8935
5324
|
value: child
|
|
8936
5325
|
};
|
|
@@ -9018,23 +5407,23 @@ var Player = function() {
|
|
|
9018
5407
|
},
|
|
9019
5408
|
{
|
|
9020
5409
|
key: "applyParser",
|
|
9021
|
-
value: function applyParser(
|
|
5410
|
+
value: function applyParser(parser) {
|
|
9022
5411
|
var _this = this;
|
|
9023
|
-
|
|
5412
|
+
parser.hooks.onCreateASTNode.tap("template", function(node) {
|
|
9024
5413
|
if (node && node.type === "template" /* Template */ && !node.dynamic) {
|
|
9025
|
-
return _this.parseTemplate(
|
|
5414
|
+
return _this.parseTemplate(parser.parseObject.bind(parser), node, _this.options);
|
|
9026
5415
|
}
|
|
9027
5416
|
return node;
|
|
9028
5417
|
});
|
|
9029
|
-
|
|
5418
|
+
parser.hooks.determineNodeType.tap("template", function(obj) {
|
|
9030
5419
|
if (obj === "template") {
|
|
9031
5420
|
return "template" /* Template */ ;
|
|
9032
5421
|
}
|
|
9033
5422
|
});
|
|
9034
|
-
|
|
5423
|
+
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, determinedNodeType) {
|
|
9035
5424
|
if (determinedNodeType === "template" /* Template */ ) {
|
|
9036
5425
|
var _options_templateDepth, _obj_dynamic;
|
|
9037
|
-
var templateNode =
|
|
5426
|
+
var templateNode = parser.createASTNode({
|
|
9038
5427
|
type: "template" /* Template */ ,
|
|
9039
5428
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
9040
5429
|
data: obj.data,
|
|
@@ -9164,8 +5553,8 @@ var Player = function() {
|
|
|
9164
5553
|
]);
|
|
9165
5554
|
}
|
|
9166
5555
|
var nodePath = findBasePath(node, resolver);
|
|
9167
|
-
if (nodePath.length > 0 && nodePath.some(function(
|
|
9168
|
-
return propsToSkip.has(
|
|
5556
|
+
if (nodePath.length > 0 && nodePath.some(function(segment) {
|
|
5557
|
+
return propsToSkip.has(segment.toString());
|
|
9169
5558
|
})) {
|
|
9170
5559
|
return node.value;
|
|
9171
5560
|
}
|
|
@@ -9209,17 +5598,17 @@ var Player = function() {
|
|
|
9209
5598
|
},
|
|
9210
5599
|
{
|
|
9211
5600
|
key: "applyParser",
|
|
9212
|
-
value: function applyParser(
|
|
9213
|
-
|
|
5601
|
+
value: function applyParser(parser) {
|
|
5602
|
+
parser.hooks.determineNodeType.tap("applicability", function(obj) {
|
|
9214
5603
|
if (Object.prototype.hasOwnProperty.call(obj, "applicability")) {
|
|
9215
5604
|
return "applicability" /* Applicability */ ;
|
|
9216
5605
|
}
|
|
9217
5606
|
});
|
|
9218
|
-
|
|
5607
|
+
parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, determinedNodeType) {
|
|
9219
5608
|
if (determinedNodeType === "applicability" /* Applicability */ ) {
|
|
9220
|
-
var parsedApplicability =
|
|
5609
|
+
var parsedApplicability = parser.parseObject((0, import_timm7.omit)(obj, "applicability"), nodeType, options);
|
|
9221
5610
|
if (parsedApplicability !== null) {
|
|
9222
|
-
var applicabilityNode =
|
|
5611
|
+
var applicabilityNode = parser.createASTNode({
|
|
9223
5612
|
type: "applicability" /* Applicability */ ,
|
|
9224
5613
|
expression: obj.applicability,
|
|
9225
5614
|
value: parsedApplicability
|
|
@@ -9281,20 +5670,20 @@ var Player = function() {
|
|
|
9281
5670
|
},
|
|
9282
5671
|
{
|
|
9283
5672
|
key: "applyParser",
|
|
9284
|
-
value: function applyParser(
|
|
5673
|
+
value: function applyParser(parser) {
|
|
9285
5674
|
var _this = this;
|
|
9286
|
-
|
|
5675
|
+
parser.hooks.onCreateASTNode.tap("switch", function(node) {
|
|
9287
5676
|
if (node && node.type === "switch" /* Switch */ && !node.dynamic) {
|
|
9288
5677
|
return _this.resolveSwitch(node, _this.options);
|
|
9289
5678
|
}
|
|
9290
5679
|
return node;
|
|
9291
5680
|
});
|
|
9292
|
-
|
|
5681
|
+
parser.hooks.determineNodeType.tap("switch", function(obj) {
|
|
9293
5682
|
if (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch")) {
|
|
9294
5683
|
return "switch" /* Switch */ ;
|
|
9295
5684
|
}
|
|
9296
5685
|
});
|
|
9297
|
-
|
|
5686
|
+
parser.hooks.parseNode.tap("switch", function(obj, _nodeType, options, determinedNodeType) {
|
|
9298
5687
|
if (determinedNodeType === "switch" /* Switch */ ) {
|
|
9299
5688
|
var dynamic = "dynamicSwitch" in obj;
|
|
9300
5689
|
var switchContent = "dynamicSwitch" in obj ? obj.dynamicSwitch : obj.staticSwitch;
|
|
@@ -9303,7 +5692,7 @@ var Player = function() {
|
|
|
9303
5692
|
var switchCaseExpr = switchCase.case, switchBody = _object_without_properties(switchCase, [
|
|
9304
5693
|
"case"
|
|
9305
5694
|
]);
|
|
9306
|
-
var value =
|
|
5695
|
+
var value = parser.parseObject(switchBody, "value" /* Value */ , options);
|
|
9307
5696
|
if (value) {
|
|
9308
5697
|
cases.push({
|
|
9309
5698
|
case: switchCaseExpr,
|
|
@@ -9311,7 +5700,7 @@ var Player = function() {
|
|
|
9311
5700
|
});
|
|
9312
5701
|
}
|
|
9313
5702
|
});
|
|
9314
|
-
var switchAST =
|
|
5703
|
+
var switchAST = parser.hooks.onCreateASTNode.call({
|
|
9315
5704
|
type: "switch" /* Switch */ ,
|
|
9316
5705
|
dynamic: dynamic,
|
|
9317
5706
|
cases: cases
|
|
@@ -10343,11 +6732,11 @@ var Player = function() {
|
|
|
10343
6732
|
},
|
|
10344
6733
|
{
|
|
10345
6734
|
key: "forView",
|
|
10346
|
-
value: function forView(
|
|
6735
|
+
value: function forView(parser) {
|
|
10347
6736
|
var _this = this;
|
|
10348
6737
|
return {
|
|
10349
6738
|
_getValidationForBinding: function(binding) {
|
|
10350
|
-
return _this.getValidationForBinding(isBinding(binding) ? binding :
|
|
6739
|
+
return _this.getValidationForBinding(isBinding(binding) ? binding : parser(binding));
|
|
10351
6740
|
},
|
|
10352
6741
|
getAll: function() {
|
|
10353
6742
|
var bindings = _this.getBindings();
|
|
@@ -10383,7 +6772,7 @@ var Player = function() {
|
|
|
10383
6772
|
throw new Error("Section functionality should be provided by the view plugin");
|
|
10384
6773
|
},
|
|
10385
6774
|
type: function(binding) {
|
|
10386
|
-
return _this.schema.getType(isBinding(binding) ? binding :
|
|
6775
|
+
return _this.schema.getType(isBinding(binding) ? binding : parser(binding));
|
|
10387
6776
|
}
|
|
10388
6777
|
};
|
|
10389
6778
|
}
|
|
@@ -10572,20 +6961,20 @@ var Player = function() {
|
|
|
10572
6961
|
// ../../../../../../../../../../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
|
|
10573
6962
|
var import_sorted_array = __toESM(require_sorted_array(), 1);
|
|
10574
6963
|
function traverseObj(object) {
|
|
10575
|
-
var
|
|
6964
|
+
var path = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], pairs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : /* @__PURE__ */ new Map();
|
|
10576
6965
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10577
6966
|
try {
|
|
10578
6967
|
for(var _iterator = Object.keys(object)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
10579
6968
|
var key = _step.value;
|
|
10580
6969
|
"";
|
|
10581
6970
|
var val = object[key];
|
|
10582
|
-
var
|
|
6971
|
+
var nestedPath = _to_consumable_array(path).concat([
|
|
10583
6972
|
key
|
|
10584
6973
|
]);
|
|
10585
6974
|
if (typeof val === "object") {
|
|
10586
|
-
traverseObj(val,
|
|
6975
|
+
traverseObj(val, nestedPath, pairs);
|
|
10587
6976
|
} else {
|
|
10588
|
-
pairs.set(
|
|
6977
|
+
pairs.set(nestedPath, val);
|
|
10589
6978
|
}
|
|
10590
6979
|
}
|
|
10591
6980
|
} catch (err) {
|
|
@@ -10633,12 +7022,12 @@ var Player = function() {
|
|
|
10633
7022
|
},
|
|
10634
7023
|
{
|
|
10635
7024
|
/** Fetch the best match in the registry */ key: "get",
|
|
10636
|
-
value: function get(
|
|
7025
|
+
value: function get(query) {
|
|
10637
7026
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10638
7027
|
try {
|
|
10639
7028
|
for(var _iterator = this.store.array[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
10640
7029
|
var entry = _step.value;
|
|
10641
|
-
if (entry.matcher(
|
|
7030
|
+
if (entry.matcher(query)) {
|
|
10642
7031
|
return entry.value;
|
|
10643
7032
|
}
|
|
10644
7033
|
}
|
|
@@ -11014,11 +7403,11 @@ var Player = function() {
|
|
|
11014
7403
|
return DataController;
|
|
11015
7404
|
}();
|
|
11016
7405
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/controllers/constants/utils.ts
|
|
11017
|
-
function
|
|
7406
|
+
function flatten(obj) {
|
|
11018
7407
|
var roots = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], sep = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
11019
7408
|
return Object.keys(obj).reduce(function(memo, prop) {
|
|
11020
7409
|
return _object_spread({}, memo, Object.prototype.toString.call(obj[prop]) === "[object Object]" ? // keep working if value is an object
|
|
11021
|
-
|
|
7410
|
+
flatten(obj[prop], roots.concat([
|
|
11022
7411
|
prop
|
|
11023
7412
|
])) : _define_property({}, roots.concat([
|
|
11024
7413
|
prop
|
|
@@ -11048,9 +7437,9 @@ var Player = function() {
|
|
|
11048
7437
|
key: "getConstants",
|
|
11049
7438
|
value: function getConstants(key, namespace, fallback) {
|
|
11050
7439
|
var _this_tempStore_get, _this_store_get;
|
|
11051
|
-
var
|
|
7440
|
+
var path = new BindingInstance(key);
|
|
11052
7441
|
var _this_tempStore_get_get, _ref;
|
|
11053
|
-
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(
|
|
7442
|
+
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;
|
|
11054
7443
|
}
|
|
11055
7444
|
},
|
|
11056
7445
|
{
|
|
@@ -11606,14 +7995,6 @@ var Player = function() {
|
|
|
11606
7995
|
return __toCommonJS(src_exports);
|
|
11607
7996
|
}(); /*! Bundled license information:
|
|
11608
7997
|
|
|
11609
|
-
arr-flatten/index.js:
|
|
11610
|
-
(*!
|
|
11611
|
-
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
|
|
11612
|
-
*
|
|
11613
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
11614
|
-
* Released under the MIT License.
|
|
11615
|
-
*)
|
|
11616
|
-
|
|
11617
7998
|
timm/lib/timm.js:
|
|
11618
7999
|
(*!
|
|
11619
8000
|
* Timm
|