@player-ui/markdown-plugin 0.8.0-next.0 → 0.8.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MarkdownPlugin.native.js +140 -3757
- package/dist/MarkdownPlugin.native.js.map +1 -1
- package/package.json +3 -3
|
@@ -453,8 +453,8 @@ var MarkdownPlugin = function() {
|
|
|
453
453
|
try {
|
|
454
454
|
for(var _iterator = Array.from(pairs)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
455
455
|
var entry = _step.value;
|
|
456
|
-
var _entry = _sliced_to_array(entry, 2),
|
|
457
|
-
if (dlv_es_default(searchObj,
|
|
456
|
+
var _entry = _sliced_to_array(entry, 2), path = _entry[0], value = _entry[1];
|
|
457
|
+
if (dlv_es_default(searchObj, path) !== value) {
|
|
458
458
|
return false;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
@@ -1030,17 +1030,17 @@ var MarkdownPlugin = function() {
|
|
|
1030
1030
|
break;
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
|
-
var
|
|
1034
|
-
if (Object.prototype.hasOwnProperty.call(literals,
|
|
1033
|
+
var identifier = expr.slice(start, index2);
|
|
1034
|
+
if (Object.prototype.hasOwnProperty.call(literals, identifier)) {
|
|
1035
1035
|
return {
|
|
1036
1036
|
__id: ExpNodeOpaqueIdentifier,
|
|
1037
1037
|
type: "Literal",
|
|
1038
|
-
value: literals[
|
|
1039
|
-
raw:
|
|
1038
|
+
value: literals[identifier],
|
|
1039
|
+
raw: identifier,
|
|
1040
1040
|
location: getLocation(start)
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
|
-
if (
|
|
1043
|
+
if (identifier === thisStr) {
|
|
1044
1044
|
return {
|
|
1045
1045
|
__id: ExpNodeOpaqueIdentifier,
|
|
1046
1046
|
type: "ThisExpression",
|
|
@@ -1050,7 +1050,7 @@ var MarkdownPlugin = function() {
|
|
|
1050
1050
|
return {
|
|
1051
1051
|
__id: ExpNodeOpaqueIdentifier,
|
|
1052
1052
|
type: "Identifier",
|
|
1053
|
-
name:
|
|
1053
|
+
name: identifier,
|
|
1054
1054
|
location: getLocation(start)
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
@@ -1190,19 +1190,19 @@ var MarkdownPlugin = function() {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
|
|
1192
1192
|
};
|
|
1193
|
-
var
|
|
1193
|
+
var parse2 = function parse2(schema) {
|
|
1194
1194
|
var _loop = function() {
|
|
1195
1195
|
var next = parseQueue.shift();
|
|
1196
1196
|
if (!next) {
|
|
1197
1197
|
return "break";
|
|
1198
1198
|
}
|
|
1199
|
-
var node2 = next.node,
|
|
1199
|
+
var node2 = next.node, path = next.path, visited = next.visited;
|
|
1200
1200
|
Object.entries(node2).forEach(function(param) {
|
|
1201
1201
|
var _param = _sliced_to_array(param, 2), prop = _param[0], type = _param[1];
|
|
1202
|
-
var
|
|
1202
|
+
var nestedPath = _to_consumable_array(path).concat([
|
|
1203
1203
|
prop
|
|
1204
1204
|
]);
|
|
1205
|
-
var nestedPathStr =
|
|
1205
|
+
var nestedPathStr = nestedPath.join(".");
|
|
1206
1206
|
if (expandedPaths.has(nestedPathStr)) {
|
|
1207
1207
|
throw new Error("Path has already been processed. There's either a loop somewhere or a bug");
|
|
1208
1208
|
}
|
|
@@ -1211,14 +1211,14 @@ var MarkdownPlugin = function() {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
expandedPaths.set(nestedPathStr, type);
|
|
1213
1213
|
if (type.isArray) {
|
|
1214
|
-
|
|
1214
|
+
nestedPath.push("[]");
|
|
1215
1215
|
}
|
|
1216
1216
|
if (type.isRecord) {
|
|
1217
|
-
|
|
1217
|
+
nestedPath.push("{}");
|
|
1218
1218
|
}
|
|
1219
1219
|
if (type.type && schema[type.type]) {
|
|
1220
1220
|
parseQueue.push({
|
|
1221
|
-
path:
|
|
1221
|
+
path: nestedPath,
|
|
1222
1222
|
node: schema[type.type],
|
|
1223
1223
|
visited: /* @__PURE__ */ new Set(_to_consumable_array(visited).concat([
|
|
1224
1224
|
type.type
|
|
@@ -1444,7 +1444,7 @@ var MarkdownPlugin = function() {
|
|
|
1444
1444
|
};
|
|
1445
1445
|
};
|
|
1446
1446
|
var objectToBatchSet = function objectToBatchSet(obj) {
|
|
1447
|
-
var flattenedObj =
|
|
1447
|
+
var flattenedObj = flatten(obj);
|
|
1448
1448
|
var batchTxn = [];
|
|
1449
1449
|
Object.keys(flattenedObj).forEach(function(key) {
|
|
1450
1450
|
batchTxn.push([
|
|
@@ -3042,7 +3042,7 @@ var MarkdownPlugin = function() {
|
|
|
3042
3042
|
};
|
|
3043
3043
|
var tokenizeDefinition = function tokenizeDefinition(effects, ok, nok) {
|
|
3044
3044
|
var self = this;
|
|
3045
|
-
var
|
|
3045
|
+
var identifier;
|
|
3046
3046
|
return start;
|
|
3047
3047
|
function start(code) {
|
|
3048
3048
|
effects.enter("definition");
|
|
@@ -3053,7 +3053,7 @@ var MarkdownPlugin = function() {
|
|
|
3053
3053
|
nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(code);
|
|
3054
3054
|
}
|
|
3055
3055
|
function labelAfter(code) {
|
|
3056
|
-
|
|
3056
|
+
identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
|
|
3057
3057
|
if (code === 58) {
|
|
3058
3058
|
effects.enter("definitionMarker");
|
|
3059
3059
|
effects.consume(code);
|
|
@@ -3078,7 +3078,7 @@ var MarkdownPlugin = function() {
|
|
|
3078
3078
|
function afterWhitespace(code) {
|
|
3079
3079
|
if (code === null || markdownLineEnding(code)) {
|
|
3080
3080
|
effects.exit("definition");
|
|
3081
|
-
self.parser.defined.push(
|
|
3081
|
+
self.parser.defined.push(identifier);
|
|
3082
3082
|
return ok(code);
|
|
3083
3083
|
}
|
|
3084
3084
|
return nok(code);
|
|
@@ -4552,7 +4552,7 @@ var MarkdownPlugin = function() {
|
|
|
4552
4552
|
return events;
|
|
4553
4553
|
};
|
|
4554
4554
|
var createTokenizer = // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/micromark@4.0.0/node_modules/micromark/lib/create-tokenizer.js
|
|
4555
|
-
function createTokenizer(
|
|
4555
|
+
function createTokenizer(parser, initialize, from) {
|
|
4556
4556
|
var point3 = Object.assign(from ? Object.assign({}, from) : {
|
|
4557
4557
|
line: 1,
|
|
4558
4558
|
column: 1,
|
|
@@ -4581,7 +4581,7 @@ var MarkdownPlugin = function() {
|
|
|
4581
4581
|
code: null,
|
|
4582
4582
|
containerState: {},
|
|
4583
4583
|
events: [],
|
|
4584
|
-
parser:
|
|
4584
|
+
parser: parser,
|
|
4585
4585
|
sliceStream: sliceStream,
|
|
4586
4586
|
sliceSerialize: sliceSerialize,
|
|
4587
4587
|
now: now,
|
|
@@ -4870,13 +4870,13 @@ var MarkdownPlugin = function() {
|
|
|
4870
4870
|
}
|
|
4871
4871
|
return result.join("");
|
|
4872
4872
|
};
|
|
4873
|
-
var
|
|
4874
|
-
function
|
|
4873
|
+
var parse3 = // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/micromark@4.0.0/node_modules/micromark/lib/parse.js
|
|
4874
|
+
function parse3(options) {
|
|
4875
4875
|
var settings = options || {};
|
|
4876
4876
|
var constructs2 = /** @type {FullNormalizedExtension} */ combineExtensions([
|
|
4877
4877
|
constructs_exports
|
|
4878
4878
|
].concat(_to_consumable_array(settings.extensions || [])));
|
|
4879
|
-
var
|
|
4879
|
+
var parser = {
|
|
4880
4880
|
defined: [],
|
|
4881
4881
|
lazy: {},
|
|
4882
4882
|
constructs: constructs2,
|
|
@@ -4886,11 +4886,11 @@ var MarkdownPlugin = function() {
|
|
|
4886
4886
|
string: create(string),
|
|
4887
4887
|
text: create(text)
|
|
4888
4888
|
};
|
|
4889
|
-
return
|
|
4889
|
+
return parser;
|
|
4890
4890
|
function create(initial) {
|
|
4891
4891
|
return creator;
|
|
4892
4892
|
function creator(from) {
|
|
4893
|
-
return createTokenizer(
|
|
4893
|
+
return createTokenizer(parser, initial, from);
|
|
4894
4894
|
}
|
|
4895
4895
|
}
|
|
4896
4896
|
};
|
|
@@ -5024,7 +5024,7 @@ var MarkdownPlugin = function() {
|
|
|
5024
5024
|
options = encoding;
|
|
5025
5025
|
encoding = void 0;
|
|
5026
5026
|
}
|
|
5027
|
-
return compiler(options)(postprocess(
|
|
5027
|
+
return compiler(options)(postprocess(parse3(options).document().write(preprocess()(value, encoding, true))));
|
|
5028
5028
|
};
|
|
5029
5029
|
var compiler = function compiler(options) {
|
|
5030
5030
|
var config = {
|
|
@@ -5745,7 +5745,7 @@ var MarkdownPlugin = function() {
|
|
|
5745
5745
|
};
|
|
5746
5746
|
var parseAssetMarkdownContent = // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/markdown/core/src/utils/markdownParser.ts
|
|
5747
5747
|
function parseAssetMarkdownContent(param) {
|
|
5748
|
-
var asset = param.asset, mappers = param.mappers,
|
|
5748
|
+
var asset = param.asset, mappers = param.mappers, parser = param.parser;
|
|
5749
5749
|
var children = fromMarkdown(asset.value).children;
|
|
5750
5750
|
var isMultiParagraph = children.length > 1;
|
|
5751
5751
|
if (isMultiParagraph) {
|
|
@@ -5762,7 +5762,7 @@ var MarkdownPlugin = function() {
|
|
|
5762
5762
|
originalAsset: asset,
|
|
5763
5763
|
value: value
|
|
5764
5764
|
});
|
|
5765
|
-
return (
|
|
5765
|
+
return (parser === null || parser === void 0 ? void 0 : parser(collection, NodeType.Asset)) || null;
|
|
5766
5766
|
}
|
|
5767
5767
|
var transformer = transformers[children[0].type];
|
|
5768
5768
|
var content3 = transformer({
|
|
@@ -5771,7 +5771,7 @@ var MarkdownPlugin = function() {
|
|
|
5771
5771
|
mappers: mappers,
|
|
5772
5772
|
transformers: transformers
|
|
5773
5773
|
});
|
|
5774
|
-
return (
|
|
5774
|
+
return (parser === null || parser === void 0 ? void 0 : parser(content3, NodeType.Asset)) || null;
|
|
5775
5775
|
};
|
|
5776
5776
|
var __create = Object.create;
|
|
5777
5777
|
var __defProp = Object.defineProperty;
|
|
@@ -5941,3588 +5941,6 @@ var MarkdownPlugin = function() {
|
|
|
5941
5941
|
exports.toError = toError;
|
|
5942
5942
|
}
|
|
5943
5943
|
});
|
|
5944
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/arr-flatten@1.1.0/node_modules/arr-flatten/index.js
|
|
5945
|
-
var require_arr_flatten = __commonJS({
|
|
5946
|
-
"../../../../../../../../../../../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) {
|
|
5947
|
-
"use strict";
|
|
5948
|
-
module.exports = function(arr) {
|
|
5949
|
-
return flat(arr, []);
|
|
5950
|
-
};
|
|
5951
|
-
function flat(arr, res) {
|
|
5952
|
-
var i = 0, cur;
|
|
5953
|
-
var len = arr.length;
|
|
5954
|
-
for(; i < len; i++){
|
|
5955
|
-
cur = arr[i];
|
|
5956
|
-
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
|
|
5957
|
-
}
|
|
5958
|
-
return res;
|
|
5959
|
-
}
|
|
5960
|
-
}
|
|
5961
|
-
});
|
|
5962
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/parsimmon@1.18.1/node_modules/parsimmon/src/parsimmon.js
|
|
5963
|
-
var require_parsimmon = __commonJS({
|
|
5964
|
-
"../../../../../../../../../../../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) {
|
|
5965
|
-
"use strict";
|
|
5966
|
-
function Parsimmon(action) {
|
|
5967
|
-
if (!_instanceof(this, Parsimmon)) {
|
|
5968
|
-
return new Parsimmon(action);
|
|
5969
|
-
}
|
|
5970
|
-
this._ = action;
|
|
5971
|
-
}
|
|
5972
|
-
var _ = Parsimmon.prototype;
|
|
5973
|
-
function times(n, f) {
|
|
5974
|
-
var i = 0;
|
|
5975
|
-
for(i; i < n; i++){
|
|
5976
|
-
f(i);
|
|
5977
|
-
}
|
|
5978
|
-
}
|
|
5979
|
-
function forEach(f, arr) {
|
|
5980
|
-
times(arr.length, function(i) {
|
|
5981
|
-
f(arr[i], i, arr);
|
|
5982
|
-
});
|
|
5983
|
-
}
|
|
5984
|
-
function reduce(f, seed, arr) {
|
|
5985
|
-
forEach(function(elem, i, arr2) {
|
|
5986
|
-
seed = f(seed, elem, i, arr2);
|
|
5987
|
-
}, arr);
|
|
5988
|
-
return seed;
|
|
5989
|
-
}
|
|
5990
|
-
function map(f, arr) {
|
|
5991
|
-
return reduce(function(acc, elem, i, a) {
|
|
5992
|
-
return acc.concat([
|
|
5993
|
-
f(elem, i, a)
|
|
5994
|
-
]);
|
|
5995
|
-
}, [], arr);
|
|
5996
|
-
}
|
|
5997
|
-
function lshiftBuffer(input) {
|
|
5998
|
-
var asTwoBytes = reduce(function(a, v, i, b) {
|
|
5999
|
-
return a.concat(i === b.length - 1 ? Buffer.from([
|
|
6000
|
-
v,
|
|
6001
|
-
0
|
|
6002
|
-
]).readUInt16BE(0) : b.readUInt16BE(i));
|
|
6003
|
-
}, [], input);
|
|
6004
|
-
return Buffer.from(map(function(x) {
|
|
6005
|
-
return (x << 1 & 65535) >> 8;
|
|
6006
|
-
}, asTwoBytes));
|
|
6007
|
-
}
|
|
6008
|
-
function consumeBitsFromBuffer(n, input) {
|
|
6009
|
-
var state = {
|
|
6010
|
-
v: 0,
|
|
6011
|
-
buf: input
|
|
6012
|
-
};
|
|
6013
|
-
times(n, function() {
|
|
6014
|
-
state = {
|
|
6015
|
-
v: state.v << 1 | bitPeekBuffer(state.buf),
|
|
6016
|
-
buf: lshiftBuffer(state.buf)
|
|
6017
|
-
};
|
|
6018
|
-
});
|
|
6019
|
-
return state;
|
|
6020
|
-
}
|
|
6021
|
-
function bitPeekBuffer(input) {
|
|
6022
|
-
return input[0] >> 7;
|
|
6023
|
-
}
|
|
6024
|
-
function sum(numArr) {
|
|
6025
|
-
return reduce(function(x, y) {
|
|
6026
|
-
return x + y;
|
|
6027
|
-
}, 0, numArr);
|
|
6028
|
-
}
|
|
6029
|
-
function find2(pred, arr) {
|
|
6030
|
-
return reduce(function(found, elem) {
|
|
6031
|
-
return found || (pred(elem) ? elem : found);
|
|
6032
|
-
}, null, arr);
|
|
6033
|
-
}
|
|
6034
|
-
function bufferExists() {
|
|
6035
|
-
return typeof Buffer !== "undefined";
|
|
6036
|
-
}
|
|
6037
|
-
function setExists() {
|
|
6038
|
-
if (Parsimmon._supportsSet !== void 0) {
|
|
6039
|
-
return Parsimmon._supportsSet;
|
|
6040
|
-
}
|
|
6041
|
-
var exists = typeof Set !== "undefined";
|
|
6042
|
-
Parsimmon._supportsSet = exists;
|
|
6043
|
-
return exists;
|
|
6044
|
-
}
|
|
6045
|
-
function ensureBuffer() {
|
|
6046
|
-
if (!bufferExists()) {
|
|
6047
|
-
throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.");
|
|
6048
|
-
}
|
|
6049
|
-
}
|
|
6050
|
-
function bitSeq(alignments) {
|
|
6051
|
-
ensureBuffer();
|
|
6052
|
-
var totalBits = sum(alignments);
|
|
6053
|
-
if (totalBits % 8 !== 0) {
|
|
6054
|
-
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");
|
|
6055
|
-
}
|
|
6056
|
-
var bytes = totalBits / 8;
|
|
6057
|
-
var tooBigRange = find2(function(x) {
|
|
6058
|
-
return x > 48;
|
|
6059
|
-
}, alignments);
|
|
6060
|
-
if (tooBigRange) {
|
|
6061
|
-
throw new Error(tooBigRange + " bit range requested exceeds 48 bit (6 byte) Number max.");
|
|
6062
|
-
}
|
|
6063
|
-
return new Parsimmon(function(input, i) {
|
|
6064
|
-
var newPos = bytes + i;
|
|
6065
|
-
if (newPos > input.length) {
|
|
6066
|
-
return makeFailure(i, bytes.toString() + " bytes");
|
|
6067
|
-
}
|
|
6068
|
-
return makeSuccess(newPos, reduce(function(acc, bits) {
|
|
6069
|
-
var state = consumeBitsFromBuffer(bits, acc.buf);
|
|
6070
|
-
return {
|
|
6071
|
-
coll: acc.coll.concat(state.v),
|
|
6072
|
-
buf: state.buf
|
|
6073
|
-
};
|
|
6074
|
-
}, {
|
|
6075
|
-
coll: [],
|
|
6076
|
-
buf: input.slice(i, newPos)
|
|
6077
|
-
}, alignments).coll);
|
|
6078
|
-
});
|
|
6079
|
-
}
|
|
6080
|
-
function bitSeqObj(namedAlignments) {
|
|
6081
|
-
ensureBuffer();
|
|
6082
|
-
var seenKeys = {};
|
|
6083
|
-
var totalKeys = 0;
|
|
6084
|
-
var fullAlignments = map(function(item) {
|
|
6085
|
-
if (isArray(item)) {
|
|
6086
|
-
var pair = item;
|
|
6087
|
-
if (pair.length !== 2) {
|
|
6088
|
-
throw new Error("[" + pair.join(", ") + "] should be length 2, got length " + pair.length);
|
|
6089
|
-
}
|
|
6090
|
-
assertString(pair[0]);
|
|
6091
|
-
assertNumber(pair[1]);
|
|
6092
|
-
if (Object.prototype.hasOwnProperty.call(seenKeys, pair[0])) {
|
|
6093
|
-
throw new Error("duplicate key in bitSeqObj: " + pair[0]);
|
|
6094
|
-
}
|
|
6095
|
-
seenKeys[pair[0]] = true;
|
|
6096
|
-
totalKeys++;
|
|
6097
|
-
return pair;
|
|
6098
|
-
} else {
|
|
6099
|
-
assertNumber(item);
|
|
6100
|
-
return [
|
|
6101
|
-
null,
|
|
6102
|
-
item
|
|
6103
|
-
];
|
|
6104
|
-
}
|
|
6105
|
-
}, namedAlignments);
|
|
6106
|
-
if (totalKeys < 1) {
|
|
6107
|
-
throw new Error("bitSeqObj expects at least one named pair, got [" + namedAlignments.join(", ") + "]");
|
|
6108
|
-
}
|
|
6109
|
-
var namesOnly = map(function(pair) {
|
|
6110
|
-
return pair[0];
|
|
6111
|
-
}, fullAlignments);
|
|
6112
|
-
var alignmentsOnly = map(function(pair) {
|
|
6113
|
-
return pair[1];
|
|
6114
|
-
}, fullAlignments);
|
|
6115
|
-
return bitSeq(alignmentsOnly).map(function(parsed) {
|
|
6116
|
-
var namedParsed = map(function(name, i) {
|
|
6117
|
-
return [
|
|
6118
|
-
name,
|
|
6119
|
-
parsed[i]
|
|
6120
|
-
];
|
|
6121
|
-
}, namesOnly);
|
|
6122
|
-
return reduce(function(obj, kv) {
|
|
6123
|
-
if (kv[0] !== null) {
|
|
6124
|
-
obj[kv[0]] = kv[1];
|
|
6125
|
-
}
|
|
6126
|
-
return obj;
|
|
6127
|
-
}, {}, namedParsed);
|
|
6128
|
-
});
|
|
6129
|
-
}
|
|
6130
|
-
function parseBufferFor(other, length) {
|
|
6131
|
-
return new Parsimmon(function(input, i) {
|
|
6132
|
-
ensureBuffer();
|
|
6133
|
-
if (i + length > input.length) {
|
|
6134
|
-
return makeFailure(i, length + " bytes for " + other);
|
|
6135
|
-
}
|
|
6136
|
-
return makeSuccess(i + length, input.slice(i, i + length));
|
|
6137
|
-
});
|
|
6138
|
-
}
|
|
6139
|
-
function parseBuffer(length) {
|
|
6140
|
-
return parseBufferFor("buffer", length).map(function(unsafe) {
|
|
6141
|
-
return Buffer.from(unsafe);
|
|
6142
|
-
});
|
|
6143
|
-
}
|
|
6144
|
-
function encodedString(encoding, length) {
|
|
6145
|
-
return parseBufferFor("string", length).map(function(buff) {
|
|
6146
|
-
return buff.toString(encoding);
|
|
6147
|
-
});
|
|
6148
|
-
}
|
|
6149
|
-
function isInteger(value) {
|
|
6150
|
-
return typeof value === "number" && Math.floor(value) === value;
|
|
6151
|
-
}
|
|
6152
|
-
function assertValidIntegerByteLengthFor(who, length) {
|
|
6153
|
-
if (!isInteger(length) || length < 0 || length > 6) {
|
|
6154
|
-
throw new Error(who + " requires integer length in range [0, 6].");
|
|
6155
|
-
}
|
|
6156
|
-
}
|
|
6157
|
-
function uintBE(length) {
|
|
6158
|
-
assertValidIntegerByteLengthFor("uintBE", length);
|
|
6159
|
-
return parseBufferFor("uintBE(" + length + ")", length).map(function(buff) {
|
|
6160
|
-
return buff.readUIntBE(0, length);
|
|
6161
|
-
});
|
|
6162
|
-
}
|
|
6163
|
-
function uintLE(length) {
|
|
6164
|
-
assertValidIntegerByteLengthFor("uintLE", length);
|
|
6165
|
-
return parseBufferFor("uintLE(" + length + ")", length).map(function(buff) {
|
|
6166
|
-
return buff.readUIntLE(0, length);
|
|
6167
|
-
});
|
|
6168
|
-
}
|
|
6169
|
-
function intBE(length) {
|
|
6170
|
-
assertValidIntegerByteLengthFor("intBE", length);
|
|
6171
|
-
return parseBufferFor("intBE(" + length + ")", length).map(function(buff) {
|
|
6172
|
-
return buff.readIntBE(0, length);
|
|
6173
|
-
});
|
|
6174
|
-
}
|
|
6175
|
-
function intLE(length) {
|
|
6176
|
-
assertValidIntegerByteLengthFor("intLE", length);
|
|
6177
|
-
return parseBufferFor("intLE(" + length + ")", length).map(function(buff) {
|
|
6178
|
-
return buff.readIntLE(0, length);
|
|
6179
|
-
});
|
|
6180
|
-
}
|
|
6181
|
-
function floatBE() {
|
|
6182
|
-
return parseBufferFor("floatBE", 4).map(function(buff) {
|
|
6183
|
-
return buff.readFloatBE(0);
|
|
6184
|
-
});
|
|
6185
|
-
}
|
|
6186
|
-
function floatLE() {
|
|
6187
|
-
return parseBufferFor("floatLE", 4).map(function(buff) {
|
|
6188
|
-
return buff.readFloatLE(0);
|
|
6189
|
-
});
|
|
6190
|
-
}
|
|
6191
|
-
function doubleBE() {
|
|
6192
|
-
return parseBufferFor("doubleBE", 8).map(function(buff) {
|
|
6193
|
-
return buff.readDoubleBE(0);
|
|
6194
|
-
});
|
|
6195
|
-
}
|
|
6196
|
-
function doubleLE() {
|
|
6197
|
-
return parseBufferFor("doubleLE", 8).map(function(buff) {
|
|
6198
|
-
return buff.readDoubleLE(0);
|
|
6199
|
-
});
|
|
6200
|
-
}
|
|
6201
|
-
function toArray(arrLike) {
|
|
6202
|
-
return Array.prototype.slice.call(arrLike);
|
|
6203
|
-
}
|
|
6204
|
-
function isParser(obj) {
|
|
6205
|
-
return _instanceof(obj, Parsimmon);
|
|
6206
|
-
}
|
|
6207
|
-
function isArray(x) {
|
|
6208
|
-
return ({}).toString.call(x) === "[object Array]";
|
|
6209
|
-
}
|
|
6210
|
-
function isBuffer(x) {
|
|
6211
|
-
return bufferExists() && Buffer.isBuffer(x);
|
|
6212
|
-
}
|
|
6213
|
-
function makeSuccess(index3, value) {
|
|
6214
|
-
return {
|
|
6215
|
-
status: true,
|
|
6216
|
-
index: index3,
|
|
6217
|
-
value: value,
|
|
6218
|
-
furthest: -1,
|
|
6219
|
-
expected: []
|
|
6220
|
-
};
|
|
6221
|
-
}
|
|
6222
|
-
function makeFailure(index3, expected) {
|
|
6223
|
-
if (!isArray(expected)) {
|
|
6224
|
-
expected = [
|
|
6225
|
-
expected
|
|
6226
|
-
];
|
|
6227
|
-
}
|
|
6228
|
-
return {
|
|
6229
|
-
status: false,
|
|
6230
|
-
index: -1,
|
|
6231
|
-
value: null,
|
|
6232
|
-
furthest: index3,
|
|
6233
|
-
expected: expected
|
|
6234
|
-
};
|
|
6235
|
-
}
|
|
6236
|
-
function mergeReplies(result, last) {
|
|
6237
|
-
if (!last) {
|
|
6238
|
-
return result;
|
|
6239
|
-
}
|
|
6240
|
-
if (result.furthest > last.furthest) {
|
|
6241
|
-
return result;
|
|
6242
|
-
}
|
|
6243
|
-
var expected = result.furthest === last.furthest ? union(result.expected, last.expected) : last.expected;
|
|
6244
|
-
return {
|
|
6245
|
-
status: result.status,
|
|
6246
|
-
index: result.index,
|
|
6247
|
-
value: result.value,
|
|
6248
|
-
furthest: last.furthest,
|
|
6249
|
-
expected: expected
|
|
6250
|
-
};
|
|
6251
|
-
}
|
|
6252
|
-
var lineColumnIndex = {};
|
|
6253
|
-
function makeLineColumnIndex(input, i) {
|
|
6254
|
-
if (isBuffer(input)) {
|
|
6255
|
-
return {
|
|
6256
|
-
offset: i,
|
|
6257
|
-
line: -1,
|
|
6258
|
-
column: -1
|
|
6259
|
-
};
|
|
6260
|
-
}
|
|
6261
|
-
if (!(input in lineColumnIndex)) {
|
|
6262
|
-
lineColumnIndex[input] = {};
|
|
6263
|
-
}
|
|
6264
|
-
var inputIndex = lineColumnIndex[input];
|
|
6265
|
-
var prevLine = 0;
|
|
6266
|
-
var newLines = 0;
|
|
6267
|
-
var lineStart = 0;
|
|
6268
|
-
var j = i;
|
|
6269
|
-
while(j >= 0){
|
|
6270
|
-
if (j in inputIndex) {
|
|
6271
|
-
prevLine = inputIndex[j].line;
|
|
6272
|
-
if (lineStart === 0) {
|
|
6273
|
-
lineStart = inputIndex[j].lineStart;
|
|
6274
|
-
}
|
|
6275
|
-
break;
|
|
6276
|
-
}
|
|
6277
|
-
if (// Unix LF (\n) or Windows CRLF (\r\n) line ending
|
|
6278
|
-
input.charAt(j) === "\n" || // Old Mac CR (\r) line ending
|
|
6279
|
-
input.charAt(j) === "\r" && input.charAt(j + 1) !== "\n") {
|
|
6280
|
-
newLines++;
|
|
6281
|
-
if (lineStart === 0) {
|
|
6282
|
-
lineStart = j + 1;
|
|
6283
|
-
}
|
|
6284
|
-
}
|
|
6285
|
-
j--;
|
|
6286
|
-
}
|
|
6287
|
-
var lineWeAreUpTo = prevLine + newLines;
|
|
6288
|
-
var columnWeAreUpTo = i - lineStart;
|
|
6289
|
-
inputIndex[i] = {
|
|
6290
|
-
line: lineWeAreUpTo,
|
|
6291
|
-
lineStart: lineStart
|
|
6292
|
-
};
|
|
6293
|
-
return {
|
|
6294
|
-
offset: i,
|
|
6295
|
-
line: lineWeAreUpTo + 1,
|
|
6296
|
-
column: columnWeAreUpTo + 1
|
|
6297
|
-
};
|
|
6298
|
-
}
|
|
6299
|
-
function union(xs, ys) {
|
|
6300
|
-
if (setExists() && Array.from) {
|
|
6301
|
-
var set2 = new Set(xs);
|
|
6302
|
-
for(var y = 0; y < ys.length; y++){
|
|
6303
|
-
set2.add(ys[y]);
|
|
6304
|
-
}
|
|
6305
|
-
var arr = Array.from(set2);
|
|
6306
|
-
arr.sort();
|
|
6307
|
-
return arr;
|
|
6308
|
-
}
|
|
6309
|
-
var obj = {};
|
|
6310
|
-
for(var i = 0; i < xs.length; i++){
|
|
6311
|
-
obj[xs[i]] = true;
|
|
6312
|
-
}
|
|
6313
|
-
for(var j = 0; j < ys.length; j++){
|
|
6314
|
-
obj[ys[j]] = true;
|
|
6315
|
-
}
|
|
6316
|
-
var keys = [];
|
|
6317
|
-
for(var k in obj){
|
|
6318
|
-
if (({}).hasOwnProperty.call(obj, k)) {
|
|
6319
|
-
keys.push(k);
|
|
6320
|
-
}
|
|
6321
|
-
}
|
|
6322
|
-
keys.sort();
|
|
6323
|
-
return keys;
|
|
6324
|
-
}
|
|
6325
|
-
function assertParser(p) {
|
|
6326
|
-
if (!isParser(p)) {
|
|
6327
|
-
throw new Error("not a parser: " + p);
|
|
6328
|
-
}
|
|
6329
|
-
}
|
|
6330
|
-
function get(input, i) {
|
|
6331
|
-
if (typeof input === "string") {
|
|
6332
|
-
return input.charAt(i);
|
|
6333
|
-
}
|
|
6334
|
-
return input[i];
|
|
6335
|
-
}
|
|
6336
|
-
function assertArray(x) {
|
|
6337
|
-
if (!isArray(x)) {
|
|
6338
|
-
throw new Error("not an array: " + x);
|
|
6339
|
-
}
|
|
6340
|
-
}
|
|
6341
|
-
function assertNumber(x) {
|
|
6342
|
-
if (typeof x !== "number") {
|
|
6343
|
-
throw new Error("not a number: " + x);
|
|
6344
|
-
}
|
|
6345
|
-
}
|
|
6346
|
-
function assertRegexp(x) {
|
|
6347
|
-
if (!_instanceof(x, RegExp)) {
|
|
6348
|
-
throw new Error("not a regexp: " + x);
|
|
6349
|
-
}
|
|
6350
|
-
var f = flags(x);
|
|
6351
|
-
for(var i = 0; i < f.length; i++){
|
|
6352
|
-
var c = f.charAt(i);
|
|
6353
|
-
if (c !== "i" && c !== "m" && c !== "u" && c !== "s") {
|
|
6354
|
-
throw new Error('unsupported regexp flag "' + c + '": ' + x);
|
|
6355
|
-
}
|
|
6356
|
-
}
|
|
6357
|
-
}
|
|
6358
|
-
function assertFunction(x) {
|
|
6359
|
-
if (typeof x !== "function") {
|
|
6360
|
-
throw new Error("not a function: " + x);
|
|
6361
|
-
}
|
|
6362
|
-
}
|
|
6363
|
-
function assertString(x) {
|
|
6364
|
-
if (typeof x !== "string") {
|
|
6365
|
-
throw new Error("not a string: " + x);
|
|
6366
|
-
}
|
|
6367
|
-
}
|
|
6368
|
-
var linesBeforeStringError = 2;
|
|
6369
|
-
var linesAfterStringError = 3;
|
|
6370
|
-
var bytesPerLine = 8;
|
|
6371
|
-
var bytesBefore = bytesPerLine * 5;
|
|
6372
|
-
var bytesAfter = bytesPerLine * 4;
|
|
6373
|
-
var defaultLinePrefix = " ";
|
|
6374
|
-
function repeat(string4, amount) {
|
|
6375
|
-
return new Array(amount + 1).join(string4);
|
|
6376
|
-
}
|
|
6377
|
-
function formatExpected(expected) {
|
|
6378
|
-
if (expected.length === 1) {
|
|
6379
|
-
return "Expected:\n\n" + expected[0];
|
|
6380
|
-
}
|
|
6381
|
-
return "Expected one of the following: \n\n" + expected.join(", ");
|
|
6382
|
-
}
|
|
6383
|
-
function leftPad(str, pad, char) {
|
|
6384
|
-
var add = pad - str.length;
|
|
6385
|
-
if (add <= 0) {
|
|
6386
|
-
return str;
|
|
6387
|
-
}
|
|
6388
|
-
return repeat(char, add) + str;
|
|
6389
|
-
}
|
|
6390
|
-
function toChunks(arr, chunkSize) {
|
|
6391
|
-
var length = arr.length;
|
|
6392
|
-
var chunks = [];
|
|
6393
|
-
var chunkIndex = 0;
|
|
6394
|
-
if (length <= chunkSize) {
|
|
6395
|
-
return [
|
|
6396
|
-
arr.slice()
|
|
6397
|
-
];
|
|
6398
|
-
}
|
|
6399
|
-
for(var i = 0; i < length; i++){
|
|
6400
|
-
if (!chunks[chunkIndex]) {
|
|
6401
|
-
chunks.push([]);
|
|
6402
|
-
}
|
|
6403
|
-
chunks[chunkIndex].push(arr[i]);
|
|
6404
|
-
if ((i + 1) % chunkSize === 0) {
|
|
6405
|
-
chunkIndex++;
|
|
6406
|
-
}
|
|
6407
|
-
}
|
|
6408
|
-
return chunks;
|
|
6409
|
-
}
|
|
6410
|
-
function rangeFromIndexAndOffsets(i, before, after, length) {
|
|
6411
|
-
return {
|
|
6412
|
-
// Guard against the negative upper bound for lines included in the output.
|
|
6413
|
-
from: i - before > 0 ? i - before : 0,
|
|
6414
|
-
to: i + after > length ? length : i + after
|
|
6415
|
-
};
|
|
6416
|
-
}
|
|
6417
|
-
function byteRangeToRange(byteRange) {
|
|
6418
|
-
if (byteRange.from === 0 && byteRange.to === 1) {
|
|
6419
|
-
return {
|
|
6420
|
-
from: byteRange.from,
|
|
6421
|
-
to: byteRange.to
|
|
6422
|
-
};
|
|
6423
|
-
}
|
|
6424
|
-
return {
|
|
6425
|
-
from: byteRange.from / bytesPerLine,
|
|
6426
|
-
// Round `to`, so we don't get float if the amount of bytes is not divisible by `bytesPerLine`
|
|
6427
|
-
to: Math.floor(byteRange.to / bytesPerLine)
|
|
6428
|
-
};
|
|
6429
|
-
}
|
|
6430
|
-
function formatGot(input, error) {
|
|
6431
|
-
var index3 = error.index;
|
|
6432
|
-
var i = index3.offset;
|
|
6433
|
-
var verticalMarkerLength = 1;
|
|
6434
|
-
var column;
|
|
6435
|
-
var lineWithErrorIndex;
|
|
6436
|
-
var lines;
|
|
6437
|
-
var lineRange;
|
|
6438
|
-
var lastLineNumberLabelLength;
|
|
6439
|
-
if (i === input.length) {
|
|
6440
|
-
return "Got the end of the input";
|
|
6441
|
-
}
|
|
6442
|
-
if (isBuffer(input)) {
|
|
6443
|
-
var byteLineWithErrorIndex = i - i % bytesPerLine;
|
|
6444
|
-
var columnByteIndex = i - byteLineWithErrorIndex;
|
|
6445
|
-
var byteRange = rangeFromIndexAndOffsets(byteLineWithErrorIndex, bytesBefore, bytesAfter + bytesPerLine, input.length);
|
|
6446
|
-
var bytes = input.slice(byteRange.from, byteRange.to);
|
|
6447
|
-
var bytesInChunks = toChunks(bytes.toJSON().data, bytesPerLine);
|
|
6448
|
-
var byteLines = map(function(byteRow) {
|
|
6449
|
-
return map(function(byteValue) {
|
|
6450
|
-
return leftPad(byteValue.toString(16), 2, "0");
|
|
6451
|
-
}, byteRow);
|
|
6452
|
-
}, bytesInChunks);
|
|
6453
|
-
lineRange = byteRangeToRange(byteRange);
|
|
6454
|
-
lineWithErrorIndex = byteLineWithErrorIndex / bytesPerLine;
|
|
6455
|
-
column = columnByteIndex * 3;
|
|
6456
|
-
if (columnByteIndex >= 4) {
|
|
6457
|
-
column += 1;
|
|
6458
|
-
}
|
|
6459
|
-
verticalMarkerLength = 2;
|
|
6460
|
-
lines = map(function(byteLine) {
|
|
6461
|
-
return byteLine.length <= 4 ? byteLine.join(" ") : byteLine.slice(0, 4).join(" ") + " " + byteLine.slice(4).join(" ");
|
|
6462
|
-
}, byteLines);
|
|
6463
|
-
lastLineNumberLabelLength = ((lineRange.to > 0 ? lineRange.to - 1 : lineRange.to) * 8).toString(16).length;
|
|
6464
|
-
if (lastLineNumberLabelLength < 2) {
|
|
6465
|
-
lastLineNumberLabelLength = 2;
|
|
6466
|
-
}
|
|
6467
|
-
} else {
|
|
6468
|
-
var inputLines = input.split(/\r\n|[\n\r\u2028\u2029]/);
|
|
6469
|
-
column = index3.column - 1;
|
|
6470
|
-
lineWithErrorIndex = index3.line - 1;
|
|
6471
|
-
lineRange = rangeFromIndexAndOffsets(lineWithErrorIndex, linesBeforeStringError, linesAfterStringError, inputLines.length);
|
|
6472
|
-
lines = inputLines.slice(lineRange.from, lineRange.to);
|
|
6473
|
-
lastLineNumberLabelLength = lineRange.to.toString().length;
|
|
6474
|
-
}
|
|
6475
|
-
var lineWithErrorCurrentIndex = lineWithErrorIndex - lineRange.from;
|
|
6476
|
-
if (isBuffer(input)) {
|
|
6477
|
-
lastLineNumberLabelLength = ((lineRange.to > 0 ? lineRange.to - 1 : lineRange.to) * 8).toString(16).length;
|
|
6478
|
-
if (lastLineNumberLabelLength < 2) {
|
|
6479
|
-
lastLineNumberLabelLength = 2;
|
|
6480
|
-
}
|
|
6481
|
-
}
|
|
6482
|
-
var linesWithLineNumbers = reduce(function(acc, lineSource, index4) {
|
|
6483
|
-
var isLineWithError = index4 === lineWithErrorCurrentIndex;
|
|
6484
|
-
var prefix = isLineWithError ? "> " : defaultLinePrefix;
|
|
6485
|
-
var lineNumberLabel;
|
|
6486
|
-
if (isBuffer(input)) {
|
|
6487
|
-
lineNumberLabel = leftPad(((lineRange.from + index4) * 8).toString(16), lastLineNumberLabelLength, "0");
|
|
6488
|
-
} else {
|
|
6489
|
-
lineNumberLabel = leftPad((lineRange.from + index4 + 1).toString(), lastLineNumberLabelLength, " ");
|
|
6490
|
-
}
|
|
6491
|
-
return [].concat(acc, [
|
|
6492
|
-
prefix + lineNumberLabel + " | " + lineSource
|
|
6493
|
-
], isLineWithError ? [
|
|
6494
|
-
defaultLinePrefix + repeat(" ", lastLineNumberLabelLength) + " | " + leftPad("", column, " ") + repeat("^", verticalMarkerLength)
|
|
6495
|
-
] : []);
|
|
6496
|
-
}, [], lines);
|
|
6497
|
-
return linesWithLineNumbers.join("\n");
|
|
6498
|
-
}
|
|
6499
|
-
function formatError(input, error) {
|
|
6500
|
-
return [
|
|
6501
|
-
"\n",
|
|
6502
|
-
"-- PARSING FAILED " + repeat("-", 50),
|
|
6503
|
-
"\n\n",
|
|
6504
|
-
formatGot(input, error),
|
|
6505
|
-
"\n\n",
|
|
6506
|
-
formatExpected(error.expected),
|
|
6507
|
-
"\n"
|
|
6508
|
-
].join("");
|
|
6509
|
-
}
|
|
6510
|
-
function flags(re) {
|
|
6511
|
-
if (re.flags !== void 0) {
|
|
6512
|
-
return re.flags;
|
|
6513
|
-
}
|
|
6514
|
-
return [
|
|
6515
|
-
re.global ? "g" : "",
|
|
6516
|
-
re.ignoreCase ? "i" : "",
|
|
6517
|
-
re.multiline ? "m" : "",
|
|
6518
|
-
re.unicode ? "u" : "",
|
|
6519
|
-
re.sticky ? "y" : ""
|
|
6520
|
-
].join("");
|
|
6521
|
-
}
|
|
6522
|
-
function anchoredRegexp(re) {
|
|
6523
|
-
return RegExp("^(?:" + re.source + ")", flags(re));
|
|
6524
|
-
}
|
|
6525
|
-
function seq() {
|
|
6526
|
-
var parsers = [].slice.call(arguments);
|
|
6527
|
-
var numParsers = parsers.length;
|
|
6528
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
6529
|
-
assertParser(parsers[j]);
|
|
6530
|
-
}
|
|
6531
|
-
return Parsimmon(function(input, i) {
|
|
6532
|
-
var result;
|
|
6533
|
-
var accum = new Array(numParsers);
|
|
6534
|
-
for(var j2 = 0; j2 < numParsers; j2 += 1){
|
|
6535
|
-
result = mergeReplies(parsers[j2]._(input, i), result);
|
|
6536
|
-
if (!result.status) {
|
|
6537
|
-
return result;
|
|
6538
|
-
}
|
|
6539
|
-
accum[j2] = result.value;
|
|
6540
|
-
i = result.index;
|
|
6541
|
-
}
|
|
6542
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
6543
|
-
});
|
|
6544
|
-
}
|
|
6545
|
-
function seqObj() {
|
|
6546
|
-
var seenKeys = {};
|
|
6547
|
-
var totalKeys = 0;
|
|
6548
|
-
var parsers = toArray(arguments);
|
|
6549
|
-
var numParsers = parsers.length;
|
|
6550
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
6551
|
-
var p = parsers[j];
|
|
6552
|
-
if (isParser(p)) {
|
|
6553
|
-
continue;
|
|
6554
|
-
}
|
|
6555
|
-
if (isArray(p)) {
|
|
6556
|
-
var isWellFormed = p.length === 2 && typeof p[0] === "string" && isParser(p[1]);
|
|
6557
|
-
if (isWellFormed) {
|
|
6558
|
-
var key = p[0];
|
|
6559
|
-
if (Object.prototype.hasOwnProperty.call(seenKeys, key)) {
|
|
6560
|
-
throw new Error("seqObj: duplicate key " + key);
|
|
6561
|
-
}
|
|
6562
|
-
seenKeys[key] = true;
|
|
6563
|
-
totalKeys++;
|
|
6564
|
-
continue;
|
|
6565
|
-
}
|
|
6566
|
-
}
|
|
6567
|
-
throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.");
|
|
6568
|
-
}
|
|
6569
|
-
if (totalKeys === 0) {
|
|
6570
|
-
throw new Error("seqObj expects at least one named parser, found zero");
|
|
6571
|
-
}
|
|
6572
|
-
return Parsimmon(function(input, i) {
|
|
6573
|
-
var result;
|
|
6574
|
-
var accum = {};
|
|
6575
|
-
for(var j2 = 0; j2 < numParsers; j2 += 1){
|
|
6576
|
-
var name;
|
|
6577
|
-
var parser2;
|
|
6578
|
-
if (isArray(parsers[j2])) {
|
|
6579
|
-
name = parsers[j2][0];
|
|
6580
|
-
parser2 = parsers[j2][1];
|
|
6581
|
-
} else {
|
|
6582
|
-
name = null;
|
|
6583
|
-
parser2 = parsers[j2];
|
|
6584
|
-
}
|
|
6585
|
-
result = mergeReplies(parser2._(input, i), result);
|
|
6586
|
-
if (!result.status) {
|
|
6587
|
-
return result;
|
|
6588
|
-
}
|
|
6589
|
-
if (name) {
|
|
6590
|
-
accum[name] = result.value;
|
|
6591
|
-
}
|
|
6592
|
-
i = result.index;
|
|
6593
|
-
}
|
|
6594
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
6595
|
-
});
|
|
6596
|
-
}
|
|
6597
|
-
function seqMap() {
|
|
6598
|
-
var args = [].slice.call(arguments);
|
|
6599
|
-
if (args.length === 0) {
|
|
6600
|
-
throw new Error("seqMap needs at least one argument");
|
|
6601
|
-
}
|
|
6602
|
-
var mapper = args.pop();
|
|
6603
|
-
assertFunction(mapper);
|
|
6604
|
-
return seq.apply(null, args).map(function(results) {
|
|
6605
|
-
return mapper.apply(null, results);
|
|
6606
|
-
});
|
|
6607
|
-
}
|
|
6608
|
-
function createLanguage(parsers) {
|
|
6609
|
-
var language = {};
|
|
6610
|
-
for(var key in parsers){
|
|
6611
|
-
if (({}).hasOwnProperty.call(parsers, key)) {
|
|
6612
|
-
(function(key2) {
|
|
6613
|
-
var func = function func() {
|
|
6614
|
-
return parsers[key2](language);
|
|
6615
|
-
};
|
|
6616
|
-
language[key2] = lazy(func);
|
|
6617
|
-
})(key);
|
|
6618
|
-
}
|
|
6619
|
-
}
|
|
6620
|
-
return language;
|
|
6621
|
-
}
|
|
6622
|
-
function alt() {
|
|
6623
|
-
var parsers = [].slice.call(arguments);
|
|
6624
|
-
var numParsers = parsers.length;
|
|
6625
|
-
if (numParsers === 0) {
|
|
6626
|
-
return fail("zero alternates");
|
|
6627
|
-
}
|
|
6628
|
-
for(var j = 0; j < numParsers; j += 1){
|
|
6629
|
-
assertParser(parsers[j]);
|
|
6630
|
-
}
|
|
6631
|
-
return Parsimmon(function(input, i) {
|
|
6632
|
-
var result;
|
|
6633
|
-
for(var j2 = 0; j2 < parsers.length; j2 += 1){
|
|
6634
|
-
result = mergeReplies(parsers[j2]._(input, i), result);
|
|
6635
|
-
if (result.status) {
|
|
6636
|
-
return result;
|
|
6637
|
-
}
|
|
6638
|
-
}
|
|
6639
|
-
return result;
|
|
6640
|
-
});
|
|
6641
|
-
}
|
|
6642
|
-
function sepBy(parser2, separator) {
|
|
6643
|
-
return sepBy1(parser2, separator).or(succeed([]));
|
|
6644
|
-
}
|
|
6645
|
-
function sepBy1(parser2, separator) {
|
|
6646
|
-
assertParser(parser2);
|
|
6647
|
-
assertParser(separator);
|
|
6648
|
-
var pairs = separator.then(parser2).many();
|
|
6649
|
-
return seqMap(parser2, pairs, function(r, rs) {
|
|
6650
|
-
return [
|
|
6651
|
-
r
|
|
6652
|
-
].concat(rs);
|
|
6653
|
-
});
|
|
6654
|
-
}
|
|
6655
|
-
_.parse = function(input) {
|
|
6656
|
-
if (typeof input !== "string" && !isBuffer(input)) {
|
|
6657
|
-
throw new Error(".parse must be called with a string or Buffer as its argument");
|
|
6658
|
-
}
|
|
6659
|
-
var parseResult = this.skip(eof)._(input, 0);
|
|
6660
|
-
var result;
|
|
6661
|
-
if (parseResult.status) {
|
|
6662
|
-
result = {
|
|
6663
|
-
status: true,
|
|
6664
|
-
value: parseResult.value
|
|
6665
|
-
};
|
|
6666
|
-
} else {
|
|
6667
|
-
result = {
|
|
6668
|
-
status: false,
|
|
6669
|
-
index: makeLineColumnIndex(input, parseResult.furthest),
|
|
6670
|
-
expected: parseResult.expected
|
|
6671
|
-
};
|
|
6672
|
-
}
|
|
6673
|
-
delete lineColumnIndex[input];
|
|
6674
|
-
return result;
|
|
6675
|
-
};
|
|
6676
|
-
_.tryParse = function(str) {
|
|
6677
|
-
var result = this.parse(str);
|
|
6678
|
-
if (result.status) {
|
|
6679
|
-
return result.value;
|
|
6680
|
-
} else {
|
|
6681
|
-
var msg = formatError(str, result);
|
|
6682
|
-
var err = new Error(msg);
|
|
6683
|
-
err.type = "ParsimmonError";
|
|
6684
|
-
err.result = result;
|
|
6685
|
-
throw err;
|
|
6686
|
-
}
|
|
6687
|
-
};
|
|
6688
|
-
_.assert = function(condition, errorMessage) {
|
|
6689
|
-
return this.chain(function(value) {
|
|
6690
|
-
return condition(value) ? succeed(value) : fail(errorMessage);
|
|
6691
|
-
});
|
|
6692
|
-
};
|
|
6693
|
-
_.or = function(alternative) {
|
|
6694
|
-
return alt(this, alternative);
|
|
6695
|
-
};
|
|
6696
|
-
_.trim = function(parser2) {
|
|
6697
|
-
return this.wrap(parser2, parser2);
|
|
6698
|
-
};
|
|
6699
|
-
_.wrap = function(leftParser, rightParser) {
|
|
6700
|
-
return seqMap(leftParser, this, rightParser, function(left, middle) {
|
|
6701
|
-
return middle;
|
|
6702
|
-
});
|
|
6703
|
-
};
|
|
6704
|
-
_.thru = function(wrapper) {
|
|
6705
|
-
return wrapper(this);
|
|
6706
|
-
};
|
|
6707
|
-
_.then = function(next) {
|
|
6708
|
-
assertParser(next);
|
|
6709
|
-
return seq(this, next).map(function(results) {
|
|
6710
|
-
return results[1];
|
|
6711
|
-
});
|
|
6712
|
-
};
|
|
6713
|
-
_.many = function() {
|
|
6714
|
-
var self = this;
|
|
6715
|
-
return Parsimmon(function(input, i) {
|
|
6716
|
-
var accum = [];
|
|
6717
|
-
var result = void 0;
|
|
6718
|
-
for(;;){
|
|
6719
|
-
result = mergeReplies(self._(input, i), result);
|
|
6720
|
-
if (result.status) {
|
|
6721
|
-
if (i === result.index) {
|
|
6722
|
-
throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");
|
|
6723
|
-
}
|
|
6724
|
-
i = result.index;
|
|
6725
|
-
accum.push(result.value);
|
|
6726
|
-
} else {
|
|
6727
|
-
return mergeReplies(makeSuccess(i, accum), result);
|
|
6728
|
-
}
|
|
6729
|
-
}
|
|
6730
|
-
});
|
|
6731
|
-
};
|
|
6732
|
-
_.tieWith = function(separator) {
|
|
6733
|
-
assertString(separator);
|
|
6734
|
-
return this.map(function(args) {
|
|
6735
|
-
assertArray(args);
|
|
6736
|
-
if (args.length) {
|
|
6737
|
-
assertString(args[0]);
|
|
6738
|
-
var s = args[0];
|
|
6739
|
-
for(var i = 1; i < args.length; i++){
|
|
6740
|
-
assertString(args[i]);
|
|
6741
|
-
s += separator + args[i];
|
|
6742
|
-
}
|
|
6743
|
-
return s;
|
|
6744
|
-
} else {
|
|
6745
|
-
return "";
|
|
6746
|
-
}
|
|
6747
|
-
});
|
|
6748
|
-
};
|
|
6749
|
-
_.tie = function() {
|
|
6750
|
-
return this.tieWith("");
|
|
6751
|
-
};
|
|
6752
|
-
_.times = function(min, max) {
|
|
6753
|
-
var self = this;
|
|
6754
|
-
if (arguments.length < 2) {
|
|
6755
|
-
max = min;
|
|
6756
|
-
}
|
|
6757
|
-
assertNumber(min);
|
|
6758
|
-
assertNumber(max);
|
|
6759
|
-
return Parsimmon(function(input, i) {
|
|
6760
|
-
var accum = [];
|
|
6761
|
-
var result = void 0;
|
|
6762
|
-
var prevResult = void 0;
|
|
6763
|
-
for(var times2 = 0; times2 < min; times2 += 1){
|
|
6764
|
-
result = self._(input, i);
|
|
6765
|
-
prevResult = mergeReplies(result, prevResult);
|
|
6766
|
-
if (result.status) {
|
|
6767
|
-
i = result.index;
|
|
6768
|
-
accum.push(result.value);
|
|
6769
|
-
} else {
|
|
6770
|
-
return prevResult;
|
|
6771
|
-
}
|
|
6772
|
-
}
|
|
6773
|
-
for(; times2 < max; times2 += 1){
|
|
6774
|
-
result = self._(input, i);
|
|
6775
|
-
prevResult = mergeReplies(result, prevResult);
|
|
6776
|
-
if (result.status) {
|
|
6777
|
-
i = result.index;
|
|
6778
|
-
accum.push(result.value);
|
|
6779
|
-
} else {
|
|
6780
|
-
break;
|
|
6781
|
-
}
|
|
6782
|
-
}
|
|
6783
|
-
return mergeReplies(makeSuccess(i, accum), prevResult);
|
|
6784
|
-
});
|
|
6785
|
-
};
|
|
6786
|
-
_.result = function(res) {
|
|
6787
|
-
return this.map(function() {
|
|
6788
|
-
return res;
|
|
6789
|
-
});
|
|
6790
|
-
};
|
|
6791
|
-
_.atMost = function(n) {
|
|
6792
|
-
return this.times(0, n);
|
|
6793
|
-
};
|
|
6794
|
-
_.atLeast = function(n) {
|
|
6795
|
-
return seqMap(this.times(n), this.many(), function(init, rest) {
|
|
6796
|
-
return init.concat(rest);
|
|
6797
|
-
});
|
|
6798
|
-
};
|
|
6799
|
-
_.map = function(fn) {
|
|
6800
|
-
assertFunction(fn);
|
|
6801
|
-
var self = this;
|
|
6802
|
-
return Parsimmon(function(input, i) {
|
|
6803
|
-
var result = self._(input, i);
|
|
6804
|
-
if (!result.status) {
|
|
6805
|
-
return result;
|
|
6806
|
-
}
|
|
6807
|
-
return mergeReplies(makeSuccess(result.index, fn(result.value)), result);
|
|
6808
|
-
});
|
|
6809
|
-
};
|
|
6810
|
-
_.contramap = function(fn) {
|
|
6811
|
-
assertFunction(fn);
|
|
6812
|
-
var self = this;
|
|
6813
|
-
return Parsimmon(function(input, i) {
|
|
6814
|
-
var result = self.parse(fn(input.slice(i)));
|
|
6815
|
-
if (!result.status) {
|
|
6816
|
-
return result;
|
|
6817
|
-
}
|
|
6818
|
-
return makeSuccess(i + input.length, result.value);
|
|
6819
|
-
});
|
|
6820
|
-
};
|
|
6821
|
-
_.promap = function(f, g) {
|
|
6822
|
-
assertFunction(f);
|
|
6823
|
-
assertFunction(g);
|
|
6824
|
-
return this.contramap(f).map(g);
|
|
6825
|
-
};
|
|
6826
|
-
_.skip = function(next) {
|
|
6827
|
-
return seq(this, next).map(function(results) {
|
|
6828
|
-
return results[0];
|
|
6829
|
-
});
|
|
6830
|
-
};
|
|
6831
|
-
_.mark = function() {
|
|
6832
|
-
return seqMap(index2, this, index2, function(start, value, end2) {
|
|
6833
|
-
return {
|
|
6834
|
-
start: start,
|
|
6835
|
-
value: value,
|
|
6836
|
-
end: end2
|
|
6837
|
-
};
|
|
6838
|
-
});
|
|
6839
|
-
};
|
|
6840
|
-
_.node = function(name) {
|
|
6841
|
-
return seqMap(index2, this, index2, function(start, value, end2) {
|
|
6842
|
-
return {
|
|
6843
|
-
name: name,
|
|
6844
|
-
value: value,
|
|
6845
|
-
start: start,
|
|
6846
|
-
end: end2
|
|
6847
|
-
};
|
|
6848
|
-
});
|
|
6849
|
-
};
|
|
6850
|
-
_.sepBy = function(separator) {
|
|
6851
|
-
return sepBy(this, separator);
|
|
6852
|
-
};
|
|
6853
|
-
_.sepBy1 = function(separator) {
|
|
6854
|
-
return sepBy1(this, separator);
|
|
6855
|
-
};
|
|
6856
|
-
_.lookahead = function(x) {
|
|
6857
|
-
return this.skip(lookahead(x));
|
|
6858
|
-
};
|
|
6859
|
-
_.notFollowedBy = function(x) {
|
|
6860
|
-
return this.skip(notFollowedBy(x));
|
|
6861
|
-
};
|
|
6862
|
-
_.desc = function(expected) {
|
|
6863
|
-
if (!isArray(expected)) {
|
|
6864
|
-
expected = [
|
|
6865
|
-
expected
|
|
6866
|
-
];
|
|
6867
|
-
}
|
|
6868
|
-
var self = this;
|
|
6869
|
-
return Parsimmon(function(input, i) {
|
|
6870
|
-
var reply = self._(input, i);
|
|
6871
|
-
if (!reply.status) {
|
|
6872
|
-
reply.expected = expected;
|
|
6873
|
-
}
|
|
6874
|
-
return reply;
|
|
6875
|
-
});
|
|
6876
|
-
};
|
|
6877
|
-
_.fallback = function(result) {
|
|
6878
|
-
return this.or(succeed(result));
|
|
6879
|
-
};
|
|
6880
|
-
_.ap = function(other) {
|
|
6881
|
-
return seqMap(other, this, function(f, x) {
|
|
6882
|
-
return f(x);
|
|
6883
|
-
});
|
|
6884
|
-
};
|
|
6885
|
-
_.chain = function(f) {
|
|
6886
|
-
var self = this;
|
|
6887
|
-
return Parsimmon(function(input, i) {
|
|
6888
|
-
var result = self._(input, i);
|
|
6889
|
-
if (!result.status) {
|
|
6890
|
-
return result;
|
|
6891
|
-
}
|
|
6892
|
-
var nextParser = f(result.value);
|
|
6893
|
-
return mergeReplies(nextParser._(input, result.index), result);
|
|
6894
|
-
});
|
|
6895
|
-
};
|
|
6896
|
-
function string3(str) {
|
|
6897
|
-
assertString(str);
|
|
6898
|
-
var expected = "'" + str + "'";
|
|
6899
|
-
return Parsimmon(function(input, i) {
|
|
6900
|
-
var j = i + str.length;
|
|
6901
|
-
var head = input.slice(i, j);
|
|
6902
|
-
if (head === str) {
|
|
6903
|
-
return makeSuccess(j, head);
|
|
6904
|
-
} else {
|
|
6905
|
-
return makeFailure(i, expected);
|
|
6906
|
-
}
|
|
6907
|
-
});
|
|
6908
|
-
}
|
|
6909
|
-
function byte(b) {
|
|
6910
|
-
ensureBuffer();
|
|
6911
|
-
assertNumber(b);
|
|
6912
|
-
if (b > 255) {
|
|
6913
|
-
throw new Error("Value specified to byte constructor (" + b + "=0x" + b.toString(16) + ") is larger in value than a single byte.");
|
|
6914
|
-
}
|
|
6915
|
-
var expected = (b > 15 ? "0x" : "0x0") + b.toString(16);
|
|
6916
|
-
return Parsimmon(function(input, i) {
|
|
6917
|
-
var head = get(input, i);
|
|
6918
|
-
if (head === b) {
|
|
6919
|
-
return makeSuccess(i + 1, head);
|
|
6920
|
-
} else {
|
|
6921
|
-
return makeFailure(i, expected);
|
|
6922
|
-
}
|
|
6923
|
-
});
|
|
6924
|
-
}
|
|
6925
|
-
function regexp(re, group) {
|
|
6926
|
-
assertRegexp(re);
|
|
6927
|
-
if (arguments.length >= 2) {
|
|
6928
|
-
assertNumber(group);
|
|
6929
|
-
} else {
|
|
6930
|
-
group = 0;
|
|
6931
|
-
}
|
|
6932
|
-
var anchored = anchoredRegexp(re);
|
|
6933
|
-
var expected = "" + re;
|
|
6934
|
-
return Parsimmon(function(input, i) {
|
|
6935
|
-
var match = anchored.exec(input.slice(i));
|
|
6936
|
-
if (match) {
|
|
6937
|
-
if (0 <= group && group <= match.length) {
|
|
6938
|
-
var fullMatch = match[0];
|
|
6939
|
-
var groupMatch = match[group];
|
|
6940
|
-
return makeSuccess(i + fullMatch.length, groupMatch);
|
|
6941
|
-
}
|
|
6942
|
-
var message = "valid match group (0 to " + match.length + ") in " + expected;
|
|
6943
|
-
return makeFailure(i, message);
|
|
6944
|
-
}
|
|
6945
|
-
return makeFailure(i, expected);
|
|
6946
|
-
});
|
|
6947
|
-
}
|
|
6948
|
-
function succeed(value) {
|
|
6949
|
-
return Parsimmon(function(input, i) {
|
|
6950
|
-
return makeSuccess(i, value);
|
|
6951
|
-
});
|
|
6952
|
-
}
|
|
6953
|
-
function fail(expected) {
|
|
6954
|
-
return Parsimmon(function(input, i) {
|
|
6955
|
-
return makeFailure(i, expected);
|
|
6956
|
-
});
|
|
6957
|
-
}
|
|
6958
|
-
function lookahead(x) {
|
|
6959
|
-
if (isParser(x)) {
|
|
6960
|
-
return Parsimmon(function(input, i) {
|
|
6961
|
-
var result = x._(input, i);
|
|
6962
|
-
result.index = i;
|
|
6963
|
-
result.value = "";
|
|
6964
|
-
return result;
|
|
6965
|
-
});
|
|
6966
|
-
} else if (typeof x === "string") {
|
|
6967
|
-
return lookahead(string3(x));
|
|
6968
|
-
} else if (_instanceof(x, RegExp)) {
|
|
6969
|
-
return lookahead(regexp(x));
|
|
6970
|
-
}
|
|
6971
|
-
throw new Error("not a string, regexp, or parser: " + x);
|
|
6972
|
-
}
|
|
6973
|
-
function notFollowedBy(parser2) {
|
|
6974
|
-
assertParser(parser2);
|
|
6975
|
-
return Parsimmon(function(input, i) {
|
|
6976
|
-
var result = parser2._(input, i);
|
|
6977
|
-
var text3 = input.slice(i, result.index);
|
|
6978
|
-
return result.status ? makeFailure(i, 'not "' + text3 + '"') : makeSuccess(i, null);
|
|
6979
|
-
});
|
|
6980
|
-
}
|
|
6981
|
-
function test(predicate) {
|
|
6982
|
-
assertFunction(predicate);
|
|
6983
|
-
return Parsimmon(function(input, i) {
|
|
6984
|
-
var char = get(input, i);
|
|
6985
|
-
if (i < input.length && predicate(char)) {
|
|
6986
|
-
return makeSuccess(i + 1, char);
|
|
6987
|
-
} else {
|
|
6988
|
-
return makeFailure(i, "a character/byte matching " + predicate);
|
|
6989
|
-
}
|
|
6990
|
-
});
|
|
6991
|
-
}
|
|
6992
|
-
function oneOf(str) {
|
|
6993
|
-
var expected = str.split("");
|
|
6994
|
-
for(var idx = 0; idx < expected.length; idx++){
|
|
6995
|
-
expected[idx] = "'" + expected[idx] + "'";
|
|
6996
|
-
}
|
|
6997
|
-
return test(function(ch) {
|
|
6998
|
-
return str.indexOf(ch) >= 0;
|
|
6999
|
-
}).desc(expected);
|
|
7000
|
-
}
|
|
7001
|
-
function noneOf(str) {
|
|
7002
|
-
return test(function(ch) {
|
|
7003
|
-
return str.indexOf(ch) < 0;
|
|
7004
|
-
}).desc("none of '" + str + "'");
|
|
7005
|
-
}
|
|
7006
|
-
function custom(parsingFunction) {
|
|
7007
|
-
return Parsimmon(parsingFunction(makeSuccess, makeFailure));
|
|
7008
|
-
}
|
|
7009
|
-
function range(begin, end2) {
|
|
7010
|
-
return test(function(ch) {
|
|
7011
|
-
return begin <= ch && ch <= end2;
|
|
7012
|
-
}).desc(begin + "-" + end2);
|
|
7013
|
-
}
|
|
7014
|
-
function takeWhile(predicate) {
|
|
7015
|
-
assertFunction(predicate);
|
|
7016
|
-
return Parsimmon(function(input, i) {
|
|
7017
|
-
var j = i;
|
|
7018
|
-
while(j < input.length && predicate(get(input, j))){
|
|
7019
|
-
j++;
|
|
7020
|
-
}
|
|
7021
|
-
return makeSuccess(j, input.slice(i, j));
|
|
7022
|
-
});
|
|
7023
|
-
}
|
|
7024
|
-
function lazy(desc, f) {
|
|
7025
|
-
if (arguments.length < 2) {
|
|
7026
|
-
f = desc;
|
|
7027
|
-
desc = void 0;
|
|
7028
|
-
}
|
|
7029
|
-
var parser2 = Parsimmon(function(input, i) {
|
|
7030
|
-
parser2._ = f()._;
|
|
7031
|
-
return parser2._(input, i);
|
|
7032
|
-
});
|
|
7033
|
-
if (desc) {
|
|
7034
|
-
return parser2.desc(desc);
|
|
7035
|
-
} else {
|
|
7036
|
-
return parser2;
|
|
7037
|
-
}
|
|
7038
|
-
}
|
|
7039
|
-
function empty() {
|
|
7040
|
-
return fail("fantasy-land/empty");
|
|
7041
|
-
}
|
|
7042
|
-
_.concat = _.or;
|
|
7043
|
-
_.empty = empty;
|
|
7044
|
-
_.of = succeed;
|
|
7045
|
-
_["fantasy-land/ap"] = _.ap;
|
|
7046
|
-
_["fantasy-land/chain"] = _.chain;
|
|
7047
|
-
_["fantasy-land/concat"] = _.concat;
|
|
7048
|
-
_["fantasy-land/empty"] = _.empty;
|
|
7049
|
-
_["fantasy-land/of"] = _.of;
|
|
7050
|
-
_["fantasy-land/map"] = _.map;
|
|
7051
|
-
var index2 = Parsimmon(function(input, i) {
|
|
7052
|
-
return makeSuccess(i, makeLineColumnIndex(input, i));
|
|
7053
|
-
});
|
|
7054
|
-
var any = Parsimmon(function(input, i) {
|
|
7055
|
-
if (i >= input.length) {
|
|
7056
|
-
return makeFailure(i, "any character/byte");
|
|
7057
|
-
}
|
|
7058
|
-
return makeSuccess(i + 1, get(input, i));
|
|
7059
|
-
});
|
|
7060
|
-
var all2 = Parsimmon(function(input, i) {
|
|
7061
|
-
return makeSuccess(input.length, input.slice(i));
|
|
7062
|
-
});
|
|
7063
|
-
var eof = Parsimmon(function(input, i) {
|
|
7064
|
-
if (i < input.length) {
|
|
7065
|
-
return makeFailure(i, "EOF");
|
|
7066
|
-
}
|
|
7067
|
-
return makeSuccess(i, null);
|
|
7068
|
-
});
|
|
7069
|
-
var digit = regexp(/[0-9]/).desc("a digit");
|
|
7070
|
-
var digits = regexp(/[0-9]*/).desc("optional digits");
|
|
7071
|
-
var letter = regexp(/[a-z]/i).desc("a letter");
|
|
7072
|
-
var letters = regexp(/[a-z]*/i).desc("optional letters");
|
|
7073
|
-
var optWhitespace = regexp(/\s*/).desc("optional whitespace");
|
|
7074
|
-
var whitespace = regexp(/\s+/).desc("whitespace");
|
|
7075
|
-
var cr = string3("\r");
|
|
7076
|
-
var lf = string3("\n");
|
|
7077
|
-
var crlf = string3("\r\n");
|
|
7078
|
-
var newline = alt(crlf, lf, cr).desc("newline");
|
|
7079
|
-
var end = alt(newline, eof);
|
|
7080
|
-
Parsimmon.all = all2;
|
|
7081
|
-
Parsimmon.alt = alt;
|
|
7082
|
-
Parsimmon.any = any;
|
|
7083
|
-
Parsimmon.cr = cr;
|
|
7084
|
-
Parsimmon.createLanguage = createLanguage;
|
|
7085
|
-
Parsimmon.crlf = crlf;
|
|
7086
|
-
Parsimmon.custom = custom;
|
|
7087
|
-
Parsimmon.digit = digit;
|
|
7088
|
-
Parsimmon.digits = digits;
|
|
7089
|
-
Parsimmon.empty = empty;
|
|
7090
|
-
Parsimmon.end = end;
|
|
7091
|
-
Parsimmon.eof = eof;
|
|
7092
|
-
Parsimmon.fail = fail;
|
|
7093
|
-
Parsimmon.formatError = formatError;
|
|
7094
|
-
Parsimmon.index = index2;
|
|
7095
|
-
Parsimmon.isParser = isParser;
|
|
7096
|
-
Parsimmon.lazy = lazy;
|
|
7097
|
-
Parsimmon.letter = letter;
|
|
7098
|
-
Parsimmon.letters = letters;
|
|
7099
|
-
Parsimmon.lf = lf;
|
|
7100
|
-
Parsimmon.lookahead = lookahead;
|
|
7101
|
-
Parsimmon.makeFailure = makeFailure;
|
|
7102
|
-
Parsimmon.makeSuccess = makeSuccess;
|
|
7103
|
-
Parsimmon.newline = newline;
|
|
7104
|
-
Parsimmon.noneOf = noneOf;
|
|
7105
|
-
Parsimmon.notFollowedBy = notFollowedBy;
|
|
7106
|
-
Parsimmon.of = succeed;
|
|
7107
|
-
Parsimmon.oneOf = oneOf;
|
|
7108
|
-
Parsimmon.optWhitespace = optWhitespace;
|
|
7109
|
-
Parsimmon.Parser = Parsimmon;
|
|
7110
|
-
Parsimmon.range = range;
|
|
7111
|
-
Parsimmon.regex = regexp;
|
|
7112
|
-
Parsimmon.regexp = regexp;
|
|
7113
|
-
Parsimmon.sepBy = sepBy;
|
|
7114
|
-
Parsimmon.sepBy1 = sepBy1;
|
|
7115
|
-
Parsimmon.seq = seq;
|
|
7116
|
-
Parsimmon.seqMap = seqMap;
|
|
7117
|
-
Parsimmon.seqObj = seqObj;
|
|
7118
|
-
Parsimmon.string = string3;
|
|
7119
|
-
Parsimmon.succeed = succeed;
|
|
7120
|
-
Parsimmon.takeWhile = takeWhile;
|
|
7121
|
-
Parsimmon.test = test;
|
|
7122
|
-
Parsimmon.whitespace = whitespace;
|
|
7123
|
-
Parsimmon["fantasy-land/empty"] = empty;
|
|
7124
|
-
Parsimmon["fantasy-land/of"] = succeed;
|
|
7125
|
-
Parsimmon.Binary = {
|
|
7126
|
-
bitSeq: bitSeq,
|
|
7127
|
-
bitSeqObj: bitSeqObj,
|
|
7128
|
-
byte: byte,
|
|
7129
|
-
buffer: parseBuffer,
|
|
7130
|
-
encodedString: encodedString,
|
|
7131
|
-
uintBE: uintBE,
|
|
7132
|
-
uint8BE: uintBE(1),
|
|
7133
|
-
uint16BE: uintBE(2),
|
|
7134
|
-
uint32BE: uintBE(4),
|
|
7135
|
-
uintLE: uintLE,
|
|
7136
|
-
uint8LE: uintLE(1),
|
|
7137
|
-
uint16LE: uintLE(2),
|
|
7138
|
-
uint32LE: uintLE(4),
|
|
7139
|
-
intBE: intBE,
|
|
7140
|
-
int8BE: intBE(1),
|
|
7141
|
-
int16BE: intBE(2),
|
|
7142
|
-
int32BE: intBE(4),
|
|
7143
|
-
intLE: intLE,
|
|
7144
|
-
int8LE: intLE(1),
|
|
7145
|
-
int16LE: intLE(2),
|
|
7146
|
-
int32LE: intLE(4),
|
|
7147
|
-
floatBE: floatBE(),
|
|
7148
|
-
floatLE: floatLE(),
|
|
7149
|
-
doubleBE: doubleBE(),
|
|
7150
|
-
doubleLE: doubleLE()
|
|
7151
|
-
};
|
|
7152
|
-
module.exports = Parsimmon;
|
|
7153
|
-
}
|
|
7154
|
-
});
|
|
7155
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/TokenError.js
|
|
7156
|
-
var require_TokenError = __commonJS({
|
|
7157
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/TokenError.js": function(exports) {
|
|
7158
|
-
"use strict";
|
|
7159
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7160
|
-
value: true
|
|
7161
|
-
});
|
|
7162
|
-
exports.TokenError = void 0;
|
|
7163
|
-
var TokenError = /*#__PURE__*/ function(Error1) {
|
|
7164
|
-
_inherits(TokenError, Error1);
|
|
7165
|
-
var _super = _create_super(TokenError);
|
|
7166
|
-
function TokenError(message, token) {
|
|
7167
|
-
_class_call_check(this, TokenError);
|
|
7168
|
-
var _this;
|
|
7169
|
-
_this = _super.call(this, message);
|
|
7170
|
-
_this.message = message;
|
|
7171
|
-
_this.token = token;
|
|
7172
|
-
if (token && token.errors) token.errors.push(_assert_this_initialized(_this));
|
|
7173
|
-
else throw _assert_this_initialized(_this);
|
|
7174
|
-
return _this;
|
|
7175
|
-
}
|
|
7176
|
-
_create_class(TokenError, [
|
|
7177
|
-
{
|
|
7178
|
-
key: "inspect",
|
|
7179
|
-
value: function inspect() {
|
|
7180
|
-
return "SyntaxError: " + this.message;
|
|
7181
|
-
}
|
|
7182
|
-
}
|
|
7183
|
-
]);
|
|
7184
|
-
return TokenError;
|
|
7185
|
-
}(_wrap_native_super(Error));
|
|
7186
|
-
exports.TokenError = TokenError;
|
|
7187
|
-
}
|
|
7188
|
-
});
|
|
7189
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Parser.js
|
|
7190
|
-
var require_Parser = __commonJS({
|
|
7191
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Parser.js": function(exports) {
|
|
7192
|
-
"use strict";
|
|
7193
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7194
|
-
value: true
|
|
7195
|
-
});
|
|
7196
|
-
exports.Parser = exports.findRuleByName = exports.parseRuleName = exports.escapeRegExp = exports.readToken = void 0;
|
|
7197
|
-
var UPPER_SNAKE_RE = /^[A-Z0-9_]+$/;
|
|
7198
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
7199
|
-
var preDecorationRE = /^(@|&|!)/;
|
|
7200
|
-
var WS_RULE = "WS";
|
|
7201
|
-
var TokenError_1 = require_TokenError();
|
|
7202
|
-
function readToken(txt, expr) {
|
|
7203
|
-
var result = expr.exec(txt);
|
|
7204
|
-
if (result && result.index == 0) {
|
|
7205
|
-
if (result[0].length == 0 && expr.source.length > 0) return null;
|
|
7206
|
-
return {
|
|
7207
|
-
type: null,
|
|
7208
|
-
text: result[0],
|
|
7209
|
-
rest: txt.substr(result[0].length),
|
|
7210
|
-
start: 0,
|
|
7211
|
-
end: result[0].length - 1,
|
|
7212
|
-
fullText: result[0],
|
|
7213
|
-
errors: [],
|
|
7214
|
-
children: [],
|
|
7215
|
-
parent: null
|
|
7216
|
-
};
|
|
7217
|
-
}
|
|
7218
|
-
return null;
|
|
7219
|
-
}
|
|
7220
|
-
exports.readToken = readToken;
|
|
7221
|
-
function escapeRegExp(str) {
|
|
7222
|
-
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
7223
|
-
}
|
|
7224
|
-
exports.escapeRegExp = escapeRegExp;
|
|
7225
|
-
function fixRest(token) {
|
|
7226
|
-
token.rest = "";
|
|
7227
|
-
token.children && token.children.forEach(function(c) {
|
|
7228
|
-
return fixRest(c);
|
|
7229
|
-
});
|
|
7230
|
-
}
|
|
7231
|
-
function fixPositions(token, start) {
|
|
7232
|
-
token.start += start;
|
|
7233
|
-
token.end += start;
|
|
7234
|
-
token.children && token.children.forEach(function(c) {
|
|
7235
|
-
return fixPositions(c, token.start);
|
|
7236
|
-
});
|
|
7237
|
-
}
|
|
7238
|
-
function agregateErrors(errors, token) {
|
|
7239
|
-
if (token.errors && token.errors.length) token.errors.forEach(function(err) {
|
|
7240
|
-
return errors.push(err);
|
|
7241
|
-
});
|
|
7242
|
-
token.children && token.children.forEach(function(tok) {
|
|
7243
|
-
return agregateErrors(errors, tok);
|
|
7244
|
-
});
|
|
7245
|
-
}
|
|
7246
|
-
function parseRuleName(name) {
|
|
7247
|
-
var postDecoration = decorationRE.exec(name);
|
|
7248
|
-
var preDecoration = preDecorationRE.exec(name);
|
|
7249
|
-
var postDecorationText = postDecoration && postDecoration[0] || "";
|
|
7250
|
-
var preDecorationText = preDecoration && preDecoration[0] || "";
|
|
7251
|
-
var out = {
|
|
7252
|
-
raw: name,
|
|
7253
|
-
name: name.replace(decorationRE, "").replace(preDecorationRE, ""),
|
|
7254
|
-
isOptional: postDecorationText == "?" || postDecorationText == "*",
|
|
7255
|
-
allowRepetition: postDecorationText == "+" || postDecorationText == "*",
|
|
7256
|
-
atLeastOne: postDecorationText == "+",
|
|
7257
|
-
lookupPositive: preDecorationText == "&",
|
|
7258
|
-
lookupNegative: preDecorationText == "!",
|
|
7259
|
-
pinned: preDecorationText == "@",
|
|
7260
|
-
lookup: false,
|
|
7261
|
-
isLiteral: false
|
|
7262
|
-
};
|
|
7263
|
-
out.isLiteral = out.name[0] == "'" || out.name[0] == '"';
|
|
7264
|
-
out.lookup = out.lookupNegative || out.lookupPositive;
|
|
7265
|
-
return out;
|
|
7266
|
-
}
|
|
7267
|
-
exports.parseRuleName = parseRuleName;
|
|
7268
|
-
function findRuleByName(name, parser2) {
|
|
7269
|
-
var parsed = parseRuleName(name);
|
|
7270
|
-
return parser2.cachedRules[parsed.name] || null;
|
|
7271
|
-
}
|
|
7272
|
-
exports.findRuleByName = findRuleByName;
|
|
7273
|
-
function stripRules(token, re) {
|
|
7274
|
-
if (token.children) {
|
|
7275
|
-
var localRules = token.children.filter(function(x) {
|
|
7276
|
-
return x.type && re.test(x.type);
|
|
7277
|
-
});
|
|
7278
|
-
for(var i = 0; i < localRules.length; i++){
|
|
7279
|
-
var indexOnChildren = token.children.indexOf(localRules[i]);
|
|
7280
|
-
if (indexOnChildren != -1) {
|
|
7281
|
-
token.children.splice(indexOnChildren, 1);
|
|
7282
|
-
}
|
|
7283
|
-
}
|
|
7284
|
-
token.children.forEach(function(c) {
|
|
7285
|
-
return stripRules(c, re);
|
|
7286
|
-
});
|
|
7287
|
-
}
|
|
7288
|
-
}
|
|
7289
|
-
var ignoreMissingRules = [
|
|
7290
|
-
"EOF"
|
|
7291
|
-
];
|
|
7292
|
-
var Parser2 = /*#__PURE__*/ function() {
|
|
7293
|
-
function Parser2(grammarRules, options) {
|
|
7294
|
-
var _this = this;
|
|
7295
|
-
_class_call_check(this, Parser2);
|
|
7296
|
-
this.grammarRules = grammarRules;
|
|
7297
|
-
this.options = options;
|
|
7298
|
-
this.cachedRules = {};
|
|
7299
|
-
this.debug = options ? options.debug === true : false;
|
|
7300
|
-
var errors = [];
|
|
7301
|
-
var neededRules = [];
|
|
7302
|
-
grammarRules.forEach(function(rule) {
|
|
7303
|
-
var parsedName = parseRuleName(rule.name);
|
|
7304
|
-
if (parsedName.name in _this.cachedRules) {
|
|
7305
|
-
errors.push("Duplicated rule " + parsedName.name);
|
|
7306
|
-
return;
|
|
7307
|
-
} else {
|
|
7308
|
-
_this.cachedRules[parsedName.name] = rule;
|
|
7309
|
-
}
|
|
7310
|
-
if (!rule.bnf || !rule.bnf.length) {
|
|
7311
|
-
var error = "Missing rule content, rule: " + rule.name;
|
|
7312
|
-
if (errors.indexOf(error) == -1) errors.push(error);
|
|
7313
|
-
} else {
|
|
7314
|
-
rule.bnf.forEach(function(options2) {
|
|
7315
|
-
if (typeof options2[0] === "string") {
|
|
7316
|
-
var parsed = parseRuleName(options2[0]);
|
|
7317
|
-
if (parsed.name == rule.name) {
|
|
7318
|
-
var error = "Left recursion is not allowed, rule: " + rule.name;
|
|
7319
|
-
if (errors.indexOf(error) == -1) errors.push(error);
|
|
7320
|
-
}
|
|
7321
|
-
}
|
|
7322
|
-
options2.forEach(function(option) {
|
|
7323
|
-
if (typeof option == "string") {
|
|
7324
|
-
var name = parseRuleName(option);
|
|
7325
|
-
if (!name.isLiteral && neededRules.indexOf(name.name) == -1 && ignoreMissingRules.indexOf(name.name) == -1) neededRules.push(name.name);
|
|
7326
|
-
}
|
|
7327
|
-
});
|
|
7328
|
-
});
|
|
7329
|
-
}
|
|
7330
|
-
if (WS_RULE == rule.name) rule.implicitWs = false;
|
|
7331
|
-
if (rule.implicitWs) {
|
|
7332
|
-
if (neededRules.indexOf(WS_RULE) == -1) neededRules.push(WS_RULE);
|
|
7333
|
-
}
|
|
7334
|
-
if (rule.recover) {
|
|
7335
|
-
if (neededRules.indexOf(rule.recover) == -1) neededRules.push(rule.recover);
|
|
7336
|
-
}
|
|
7337
|
-
});
|
|
7338
|
-
neededRules.forEach(function(ruleName) {
|
|
7339
|
-
if (!(ruleName in _this.cachedRules)) {
|
|
7340
|
-
errors.push("Missing rule " + ruleName);
|
|
7341
|
-
}
|
|
7342
|
-
});
|
|
7343
|
-
if (errors.length) throw new Error(errors.join("\n"));
|
|
7344
|
-
}
|
|
7345
|
-
_create_class(Parser2, [
|
|
7346
|
-
{
|
|
7347
|
-
key: "getAST",
|
|
7348
|
-
value: function getAST(txt, target) {
|
|
7349
|
-
if (!target) {
|
|
7350
|
-
target = this.grammarRules.filter(function(x) {
|
|
7351
|
-
return !x.fragment && x.name.indexOf("%") != 0;
|
|
7352
|
-
})[0].name;
|
|
7353
|
-
}
|
|
7354
|
-
var result = this.parse(txt, target);
|
|
7355
|
-
if (result) {
|
|
7356
|
-
agregateErrors(result.errors, result);
|
|
7357
|
-
fixPositions(result, 0);
|
|
7358
|
-
stripRules(result, /^%/);
|
|
7359
|
-
if (!this.options || !this.options.keepUpperRules) stripRules(result, UPPER_SNAKE_RE);
|
|
7360
|
-
var rest = result.rest;
|
|
7361
|
-
if (rest) {
|
|
7362
|
-
new TokenError_1.TokenError("Unexpected end of input: \n" + rest, result);
|
|
7363
|
-
}
|
|
7364
|
-
fixRest(result);
|
|
7365
|
-
result.rest = rest;
|
|
7366
|
-
}
|
|
7367
|
-
return result;
|
|
7368
|
-
}
|
|
7369
|
-
},
|
|
7370
|
-
{
|
|
7371
|
-
key: "emitSource",
|
|
7372
|
-
value: function emitSource() {
|
|
7373
|
-
return "CANNOT EMIT SOURCE FROM BASE Parser";
|
|
7374
|
-
}
|
|
7375
|
-
},
|
|
7376
|
-
{
|
|
7377
|
-
key: "parse",
|
|
7378
|
-
value: function parse(txt, target) {
|
|
7379
|
-
var _this = this;
|
|
7380
|
-
var recursion = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
7381
|
-
var out = null;
|
|
7382
|
-
var type = parseRuleName(target);
|
|
7383
|
-
var expr;
|
|
7384
|
-
var printable = this.debug && /*!isLiteral &*/ !UPPER_SNAKE_RE.test(type.name);
|
|
7385
|
-
printable && console.log(new Array(recursion).join("\u2502 ") + "Trying to get " + target + " from " + JSON.stringify(txt.split("\n")[0]));
|
|
7386
|
-
var realType = type.name;
|
|
7387
|
-
var targetLex = findRuleByName(type.name, this);
|
|
7388
|
-
if (type.name == "EOF") {
|
|
7389
|
-
if (txt.length) {
|
|
7390
|
-
return null;
|
|
7391
|
-
} else if (txt.length == 0) {
|
|
7392
|
-
return {
|
|
7393
|
-
type: "EOF",
|
|
7394
|
-
text: "",
|
|
7395
|
-
rest: "",
|
|
7396
|
-
start: 0,
|
|
7397
|
-
end: 0,
|
|
7398
|
-
fullText: "",
|
|
7399
|
-
errors: [],
|
|
7400
|
-
children: [],
|
|
7401
|
-
parent: null
|
|
7402
|
-
};
|
|
7403
|
-
}
|
|
7404
|
-
}
|
|
7405
|
-
try {
|
|
7406
|
-
if (!targetLex && type.isLiteral) {
|
|
7407
|
-
var src = type.name.trim();
|
|
7408
|
-
if (src.startsWith('"')) {
|
|
7409
|
-
src = JSON.parse(src);
|
|
7410
|
-
} else if (src.startsWith("'")) {
|
|
7411
|
-
src = src.replace(/^'(.+)'$/, "$1").replace(/\\'/g, "'");
|
|
7412
|
-
}
|
|
7413
|
-
if (src === "") {
|
|
7414
|
-
return {
|
|
7415
|
-
type: "%%EMPTY%%",
|
|
7416
|
-
text: "",
|
|
7417
|
-
rest: txt,
|
|
7418
|
-
start: 0,
|
|
7419
|
-
end: 0,
|
|
7420
|
-
fullText: "",
|
|
7421
|
-
errors: [],
|
|
7422
|
-
children: [],
|
|
7423
|
-
parent: null
|
|
7424
|
-
};
|
|
7425
|
-
}
|
|
7426
|
-
expr = new RegExp(escapeRegExp(src));
|
|
7427
|
-
realType = null;
|
|
7428
|
-
}
|
|
7429
|
-
} catch (e) {
|
|
7430
|
-
if (_instanceof(e, ReferenceError)) {
|
|
7431
|
-
console.error(e);
|
|
7432
|
-
}
|
|
7433
|
-
return null;
|
|
7434
|
-
}
|
|
7435
|
-
if (expr) {
|
|
7436
|
-
var result = readToken(txt, expr);
|
|
7437
|
-
if (result) {
|
|
7438
|
-
result.type = realType;
|
|
7439
|
-
return result;
|
|
7440
|
-
}
|
|
7441
|
-
} else {
|
|
7442
|
-
var options = targetLex.bnf;
|
|
7443
|
-
if (_instanceof(options, Array)) {
|
|
7444
|
-
options.forEach(function(phases) {
|
|
7445
|
-
var _loop = function(i) {
|
|
7446
|
-
if (typeof phases[i] == "string") {
|
|
7447
|
-
var _loop = function() {
|
|
7448
|
-
got = null;
|
|
7449
|
-
if (targetLex.implicitWs) {
|
|
7450
|
-
got = _this.parse(tmpTxt, localTarget.name, recursion + 1);
|
|
7451
|
-
if (!got) {
|
|
7452
|
-
var WS = void 0;
|
|
7453
|
-
do {
|
|
7454
|
-
WS = _this.parse(tmpTxt, WS_RULE, recursion + 1);
|
|
7455
|
-
if (WS) {
|
|
7456
|
-
tmp.text = tmp.text + WS.text;
|
|
7457
|
-
tmp.end = tmp.text.length;
|
|
7458
|
-
WS.parent = tmp;
|
|
7459
|
-
tmp.children.push(WS);
|
|
7460
|
-
tmpTxt = tmpTxt.substr(WS.text.length);
|
|
7461
|
-
position2 += WS.text.length;
|
|
7462
|
-
} else {
|
|
7463
|
-
break;
|
|
7464
|
-
}
|
|
7465
|
-
}while (WS && WS.text.length);
|
|
7466
|
-
}
|
|
7467
|
-
}
|
|
7468
|
-
got = got || _this.parse(tmpTxt, localTarget.name, recursion + 1);
|
|
7469
|
-
if (localTarget.lookupNegative) {
|
|
7470
|
-
if (got) return {
|
|
7471
|
-
v: void void 0
|
|
7472
|
-
};
|
|
7473
|
-
return "break";
|
|
7474
|
-
}
|
|
7475
|
-
if (localTarget.lookupPositive) {
|
|
7476
|
-
if (!got) return {
|
|
7477
|
-
v: void void 0
|
|
7478
|
-
};
|
|
7479
|
-
}
|
|
7480
|
-
if (!got) {
|
|
7481
|
-
if (localTarget.isOptional) return "break";
|
|
7482
|
-
if (localTarget.atLeastOne && foundAtLeastOne) return "break";
|
|
7483
|
-
}
|
|
7484
|
-
if (got && targetLex.pinned == i + 1) {
|
|
7485
|
-
pinned = got;
|
|
7486
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " PINNED");
|
|
7487
|
-
}
|
|
7488
|
-
if (!got) got = _this.parseRecovery(targetLex, tmpTxt, recursion + 1);
|
|
7489
|
-
if (!got) {
|
|
7490
|
-
if (pinned) {
|
|
7491
|
-
out = tmp;
|
|
7492
|
-
got = {
|
|
7493
|
-
type: "SyntaxError",
|
|
7494
|
-
text: tmpTxt,
|
|
7495
|
-
children: [],
|
|
7496
|
-
end: tmpTxt.length,
|
|
7497
|
-
errors: [],
|
|
7498
|
-
fullText: "",
|
|
7499
|
-
parent: null,
|
|
7500
|
-
start: 0,
|
|
7501
|
-
rest: ""
|
|
7502
|
-
};
|
|
7503
|
-
if (tmpTxt.length) {
|
|
7504
|
-
new TokenError_1.TokenError("Unexpected end of input. Expecting ".concat(localTarget.name, " Got: ").concat(tmpTxt), got);
|
|
7505
|
-
} else {
|
|
7506
|
-
new TokenError_1.TokenError("Unexpected end of input. Missing ".concat(localTarget.name), got);
|
|
7507
|
-
}
|
|
7508
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text));
|
|
7509
|
-
} else {
|
|
7510
|
-
return {
|
|
7511
|
-
v: void void 0
|
|
7512
|
-
};
|
|
7513
|
-
}
|
|
7514
|
-
}
|
|
7515
|
-
foundAtLeastOne = true;
|
|
7516
|
-
foundSomething = true;
|
|
7517
|
-
if (got.type == "%%EMPTY%%") {
|
|
7518
|
-
return "break";
|
|
7519
|
-
}
|
|
7520
|
-
got.start += position2;
|
|
7521
|
-
got.end += position2;
|
|
7522
|
-
if (!localTarget.lookupPositive && got.type) {
|
|
7523
|
-
if (got.fragment) {
|
|
7524
|
-
got.children && got.children.forEach(function(x) {
|
|
7525
|
-
x.start += position2;
|
|
7526
|
-
x.end += position2;
|
|
7527
|
-
x.parent = tmp;
|
|
7528
|
-
tmp.children.push(x);
|
|
7529
|
-
});
|
|
7530
|
-
} else {
|
|
7531
|
-
got.parent = tmp;
|
|
7532
|
-
tmp.children.push(got);
|
|
7533
|
-
}
|
|
7534
|
-
}
|
|
7535
|
-
if (localTarget.lookup) got.lookup = true;
|
|
7536
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text));
|
|
7537
|
-
if (!localTarget.lookup && !got.lookup) {
|
|
7538
|
-
tmp.text = tmp.text + got.text;
|
|
7539
|
-
tmp.end = tmp.text.length;
|
|
7540
|
-
tmpTxt = tmpTxt.substr(got.text.length);
|
|
7541
|
-
position2 += got.text.length;
|
|
7542
|
-
}
|
|
7543
|
-
tmp.rest = tmpTxt;
|
|
7544
|
-
};
|
|
7545
|
-
var localTarget = parseRuleName(phases[i]);
|
|
7546
|
-
allOptional = allOptional && localTarget.isOptional;
|
|
7547
|
-
var got = void 0;
|
|
7548
|
-
var foundAtLeastOne = false;
|
|
7549
|
-
do {
|
|
7550
|
-
var _ret = _loop();
|
|
7551
|
-
if (_type_of(_ret) === "object") return {
|
|
7552
|
-
v: _ret.v
|
|
7553
|
-
};
|
|
7554
|
-
if (_ret === "break") break;
|
|
7555
|
-
}while (got && localTarget.allowRepetition && tmpTxt.length && !got.lookup);
|
|
7556
|
-
} else {
|
|
7557
|
-
var got1 = readToken(tmpTxt, phases[i]);
|
|
7558
|
-
if (!got1) {
|
|
7559
|
-
return {
|
|
7560
|
-
v: void void 0
|
|
7561
|
-
};
|
|
7562
|
-
}
|
|
7563
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514> " + JSON.stringify(got1.text) + phases[i].source);
|
|
7564
|
-
foundSomething = true;
|
|
7565
|
-
got1.start += position2;
|
|
7566
|
-
got1.end += position2;
|
|
7567
|
-
tmp.text = tmp.text + got1.text;
|
|
7568
|
-
tmp.end = tmp.text.length;
|
|
7569
|
-
tmpTxt = tmpTxt.substr(got1.text.length);
|
|
7570
|
-
position2 += got1.text.length;
|
|
7571
|
-
tmp.rest = tmpTxt;
|
|
7572
|
-
}
|
|
7573
|
-
};
|
|
7574
|
-
if (out) return;
|
|
7575
|
-
var pinned = null;
|
|
7576
|
-
var tmp = {
|
|
7577
|
-
type: type.name,
|
|
7578
|
-
text: "",
|
|
7579
|
-
children: [],
|
|
7580
|
-
end: 0,
|
|
7581
|
-
errors: [],
|
|
7582
|
-
fullText: "",
|
|
7583
|
-
parent: null,
|
|
7584
|
-
start: 0,
|
|
7585
|
-
rest: txt
|
|
7586
|
-
};
|
|
7587
|
-
if (targetLex.fragment) tmp.fragment = true;
|
|
7588
|
-
var tmpTxt = txt;
|
|
7589
|
-
var position2 = 0;
|
|
7590
|
-
var allOptional = phases.length > 0;
|
|
7591
|
-
var foundSomething = false;
|
|
7592
|
-
for(var i = 0; i < phases.length; i++){
|
|
7593
|
-
var _ret = _loop(i);
|
|
7594
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
7595
|
-
}
|
|
7596
|
-
if (foundSomething) {
|
|
7597
|
-
out = tmp;
|
|
7598
|
-
printable && console.log(new Array(recursion).join("\u2502 ") + "\u251C<\u2500\u2534< PUSHING " + out.type + " " + JSON.stringify(out.text));
|
|
7599
|
-
}
|
|
7600
|
-
});
|
|
7601
|
-
}
|
|
7602
|
-
if (out && targetLex.simplifyWhenOneChildren && out.children.length == 1) {
|
|
7603
|
-
out = out.children[0];
|
|
7604
|
-
}
|
|
7605
|
-
}
|
|
7606
|
-
if (!out) {
|
|
7607
|
-
printable && console.log(target + " NOT RESOLVED FROM " + txt);
|
|
7608
|
-
}
|
|
7609
|
-
return out;
|
|
7610
|
-
}
|
|
7611
|
-
},
|
|
7612
|
-
{
|
|
7613
|
-
key: "parseRecovery",
|
|
7614
|
-
value: function parseRecovery(recoverableToken, tmpTxt, recursion) {
|
|
7615
|
-
if (recoverableToken.recover && tmpTxt.length) {
|
|
7616
|
-
var printable = this.debug;
|
|
7617
|
-
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]));
|
|
7618
|
-
var tmp = {
|
|
7619
|
-
type: "SyntaxError",
|
|
7620
|
-
text: "",
|
|
7621
|
-
children: [],
|
|
7622
|
-
end: 0,
|
|
7623
|
-
errors: [],
|
|
7624
|
-
fullText: "",
|
|
7625
|
-
parent: null,
|
|
7626
|
-
start: 0,
|
|
7627
|
-
rest: ""
|
|
7628
|
-
};
|
|
7629
|
-
var got;
|
|
7630
|
-
do {
|
|
7631
|
-
got = this.parse(tmpTxt, recoverableToken.recover, recursion + 1);
|
|
7632
|
-
if (got) {
|
|
7633
|
-
new TokenError_1.TokenError('Unexpected input: "' + tmp.text + '" Expecting: '.concat(recoverableToken.name), tmp);
|
|
7634
|
-
break;
|
|
7635
|
-
} else {
|
|
7636
|
-
tmp.text = tmp.text + tmpTxt[0];
|
|
7637
|
-
tmp.end = tmp.text.length;
|
|
7638
|
-
tmpTxt = tmpTxt.substr(1);
|
|
7639
|
-
}
|
|
7640
|
-
}while (!got && tmpTxt.length > 0);
|
|
7641
|
-
if (tmp.text.length > 0 && got) {
|
|
7642
|
-
printable && console.log(new Array(recursion + 1).join("\u2502 ") + "Recovered text: " + JSON.stringify(tmp.text));
|
|
7643
|
-
return tmp;
|
|
7644
|
-
}
|
|
7645
|
-
}
|
|
7646
|
-
return null;
|
|
7647
|
-
}
|
|
7648
|
-
}
|
|
7649
|
-
]);
|
|
7650
|
-
return Parser2;
|
|
7651
|
-
}();
|
|
7652
|
-
exports.Parser = Parser2;
|
|
7653
|
-
exports.default = Parser2;
|
|
7654
|
-
}
|
|
7655
|
-
});
|
|
7656
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/SemanticHelpers.js
|
|
7657
|
-
var require_SemanticHelpers = __commonJS({
|
|
7658
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/SemanticHelpers.js": function(exports) {
|
|
7659
|
-
"use strict";
|
|
7660
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7661
|
-
value: true
|
|
7662
|
-
});
|
|
7663
|
-
exports.findChildrenByType = void 0;
|
|
7664
|
-
function findChildrenByType(token, type) {
|
|
7665
|
-
return token.children ? token.children.filter(function(x) {
|
|
7666
|
-
return x.type == type;
|
|
7667
|
-
}) : [];
|
|
7668
|
-
}
|
|
7669
|
-
exports.findChildrenByType = findChildrenByType;
|
|
7670
|
-
}
|
|
7671
|
-
});
|
|
7672
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/BNF.js
|
|
7673
|
-
var require_BNF = __commonJS({
|
|
7674
|
-
"../../../../../../../../../../../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) {
|
|
7675
|
-
"use strict";
|
|
7676
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7677
|
-
value: true
|
|
7678
|
-
});
|
|
7679
|
-
var SemanticHelpers_1 = require_SemanticHelpers();
|
|
7680
|
-
var Parser_1 = require_Parser();
|
|
7681
|
-
var BNF;
|
|
7682
|
-
(function(BNF2) {
|
|
7683
|
-
BNF2.RULES = [
|
|
7684
|
-
{
|
|
7685
|
-
name: "syntax",
|
|
7686
|
-
bnf: [
|
|
7687
|
-
[
|
|
7688
|
-
"RULE_EOL*",
|
|
7689
|
-
"rule+"
|
|
7690
|
-
]
|
|
7691
|
-
]
|
|
7692
|
-
},
|
|
7693
|
-
{
|
|
7694
|
-
name: "rule",
|
|
7695
|
-
bnf: [
|
|
7696
|
-
[
|
|
7697
|
-
'" "*',
|
|
7698
|
-
'"<"',
|
|
7699
|
-
"rule-name",
|
|
7700
|
-
'">"',
|
|
7701
|
-
'" "*',
|
|
7702
|
-
'"::="',
|
|
7703
|
-
"firstExpression",
|
|
7704
|
-
"otherExpression*",
|
|
7705
|
-
'" "*',
|
|
7706
|
-
"RULE_EOL+",
|
|
7707
|
-
'" "*'
|
|
7708
|
-
]
|
|
7709
|
-
]
|
|
7710
|
-
},
|
|
7711
|
-
{
|
|
7712
|
-
name: "firstExpression",
|
|
7713
|
-
bnf: [
|
|
7714
|
-
[
|
|
7715
|
-
'" "*',
|
|
7716
|
-
"list"
|
|
7717
|
-
]
|
|
7718
|
-
]
|
|
7719
|
-
},
|
|
7720
|
-
{
|
|
7721
|
-
name: "otherExpression",
|
|
7722
|
-
bnf: [
|
|
7723
|
-
[
|
|
7724
|
-
'" "*',
|
|
7725
|
-
'"|"',
|
|
7726
|
-
'" "*',
|
|
7727
|
-
"list"
|
|
7728
|
-
]
|
|
7729
|
-
]
|
|
7730
|
-
},
|
|
7731
|
-
{
|
|
7732
|
-
name: "RULE_EOL",
|
|
7733
|
-
bnf: [
|
|
7734
|
-
[
|
|
7735
|
-
'"\\r"'
|
|
7736
|
-
],
|
|
7737
|
-
[
|
|
7738
|
-
'"\\n"'
|
|
7739
|
-
]
|
|
7740
|
-
]
|
|
7741
|
-
},
|
|
7742
|
-
{
|
|
7743
|
-
name: "list",
|
|
7744
|
-
bnf: [
|
|
7745
|
-
[
|
|
7746
|
-
"term",
|
|
7747
|
-
'" "*',
|
|
7748
|
-
"list"
|
|
7749
|
-
],
|
|
7750
|
-
[
|
|
7751
|
-
"term"
|
|
7752
|
-
]
|
|
7753
|
-
]
|
|
7754
|
-
},
|
|
7755
|
-
{
|
|
7756
|
-
name: "term",
|
|
7757
|
-
bnf: [
|
|
7758
|
-
[
|
|
7759
|
-
"literal"
|
|
7760
|
-
],
|
|
7761
|
-
[
|
|
7762
|
-
'"<"',
|
|
7763
|
-
"rule-name",
|
|
7764
|
-
'">"'
|
|
7765
|
-
]
|
|
7766
|
-
]
|
|
7767
|
-
},
|
|
7768
|
-
{
|
|
7769
|
-
name: "literal",
|
|
7770
|
-
bnf: [
|
|
7771
|
-
[
|
|
7772
|
-
"'\"'",
|
|
7773
|
-
"RULE_CHARACTER1*",
|
|
7774
|
-
"'\"'"
|
|
7775
|
-
],
|
|
7776
|
-
[
|
|
7777
|
-
'"\'"',
|
|
7778
|
-
"RULE_CHARACTER2*",
|
|
7779
|
-
'"\'"'
|
|
7780
|
-
]
|
|
7781
|
-
]
|
|
7782
|
-
},
|
|
7783
|
-
{
|
|
7784
|
-
name: "RULE_CHARACTER",
|
|
7785
|
-
bnf: [
|
|
7786
|
-
[
|
|
7787
|
-
'" "'
|
|
7788
|
-
],
|
|
7789
|
-
[
|
|
7790
|
-
"RULE_LETTER"
|
|
7791
|
-
],
|
|
7792
|
-
[
|
|
7793
|
-
"RULE_DIGIT"
|
|
7794
|
-
],
|
|
7795
|
-
[
|
|
7796
|
-
"RULE_SYMBOL"
|
|
7797
|
-
]
|
|
7798
|
-
]
|
|
7799
|
-
},
|
|
7800
|
-
{
|
|
7801
|
-
name: "RULE_LETTER",
|
|
7802
|
-
bnf: [
|
|
7803
|
-
[
|
|
7804
|
-
'"A"'
|
|
7805
|
-
],
|
|
7806
|
-
[
|
|
7807
|
-
'"B"'
|
|
7808
|
-
],
|
|
7809
|
-
[
|
|
7810
|
-
'"C"'
|
|
7811
|
-
],
|
|
7812
|
-
[
|
|
7813
|
-
'"D"'
|
|
7814
|
-
],
|
|
7815
|
-
[
|
|
7816
|
-
'"E"'
|
|
7817
|
-
],
|
|
7818
|
-
[
|
|
7819
|
-
'"F"'
|
|
7820
|
-
],
|
|
7821
|
-
[
|
|
7822
|
-
'"G"'
|
|
7823
|
-
],
|
|
7824
|
-
[
|
|
7825
|
-
'"H"'
|
|
7826
|
-
],
|
|
7827
|
-
[
|
|
7828
|
-
'"I"'
|
|
7829
|
-
],
|
|
7830
|
-
[
|
|
7831
|
-
'"J"'
|
|
7832
|
-
],
|
|
7833
|
-
[
|
|
7834
|
-
'"K"'
|
|
7835
|
-
],
|
|
7836
|
-
[
|
|
7837
|
-
'"L"'
|
|
7838
|
-
],
|
|
7839
|
-
[
|
|
7840
|
-
'"M"'
|
|
7841
|
-
],
|
|
7842
|
-
[
|
|
7843
|
-
'"N"'
|
|
7844
|
-
],
|
|
7845
|
-
[
|
|
7846
|
-
'"O"'
|
|
7847
|
-
],
|
|
7848
|
-
[
|
|
7849
|
-
'"P"'
|
|
7850
|
-
],
|
|
7851
|
-
[
|
|
7852
|
-
'"Q"'
|
|
7853
|
-
],
|
|
7854
|
-
[
|
|
7855
|
-
'"R"'
|
|
7856
|
-
],
|
|
7857
|
-
[
|
|
7858
|
-
'"S"'
|
|
7859
|
-
],
|
|
7860
|
-
[
|
|
7861
|
-
'"T"'
|
|
7862
|
-
],
|
|
7863
|
-
[
|
|
7864
|
-
'"U"'
|
|
7865
|
-
],
|
|
7866
|
-
[
|
|
7867
|
-
'"V"'
|
|
7868
|
-
],
|
|
7869
|
-
[
|
|
7870
|
-
'"W"'
|
|
7871
|
-
],
|
|
7872
|
-
[
|
|
7873
|
-
'"X"'
|
|
7874
|
-
],
|
|
7875
|
-
[
|
|
7876
|
-
'"Y"'
|
|
7877
|
-
],
|
|
7878
|
-
[
|
|
7879
|
-
'"Z"'
|
|
7880
|
-
],
|
|
7881
|
-
[
|
|
7882
|
-
'"a"'
|
|
7883
|
-
],
|
|
7884
|
-
[
|
|
7885
|
-
'"b"'
|
|
7886
|
-
],
|
|
7887
|
-
[
|
|
7888
|
-
'"c"'
|
|
7889
|
-
],
|
|
7890
|
-
[
|
|
7891
|
-
'"d"'
|
|
7892
|
-
],
|
|
7893
|
-
[
|
|
7894
|
-
'"e"'
|
|
7895
|
-
],
|
|
7896
|
-
[
|
|
7897
|
-
'"f"'
|
|
7898
|
-
],
|
|
7899
|
-
[
|
|
7900
|
-
'"g"'
|
|
7901
|
-
],
|
|
7902
|
-
[
|
|
7903
|
-
'"h"'
|
|
7904
|
-
],
|
|
7905
|
-
[
|
|
7906
|
-
'"i"'
|
|
7907
|
-
],
|
|
7908
|
-
[
|
|
7909
|
-
'"j"'
|
|
7910
|
-
],
|
|
7911
|
-
[
|
|
7912
|
-
'"k"'
|
|
7913
|
-
],
|
|
7914
|
-
[
|
|
7915
|
-
'"l"'
|
|
7916
|
-
],
|
|
7917
|
-
[
|
|
7918
|
-
'"m"'
|
|
7919
|
-
],
|
|
7920
|
-
[
|
|
7921
|
-
'"n"'
|
|
7922
|
-
],
|
|
7923
|
-
[
|
|
7924
|
-
'"o"'
|
|
7925
|
-
],
|
|
7926
|
-
[
|
|
7927
|
-
'"p"'
|
|
7928
|
-
],
|
|
7929
|
-
[
|
|
7930
|
-
'"q"'
|
|
7931
|
-
],
|
|
7932
|
-
[
|
|
7933
|
-
'"r"'
|
|
7934
|
-
],
|
|
7935
|
-
[
|
|
7936
|
-
'"s"'
|
|
7937
|
-
],
|
|
7938
|
-
[
|
|
7939
|
-
'"t"'
|
|
7940
|
-
],
|
|
7941
|
-
[
|
|
7942
|
-
'"u"'
|
|
7943
|
-
],
|
|
7944
|
-
[
|
|
7945
|
-
'"v"'
|
|
7946
|
-
],
|
|
7947
|
-
[
|
|
7948
|
-
'"w"'
|
|
7949
|
-
],
|
|
7950
|
-
[
|
|
7951
|
-
'"x"'
|
|
7952
|
-
],
|
|
7953
|
-
[
|
|
7954
|
-
'"y"'
|
|
7955
|
-
],
|
|
7956
|
-
[
|
|
7957
|
-
'"z"'
|
|
7958
|
-
]
|
|
7959
|
-
]
|
|
7960
|
-
},
|
|
7961
|
-
{
|
|
7962
|
-
name: "RULE_DIGIT",
|
|
7963
|
-
bnf: [
|
|
7964
|
-
[
|
|
7965
|
-
'"0"'
|
|
7966
|
-
],
|
|
7967
|
-
[
|
|
7968
|
-
'"1"'
|
|
7969
|
-
],
|
|
7970
|
-
[
|
|
7971
|
-
'"2"'
|
|
7972
|
-
],
|
|
7973
|
-
[
|
|
7974
|
-
'"3"'
|
|
7975
|
-
],
|
|
7976
|
-
[
|
|
7977
|
-
'"4"'
|
|
7978
|
-
],
|
|
7979
|
-
[
|
|
7980
|
-
'"5"'
|
|
7981
|
-
],
|
|
7982
|
-
[
|
|
7983
|
-
'"6"'
|
|
7984
|
-
],
|
|
7985
|
-
[
|
|
7986
|
-
'"7"'
|
|
7987
|
-
],
|
|
7988
|
-
[
|
|
7989
|
-
'"8"'
|
|
7990
|
-
],
|
|
7991
|
-
[
|
|
7992
|
-
'"9"'
|
|
7993
|
-
]
|
|
7994
|
-
]
|
|
7995
|
-
},
|
|
7996
|
-
{
|
|
7997
|
-
name: "RULE_SYMBOL",
|
|
7998
|
-
bnf: [
|
|
7999
|
-
[
|
|
8000
|
-
'"-"'
|
|
8001
|
-
],
|
|
8002
|
-
[
|
|
8003
|
-
'"_"'
|
|
8004
|
-
],
|
|
8005
|
-
[
|
|
8006
|
-
'"!"'
|
|
8007
|
-
],
|
|
8008
|
-
[
|
|
8009
|
-
'"#"'
|
|
8010
|
-
],
|
|
8011
|
-
[
|
|
8012
|
-
'"$"'
|
|
8013
|
-
],
|
|
8014
|
-
[
|
|
8015
|
-
'"%"'
|
|
8016
|
-
],
|
|
8017
|
-
[
|
|
8018
|
-
'"&"'
|
|
8019
|
-
],
|
|
8020
|
-
[
|
|
8021
|
-
'"("'
|
|
8022
|
-
],
|
|
8023
|
-
[
|
|
8024
|
-
'")"'
|
|
8025
|
-
],
|
|
8026
|
-
[
|
|
8027
|
-
'"*"'
|
|
8028
|
-
],
|
|
8029
|
-
[
|
|
8030
|
-
'"+"'
|
|
8031
|
-
],
|
|
8032
|
-
[
|
|
8033
|
-
'","'
|
|
8034
|
-
],
|
|
8035
|
-
[
|
|
8036
|
-
'"-"'
|
|
8037
|
-
],
|
|
8038
|
-
[
|
|
8039
|
-
'"."'
|
|
8040
|
-
],
|
|
8041
|
-
[
|
|
8042
|
-
'"/"'
|
|
8043
|
-
],
|
|
8044
|
-
[
|
|
8045
|
-
'":"'
|
|
8046
|
-
],
|
|
8047
|
-
[
|
|
8048
|
-
'";"'
|
|
8049
|
-
],
|
|
8050
|
-
[
|
|
8051
|
-
'"<"'
|
|
8052
|
-
],
|
|
8053
|
-
[
|
|
8054
|
-
'"="'
|
|
8055
|
-
],
|
|
8056
|
-
[
|
|
8057
|
-
'">"'
|
|
8058
|
-
],
|
|
8059
|
-
[
|
|
8060
|
-
'"?"'
|
|
8061
|
-
],
|
|
8062
|
-
[
|
|
8063
|
-
'"@"'
|
|
8064
|
-
],
|
|
8065
|
-
[
|
|
8066
|
-
'"["'
|
|
8067
|
-
],
|
|
8068
|
-
[
|
|
8069
|
-
'"\\"'
|
|
8070
|
-
],
|
|
8071
|
-
[
|
|
8072
|
-
'"]"'
|
|
8073
|
-
],
|
|
8074
|
-
[
|
|
8075
|
-
'"^"'
|
|
8076
|
-
],
|
|
8077
|
-
[
|
|
8078
|
-
'"_"'
|
|
8079
|
-
],
|
|
8080
|
-
[
|
|
8081
|
-
'"`"'
|
|
8082
|
-
],
|
|
8083
|
-
[
|
|
8084
|
-
'"{"'
|
|
8085
|
-
],
|
|
8086
|
-
[
|
|
8087
|
-
'"|"'
|
|
8088
|
-
],
|
|
8089
|
-
[
|
|
8090
|
-
'"}"'
|
|
8091
|
-
],
|
|
8092
|
-
[
|
|
8093
|
-
'"~"'
|
|
8094
|
-
]
|
|
8095
|
-
]
|
|
8096
|
-
},
|
|
8097
|
-
{
|
|
8098
|
-
name: "RULE_CHARACTER1",
|
|
8099
|
-
bnf: [
|
|
8100
|
-
[
|
|
8101
|
-
"RULE_CHARACTER"
|
|
8102
|
-
],
|
|
8103
|
-
[
|
|
8104
|
-
'"\'"'
|
|
8105
|
-
]
|
|
8106
|
-
]
|
|
8107
|
-
},
|
|
8108
|
-
{
|
|
8109
|
-
name: "RULE_CHARACTER2",
|
|
8110
|
-
bnf: [
|
|
8111
|
-
[
|
|
8112
|
-
"RULE_CHARACTER"
|
|
8113
|
-
],
|
|
8114
|
-
[
|
|
8115
|
-
"'\"'"
|
|
8116
|
-
]
|
|
8117
|
-
]
|
|
8118
|
-
},
|
|
8119
|
-
{
|
|
8120
|
-
name: "rule-name",
|
|
8121
|
-
bnf: [
|
|
8122
|
-
[
|
|
8123
|
-
"RULE_LETTER",
|
|
8124
|
-
"RULE_CHAR*"
|
|
8125
|
-
]
|
|
8126
|
-
]
|
|
8127
|
-
},
|
|
8128
|
-
{
|
|
8129
|
-
name: "RULE_CHAR",
|
|
8130
|
-
bnf: [
|
|
8131
|
-
[
|
|
8132
|
-
"RULE_LETTER"
|
|
8133
|
-
],
|
|
8134
|
-
[
|
|
8135
|
-
"RULE_DIGIT"
|
|
8136
|
-
],
|
|
8137
|
-
[
|
|
8138
|
-
'"_"'
|
|
8139
|
-
],
|
|
8140
|
-
[
|
|
8141
|
-
'"-"'
|
|
8142
|
-
]
|
|
8143
|
-
]
|
|
8144
|
-
}
|
|
8145
|
-
];
|
|
8146
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
8147
|
-
debug: false
|
|
8148
|
-
});
|
|
8149
|
-
function getAllTerms(expr) {
|
|
8150
|
-
var terms = SemanticHelpers_1.findChildrenByType(expr, "term").map(function(term) {
|
|
8151
|
-
return SemanticHelpers_1.findChildrenByType(term, "literal").concat(SemanticHelpers_1.findChildrenByType(term, "rule-name"))[0].text;
|
|
8152
|
-
});
|
|
8153
|
-
SemanticHelpers_1.findChildrenByType(expr, "list").forEach(function(expr2) {
|
|
8154
|
-
terms = terms.concat(getAllTerms(expr2));
|
|
8155
|
-
});
|
|
8156
|
-
return terms;
|
|
8157
|
-
}
|
|
8158
|
-
function getRules(source) {
|
|
8159
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
8160
|
-
var ast = parser2.getAST(source);
|
|
8161
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
8162
|
-
if (ast.errors && ast.errors.length) {
|
|
8163
|
-
throw ast.errors[0];
|
|
8164
|
-
}
|
|
8165
|
-
var rules = SemanticHelpers_1.findChildrenByType(ast, "rule");
|
|
8166
|
-
var ret = rules.map(function(rule) {
|
|
8167
|
-
var name = SemanticHelpers_1.findChildrenByType(rule, "rule-name")[0].text;
|
|
8168
|
-
var expressions = SemanticHelpers_1.findChildrenByType(rule, "firstExpression").concat(SemanticHelpers_1.findChildrenByType(rule, "otherExpression"));
|
|
8169
|
-
var bnf = [];
|
|
8170
|
-
expressions.forEach(function(expr) {
|
|
8171
|
-
bnf.push(getAllTerms(expr));
|
|
8172
|
-
});
|
|
8173
|
-
return {
|
|
8174
|
-
name: name,
|
|
8175
|
-
bnf: bnf
|
|
8176
|
-
};
|
|
8177
|
-
});
|
|
8178
|
-
if (!ret.some(function(x) {
|
|
8179
|
-
return x.name == "EOL";
|
|
8180
|
-
})) {
|
|
8181
|
-
ret.push({
|
|
8182
|
-
name: "EOL",
|
|
8183
|
-
bnf: [
|
|
8184
|
-
[
|
|
8185
|
-
'"\\r\\n"',
|
|
8186
|
-
'"\\r"',
|
|
8187
|
-
'"\\n"'
|
|
8188
|
-
]
|
|
8189
|
-
]
|
|
8190
|
-
});
|
|
8191
|
-
}
|
|
8192
|
-
return ret;
|
|
8193
|
-
}
|
|
8194
|
-
BNF2.getRules = getRules;
|
|
8195
|
-
function Transform(source) {
|
|
8196
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
8197
|
-
return getRules(source.join(""), subParser);
|
|
8198
|
-
}
|
|
8199
|
-
BNF2.Transform = Transform;
|
|
8200
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
8201
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
8202
|
-
var _super = _create_super(Parser2);
|
|
8203
|
-
function Parser2(source, options) {
|
|
8204
|
-
_class_call_check(this, Parser2);
|
|
8205
|
-
var _this;
|
|
8206
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
8207
|
-
debug: true
|
|
8208
|
-
}) : BNF2.defaultParser;
|
|
8209
|
-
_this = _super.call(this, getRules(source, subParser), options);
|
|
8210
|
-
_this.source = source;
|
|
8211
|
-
return _this;
|
|
8212
|
-
}
|
|
8213
|
-
_create_class(Parser2, [
|
|
8214
|
-
{
|
|
8215
|
-
key: "emitSource",
|
|
8216
|
-
value: function emitSource() {
|
|
8217
|
-
return this.source;
|
|
8218
|
-
}
|
|
8219
|
-
}
|
|
8220
|
-
]);
|
|
8221
|
-
return Parser2;
|
|
8222
|
-
}(Parser_1.Parser);
|
|
8223
|
-
BNF2.Parser = Parser2;
|
|
8224
|
-
})(BNF || (BNF = {}));
|
|
8225
|
-
exports.default = BNF;
|
|
8226
|
-
}
|
|
8227
|
-
});
|
|
8228
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/W3CEBNF.js
|
|
8229
|
-
var require_W3CEBNF = __commonJS({
|
|
8230
|
-
"../../../../../../../../../../../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) {
|
|
8231
|
-
"use strict";
|
|
8232
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8233
|
-
value: true
|
|
8234
|
-
});
|
|
8235
|
-
var Parser_1 = require_Parser();
|
|
8236
|
-
var BNF;
|
|
8237
|
-
(function(BNF2) {
|
|
8238
|
-
BNF2.RULES = [
|
|
8239
|
-
{
|
|
8240
|
-
name: "Grammar",
|
|
8241
|
-
bnf: [
|
|
8242
|
-
[
|
|
8243
|
-
"RULE_S*",
|
|
8244
|
-
"%Atomic*",
|
|
8245
|
-
"EOF"
|
|
8246
|
-
]
|
|
8247
|
-
]
|
|
8248
|
-
},
|
|
8249
|
-
{
|
|
8250
|
-
name: "%Atomic",
|
|
8251
|
-
bnf: [
|
|
8252
|
-
[
|
|
8253
|
-
"Production",
|
|
8254
|
-
"RULE_S*"
|
|
8255
|
-
]
|
|
8256
|
-
],
|
|
8257
|
-
fragment: true
|
|
8258
|
-
},
|
|
8259
|
-
{
|
|
8260
|
-
name: "Production",
|
|
8261
|
-
bnf: [
|
|
8262
|
-
[
|
|
8263
|
-
"NCName",
|
|
8264
|
-
"RULE_S*",
|
|
8265
|
-
'"::="',
|
|
8266
|
-
"RULE_WHITESPACE*",
|
|
8267
|
-
"Choice",
|
|
8268
|
-
"RULE_WHITESPACE*",
|
|
8269
|
-
"RULE_EOL+",
|
|
8270
|
-
"RULE_S*"
|
|
8271
|
-
]
|
|
8272
|
-
]
|
|
8273
|
-
},
|
|
8274
|
-
{
|
|
8275
|
-
name: "NCName",
|
|
8276
|
-
bnf: [
|
|
8277
|
-
[
|
|
8278
|
-
/[a-zA-Z][a-zA-Z_0-9]*/
|
|
8279
|
-
]
|
|
8280
|
-
]
|
|
8281
|
-
},
|
|
8282
|
-
{
|
|
8283
|
-
name: "Choice",
|
|
8284
|
-
bnf: [
|
|
8285
|
-
[
|
|
8286
|
-
"SequenceOrDifference",
|
|
8287
|
-
"%_Choice_1*"
|
|
8288
|
-
]
|
|
8289
|
-
],
|
|
8290
|
-
fragment: true
|
|
8291
|
-
},
|
|
8292
|
-
{
|
|
8293
|
-
name: "%_Choice_1",
|
|
8294
|
-
bnf: [
|
|
8295
|
-
[
|
|
8296
|
-
"RULE_WHITESPACE*",
|
|
8297
|
-
'"|"',
|
|
8298
|
-
"RULE_WHITESPACE*",
|
|
8299
|
-
"SequenceOrDifference"
|
|
8300
|
-
]
|
|
8301
|
-
],
|
|
8302
|
-
fragment: true
|
|
8303
|
-
},
|
|
8304
|
-
{
|
|
8305
|
-
name: "SequenceOrDifference",
|
|
8306
|
-
bnf: [
|
|
8307
|
-
[
|
|
8308
|
-
"Item",
|
|
8309
|
-
"RULE_WHITESPACE*",
|
|
8310
|
-
"%_Item_1?"
|
|
8311
|
-
]
|
|
8312
|
-
]
|
|
8313
|
-
},
|
|
8314
|
-
{
|
|
8315
|
-
name: "%_Item_1",
|
|
8316
|
-
bnf: [
|
|
8317
|
-
[
|
|
8318
|
-
"Minus",
|
|
8319
|
-
"Item"
|
|
8320
|
-
],
|
|
8321
|
-
[
|
|
8322
|
-
"Item*"
|
|
8323
|
-
]
|
|
8324
|
-
],
|
|
8325
|
-
fragment: true
|
|
8326
|
-
},
|
|
8327
|
-
{
|
|
8328
|
-
name: "Minus",
|
|
8329
|
-
bnf: [
|
|
8330
|
-
[
|
|
8331
|
-
'"-"'
|
|
8332
|
-
]
|
|
8333
|
-
]
|
|
8334
|
-
},
|
|
8335
|
-
{
|
|
8336
|
-
name: "Item",
|
|
8337
|
-
bnf: [
|
|
8338
|
-
[
|
|
8339
|
-
"RULE_WHITESPACE*",
|
|
8340
|
-
"%Primary",
|
|
8341
|
-
"PrimaryDecoration?"
|
|
8342
|
-
]
|
|
8343
|
-
],
|
|
8344
|
-
fragment: true
|
|
8345
|
-
},
|
|
8346
|
-
{
|
|
8347
|
-
name: "PrimaryDecoration",
|
|
8348
|
-
bnf: [
|
|
8349
|
-
[
|
|
8350
|
-
'"?"'
|
|
8351
|
-
],
|
|
8352
|
-
[
|
|
8353
|
-
'"*"'
|
|
8354
|
-
],
|
|
8355
|
-
[
|
|
8356
|
-
'"+"'
|
|
8357
|
-
]
|
|
8358
|
-
]
|
|
8359
|
-
},
|
|
8360
|
-
{
|
|
8361
|
-
name: "DecorationName",
|
|
8362
|
-
bnf: [
|
|
8363
|
-
[
|
|
8364
|
-
'"ebnf://"',
|
|
8365
|
-
/[^\x5D#]+/
|
|
8366
|
-
]
|
|
8367
|
-
]
|
|
8368
|
-
},
|
|
8369
|
-
{
|
|
8370
|
-
name: "%Primary",
|
|
8371
|
-
bnf: [
|
|
8372
|
-
[
|
|
8373
|
-
"NCName"
|
|
8374
|
-
],
|
|
8375
|
-
[
|
|
8376
|
-
"StringLiteral"
|
|
8377
|
-
],
|
|
8378
|
-
[
|
|
8379
|
-
"CharCode"
|
|
8380
|
-
],
|
|
8381
|
-
[
|
|
8382
|
-
"CharClass"
|
|
8383
|
-
],
|
|
8384
|
-
[
|
|
8385
|
-
"SubItem"
|
|
8386
|
-
]
|
|
8387
|
-
],
|
|
8388
|
-
fragment: true
|
|
8389
|
-
},
|
|
8390
|
-
{
|
|
8391
|
-
name: "SubItem",
|
|
8392
|
-
bnf: [
|
|
8393
|
-
[
|
|
8394
|
-
'"("',
|
|
8395
|
-
"RULE_WHITESPACE*",
|
|
8396
|
-
"Choice",
|
|
8397
|
-
"RULE_WHITESPACE*",
|
|
8398
|
-
'")"'
|
|
8399
|
-
]
|
|
8400
|
-
]
|
|
8401
|
-
},
|
|
8402
|
-
{
|
|
8403
|
-
name: "StringLiteral",
|
|
8404
|
-
bnf: [
|
|
8405
|
-
[
|
|
8406
|
-
"'\"'",
|
|
8407
|
-
/[^"]*/,
|
|
8408
|
-
"'\"'"
|
|
8409
|
-
],
|
|
8410
|
-
[
|
|
8411
|
-
'"\'"',
|
|
8412
|
-
/[^']*/,
|
|
8413
|
-
'"\'"'
|
|
8414
|
-
]
|
|
8415
|
-
],
|
|
8416
|
-
pinned: 1
|
|
8417
|
-
},
|
|
8418
|
-
{
|
|
8419
|
-
name: "CharCode",
|
|
8420
|
-
bnf: [
|
|
8421
|
-
[
|
|
8422
|
-
'"#x"',
|
|
8423
|
-
/[0-9a-zA-Z]+/
|
|
8424
|
-
]
|
|
8425
|
-
]
|
|
8426
|
-
},
|
|
8427
|
-
{
|
|
8428
|
-
name: "CharClass",
|
|
8429
|
-
bnf: [
|
|
8430
|
-
[
|
|
8431
|
-
"'['",
|
|
8432
|
-
"'^'?",
|
|
8433
|
-
"%RULE_CharClass_1+",
|
|
8434
|
-
'"]"'
|
|
8435
|
-
]
|
|
8436
|
-
]
|
|
8437
|
-
},
|
|
8438
|
-
{
|
|
8439
|
-
name: "%RULE_CharClass_1",
|
|
8440
|
-
bnf: [
|
|
8441
|
-
[
|
|
8442
|
-
"CharCodeRange"
|
|
8443
|
-
],
|
|
8444
|
-
[
|
|
8445
|
-
"CharRange"
|
|
8446
|
-
],
|
|
8447
|
-
[
|
|
8448
|
-
"CharCode"
|
|
8449
|
-
],
|
|
8450
|
-
[
|
|
8451
|
-
"RULE_Char"
|
|
8452
|
-
]
|
|
8453
|
-
],
|
|
8454
|
-
fragment: true
|
|
8455
|
-
},
|
|
8456
|
-
{
|
|
8457
|
-
name: "RULE_Char",
|
|
8458
|
-
bnf: [
|
|
8459
|
-
[
|
|
8460
|
-
/\x09/
|
|
8461
|
-
],
|
|
8462
|
-
[
|
|
8463
|
-
/\x0A/
|
|
8464
|
-
],
|
|
8465
|
-
[
|
|
8466
|
-
/\x0D/
|
|
8467
|
-
],
|
|
8468
|
-
[
|
|
8469
|
-
/[\x20-\x5c]/
|
|
8470
|
-
],
|
|
8471
|
-
[
|
|
8472
|
-
/[\x5e-\uD7FF]/
|
|
8473
|
-
],
|
|
8474
|
-
[
|
|
8475
|
-
/[\uE000-\uFFFD]/
|
|
8476
|
-
]
|
|
8477
|
-
]
|
|
8478
|
-
},
|
|
8479
|
-
{
|
|
8480
|
-
name: "CharRange",
|
|
8481
|
-
bnf: [
|
|
8482
|
-
[
|
|
8483
|
-
"RULE_Char",
|
|
8484
|
-
'"-"',
|
|
8485
|
-
"RULE_Char"
|
|
8486
|
-
]
|
|
8487
|
-
]
|
|
8488
|
-
},
|
|
8489
|
-
{
|
|
8490
|
-
name: "CharCodeRange",
|
|
8491
|
-
bnf: [
|
|
8492
|
-
[
|
|
8493
|
-
"CharCode",
|
|
8494
|
-
'"-"',
|
|
8495
|
-
"CharCode"
|
|
8496
|
-
]
|
|
8497
|
-
]
|
|
8498
|
-
},
|
|
8499
|
-
{
|
|
8500
|
-
name: "RULE_WHITESPACE",
|
|
8501
|
-
bnf: [
|
|
8502
|
-
[
|
|
8503
|
-
"%RULE_WHITESPACE_CHAR*"
|
|
8504
|
-
],
|
|
8505
|
-
[
|
|
8506
|
-
"Comment",
|
|
8507
|
-
"RULE_WHITESPACE*"
|
|
8508
|
-
]
|
|
8509
|
-
]
|
|
8510
|
-
},
|
|
8511
|
-
{
|
|
8512
|
-
name: "RULE_S",
|
|
8513
|
-
bnf: [
|
|
8514
|
-
[
|
|
8515
|
-
"RULE_WHITESPACE",
|
|
8516
|
-
"RULE_S*"
|
|
8517
|
-
],
|
|
8518
|
-
[
|
|
8519
|
-
"RULE_EOL",
|
|
8520
|
-
"RULE_S*"
|
|
8521
|
-
]
|
|
8522
|
-
]
|
|
8523
|
-
},
|
|
8524
|
-
{
|
|
8525
|
-
name: "%RULE_WHITESPACE_CHAR",
|
|
8526
|
-
bnf: [
|
|
8527
|
-
[
|
|
8528
|
-
/\x09/
|
|
8529
|
-
],
|
|
8530
|
-
[
|
|
8531
|
-
/\x20/
|
|
8532
|
-
]
|
|
8533
|
-
],
|
|
8534
|
-
fragment: true
|
|
8535
|
-
},
|
|
8536
|
-
{
|
|
8537
|
-
name: "Comment",
|
|
8538
|
-
bnf: [
|
|
8539
|
-
[
|
|
8540
|
-
'"/*"',
|
|
8541
|
-
"%RULE_Comment_Body*",
|
|
8542
|
-
'"*/"'
|
|
8543
|
-
]
|
|
8544
|
-
]
|
|
8545
|
-
},
|
|
8546
|
-
{
|
|
8547
|
-
name: "%RULE_Comment_Body",
|
|
8548
|
-
bnf: [
|
|
8549
|
-
[
|
|
8550
|
-
'!"*/"',
|
|
8551
|
-
/[^*]/
|
|
8552
|
-
]
|
|
8553
|
-
],
|
|
8554
|
-
fragment: true
|
|
8555
|
-
},
|
|
8556
|
-
{
|
|
8557
|
-
name: "RULE_EOL",
|
|
8558
|
-
bnf: [
|
|
8559
|
-
[
|
|
8560
|
-
/\x0D/,
|
|
8561
|
-
/\x0A/
|
|
8562
|
-
],
|
|
8563
|
-
[
|
|
8564
|
-
/\x0A/
|
|
8565
|
-
],
|
|
8566
|
-
[
|
|
8567
|
-
/\x0D/
|
|
8568
|
-
]
|
|
8569
|
-
]
|
|
8570
|
-
},
|
|
8571
|
-
{
|
|
8572
|
-
name: "Link",
|
|
8573
|
-
bnf: [
|
|
8574
|
-
[
|
|
8575
|
-
"'['",
|
|
8576
|
-
"Url",
|
|
8577
|
-
"']'"
|
|
8578
|
-
]
|
|
8579
|
-
]
|
|
8580
|
-
},
|
|
8581
|
-
{
|
|
8582
|
-
name: "Url",
|
|
8583
|
-
bnf: [
|
|
8584
|
-
[
|
|
8585
|
-
/[^\x5D:/?#]/,
|
|
8586
|
-
'"://"',
|
|
8587
|
-
/[^\x5D#]+/,
|
|
8588
|
-
"%Url1?"
|
|
8589
|
-
]
|
|
8590
|
-
]
|
|
8591
|
-
},
|
|
8592
|
-
{
|
|
8593
|
-
name: "%Url1",
|
|
8594
|
-
bnf: [
|
|
8595
|
-
[
|
|
8596
|
-
'"#"',
|
|
8597
|
-
"NCName"
|
|
8598
|
-
]
|
|
8599
|
-
],
|
|
8600
|
-
fragment: true
|
|
8601
|
-
}
|
|
8602
|
-
];
|
|
8603
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
8604
|
-
debug: false
|
|
8605
|
-
});
|
|
8606
|
-
var preDecorationRE = /^(!|&)/;
|
|
8607
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
8608
|
-
var subExpressionRE = /^%/;
|
|
8609
|
-
function getBNFRule(name, parser2) {
|
|
8610
|
-
if (typeof name == "string") {
|
|
8611
|
-
if (preDecorationRE.test(name)) return "";
|
|
8612
|
-
var subexpression = subExpressionRE.test(name);
|
|
8613
|
-
if (subexpression) {
|
|
8614
|
-
var decoration = decorationRE.exec(name);
|
|
8615
|
-
var decorationText = decoration ? decoration[0] + " " : "";
|
|
8616
|
-
var lonely = isLonelyRule(name, parser2);
|
|
8617
|
-
if (lonely) return getBNFBody(name, parser2) + decorationText;
|
|
8618
|
-
return "(" + getBNFBody(name, parser2) + ")" + decorationText;
|
|
8619
|
-
}
|
|
8620
|
-
return name;
|
|
8621
|
-
} else {
|
|
8622
|
-
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]");
|
|
8623
|
-
}
|
|
8624
|
-
}
|
|
8625
|
-
function isLonelyRule(name, parser2) {
|
|
8626
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
8627
|
-
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] == "'");
|
|
8628
|
-
}
|
|
8629
|
-
function getBNFChoice(rules, parser2) {
|
|
8630
|
-
return rules.map(function(x) {
|
|
8631
|
-
return getBNFRule(x, parser2);
|
|
8632
|
-
}).join(" ");
|
|
8633
|
-
}
|
|
8634
|
-
function getBNFBody(name, parser2) {
|
|
8635
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
8636
|
-
if (rule) return rule.bnf.map(function(x) {
|
|
8637
|
-
return getBNFChoice(x, parser2);
|
|
8638
|
-
}).join(" | ");
|
|
8639
|
-
return "RULE_NOT_FOUND {" + name + "}";
|
|
8640
|
-
}
|
|
8641
|
-
function emit(parser2) {
|
|
8642
|
-
var acumulator = [];
|
|
8643
|
-
parser2.grammarRules.forEach(function(l) {
|
|
8644
|
-
if (!/^%/.test(l.name)) {
|
|
8645
|
-
var recover = l.recover ? " /* { recoverUntil=" + l.recover + " } */" : "";
|
|
8646
|
-
acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser2) + recover);
|
|
8647
|
-
}
|
|
8648
|
-
});
|
|
8649
|
-
return acumulator.join("\n");
|
|
8650
|
-
}
|
|
8651
|
-
BNF2.emit = emit;
|
|
8652
|
-
var subitems = 0;
|
|
8653
|
-
function restar(total, resta) {
|
|
8654
|
-
console.log("reberia restar " + resta + " a " + total);
|
|
8655
|
-
throw new Error("Difference not supported yet");
|
|
8656
|
-
}
|
|
8657
|
-
function convertRegex(txt) {
|
|
8658
|
-
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"));
|
|
8659
|
-
}
|
|
8660
|
-
function getSubItems(tmpRules, seq, parentName) {
|
|
8661
|
-
var anterior = null;
|
|
8662
|
-
var bnfSeq = [];
|
|
8663
|
-
seq.children.forEach(function(x, i) {
|
|
8664
|
-
if (x.type == "Minus") {
|
|
8665
|
-
restar(anterior, x);
|
|
8666
|
-
} else {}
|
|
8667
|
-
var decoration = seq.children[i + 1];
|
|
8668
|
-
decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || "";
|
|
8669
|
-
var preDecoration = "";
|
|
8670
|
-
switch(x.type){
|
|
8671
|
-
case "SubItem":
|
|
8672
|
-
var name = "%" + (parentName + subitems++);
|
|
8673
|
-
createRule(tmpRules, x, name);
|
|
8674
|
-
bnfSeq.push(preDecoration + name + decoration);
|
|
8675
|
-
break;
|
|
8676
|
-
case "NCName":
|
|
8677
|
-
case "StringLiteral":
|
|
8678
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
8679
|
-
break;
|
|
8680
|
-
case "CharCode":
|
|
8681
|
-
case "CharClass":
|
|
8682
|
-
if (decoration || preDecoration) {
|
|
8683
|
-
var newRule = {
|
|
8684
|
-
name: "%" + (parentName + subitems++),
|
|
8685
|
-
bnf: [
|
|
8686
|
-
[
|
|
8687
|
-
convertRegex(x.text)
|
|
8688
|
-
]
|
|
8689
|
-
]
|
|
8690
|
-
};
|
|
8691
|
-
tmpRules.push(newRule);
|
|
8692
|
-
bnfSeq.push(preDecoration + newRule.name + decoration);
|
|
8693
|
-
} else {
|
|
8694
|
-
bnfSeq.push(convertRegex(x.text));
|
|
8695
|
-
}
|
|
8696
|
-
break;
|
|
8697
|
-
case "PrimaryDecoration":
|
|
8698
|
-
break;
|
|
8699
|
-
default:
|
|
8700
|
-
throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text));
|
|
8701
|
-
}
|
|
8702
|
-
anterior = x;
|
|
8703
|
-
});
|
|
8704
|
-
return bnfSeq;
|
|
8705
|
-
}
|
|
8706
|
-
function createRule(tmpRules, token, name) {
|
|
8707
|
-
var bnf = token.children.filter(function(x) {
|
|
8708
|
-
return x.type == "SequenceOrDifference";
|
|
8709
|
-
}).map(function(s) {
|
|
8710
|
-
return getSubItems(tmpRules, s, name);
|
|
8711
|
-
});
|
|
8712
|
-
var rule = {
|
|
8713
|
-
name: name,
|
|
8714
|
-
bnf: bnf
|
|
8715
|
-
};
|
|
8716
|
-
var recover = null;
|
|
8717
|
-
bnf.forEach(function(x) {
|
|
8718
|
-
recover = recover || x["recover"];
|
|
8719
|
-
delete x["recover"];
|
|
8720
|
-
});
|
|
8721
|
-
if (name.indexOf("%") == 0) rule.fragment = true;
|
|
8722
|
-
if (recover) rule.recover = recover;
|
|
8723
|
-
tmpRules.push(rule);
|
|
8724
|
-
}
|
|
8725
|
-
function getRules(source) {
|
|
8726
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
8727
|
-
var ast = parser2.getAST(source);
|
|
8728
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
8729
|
-
if (ast.errors && ast.errors.length) {
|
|
8730
|
-
throw ast.errors[0];
|
|
8731
|
-
}
|
|
8732
|
-
var tmpRules = [];
|
|
8733
|
-
ast.children.filter(function(x) {
|
|
8734
|
-
return x.type == "Production";
|
|
8735
|
-
}).map(function(x) {
|
|
8736
|
-
var name = x.children.filter(function(x2) {
|
|
8737
|
-
return x2.type == "NCName";
|
|
8738
|
-
})[0].text;
|
|
8739
|
-
createRule(tmpRules, x, name);
|
|
8740
|
-
});
|
|
8741
|
-
return tmpRules;
|
|
8742
|
-
}
|
|
8743
|
-
BNF2.getRules = getRules;
|
|
8744
|
-
function Transform(source) {
|
|
8745
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
8746
|
-
return getRules(source.join(""), subParser);
|
|
8747
|
-
}
|
|
8748
|
-
BNF2.Transform = Transform;
|
|
8749
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
8750
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
8751
|
-
var _super = _create_super(Parser2);
|
|
8752
|
-
function Parser2(source, options) {
|
|
8753
|
-
_class_call_check(this, Parser2);
|
|
8754
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
8755
|
-
debug: true
|
|
8756
|
-
}) : BNF2.defaultParser;
|
|
8757
|
-
return _super.call(this, getRules(source, subParser), options);
|
|
8758
|
-
}
|
|
8759
|
-
_create_class(Parser2, [
|
|
8760
|
-
{
|
|
8761
|
-
key: "emitSource",
|
|
8762
|
-
value: function emitSource() {
|
|
8763
|
-
return emit(this);
|
|
8764
|
-
}
|
|
8765
|
-
}
|
|
8766
|
-
]);
|
|
8767
|
-
return Parser2;
|
|
8768
|
-
}(Parser_1.Parser);
|
|
8769
|
-
BNF2.Parser = Parser2;
|
|
8770
|
-
})(BNF || (BNF = {}));
|
|
8771
|
-
exports.default = BNF;
|
|
8772
|
-
}
|
|
8773
|
-
});
|
|
8774
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/Custom.js
|
|
8775
|
-
var require_Custom = __commonJS({
|
|
8776
|
-
"../../../../../../../../../../../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) {
|
|
8777
|
-
"use strict";
|
|
8778
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8779
|
-
value: true
|
|
8780
|
-
});
|
|
8781
|
-
var TokenError_1 = require_TokenError();
|
|
8782
|
-
var Parser_1 = require_Parser();
|
|
8783
|
-
var BNF;
|
|
8784
|
-
(function(BNF2) {
|
|
8785
|
-
BNF2.RULES = [
|
|
8786
|
-
{
|
|
8787
|
-
name: "Grammar",
|
|
8788
|
-
bnf: [
|
|
8789
|
-
[
|
|
8790
|
-
"RULE_S*",
|
|
8791
|
-
"Attributes?",
|
|
8792
|
-
"RULE_S*",
|
|
8793
|
-
"%Atomic*",
|
|
8794
|
-
"EOF"
|
|
8795
|
-
]
|
|
8796
|
-
]
|
|
8797
|
-
},
|
|
8798
|
-
{
|
|
8799
|
-
name: "%Atomic",
|
|
8800
|
-
bnf: [
|
|
8801
|
-
[
|
|
8802
|
-
"Production",
|
|
8803
|
-
"RULE_S*"
|
|
8804
|
-
]
|
|
8805
|
-
],
|
|
8806
|
-
fragment: true
|
|
8807
|
-
},
|
|
8808
|
-
{
|
|
8809
|
-
name: "Production",
|
|
8810
|
-
bnf: [
|
|
8811
|
-
[
|
|
8812
|
-
"NCName",
|
|
8813
|
-
"RULE_S*",
|
|
8814
|
-
'"::="',
|
|
8815
|
-
"RULE_WHITESPACE*",
|
|
8816
|
-
"%Choice",
|
|
8817
|
-
"RULE_WHITESPACE*",
|
|
8818
|
-
"Attributes?",
|
|
8819
|
-
"RULE_EOL+",
|
|
8820
|
-
"RULE_S*"
|
|
8821
|
-
]
|
|
8822
|
-
]
|
|
8823
|
-
},
|
|
8824
|
-
{
|
|
8825
|
-
name: "NCName",
|
|
8826
|
-
bnf: [
|
|
8827
|
-
[
|
|
8828
|
-
/[a-zA-Z][a-zA-Z_0-9]*/
|
|
8829
|
-
]
|
|
8830
|
-
]
|
|
8831
|
-
},
|
|
8832
|
-
{
|
|
8833
|
-
name: "Attributes",
|
|
8834
|
-
bnf: [
|
|
8835
|
-
[
|
|
8836
|
-
'"{"',
|
|
8837
|
-
"Attribute",
|
|
8838
|
-
"%Attributes*",
|
|
8839
|
-
"RULE_S*",
|
|
8840
|
-
'"}"'
|
|
8841
|
-
]
|
|
8842
|
-
]
|
|
8843
|
-
},
|
|
8844
|
-
{
|
|
8845
|
-
name: "%Attributes",
|
|
8846
|
-
bnf: [
|
|
8847
|
-
[
|
|
8848
|
-
"RULE_S*",
|
|
8849
|
-
'","',
|
|
8850
|
-
"Attribute"
|
|
8851
|
-
]
|
|
8852
|
-
],
|
|
8853
|
-
fragment: true
|
|
8854
|
-
},
|
|
8855
|
-
{
|
|
8856
|
-
name: "Attribute",
|
|
8857
|
-
bnf: [
|
|
8858
|
-
[
|
|
8859
|
-
"RULE_S*",
|
|
8860
|
-
"NCName",
|
|
8861
|
-
"RULE_WHITESPACE*",
|
|
8862
|
-
'"="',
|
|
8863
|
-
"RULE_WHITESPACE*",
|
|
8864
|
-
"AttributeValue"
|
|
8865
|
-
]
|
|
8866
|
-
]
|
|
8867
|
-
},
|
|
8868
|
-
{
|
|
8869
|
-
name: "AttributeValue",
|
|
8870
|
-
bnf: [
|
|
8871
|
-
[
|
|
8872
|
-
"NCName"
|
|
8873
|
-
],
|
|
8874
|
-
[
|
|
8875
|
-
/[1-9][0-9]*/
|
|
8876
|
-
]
|
|
8877
|
-
]
|
|
8878
|
-
},
|
|
8879
|
-
{
|
|
8880
|
-
name: "%Choice",
|
|
8881
|
-
bnf: [
|
|
8882
|
-
[
|
|
8883
|
-
"SequenceOrDifference",
|
|
8884
|
-
"%_Choice_1*"
|
|
8885
|
-
]
|
|
8886
|
-
],
|
|
8887
|
-
fragment: true
|
|
8888
|
-
},
|
|
8889
|
-
{
|
|
8890
|
-
name: "%_Choice_1",
|
|
8891
|
-
bnf: [
|
|
8892
|
-
[
|
|
8893
|
-
"RULE_S*",
|
|
8894
|
-
'"|"',
|
|
8895
|
-
"RULE_S*",
|
|
8896
|
-
"SequenceOrDifference"
|
|
8897
|
-
]
|
|
8898
|
-
],
|
|
8899
|
-
fragment: true
|
|
8900
|
-
},
|
|
8901
|
-
{
|
|
8902
|
-
name: "SequenceOrDifference",
|
|
8903
|
-
bnf: [
|
|
8904
|
-
[
|
|
8905
|
-
"%Item",
|
|
8906
|
-
"RULE_WHITESPACE*",
|
|
8907
|
-
"%_Item_1?"
|
|
8908
|
-
]
|
|
8909
|
-
]
|
|
8910
|
-
},
|
|
8911
|
-
{
|
|
8912
|
-
name: "%_Item_1",
|
|
8913
|
-
bnf: [
|
|
8914
|
-
[
|
|
8915
|
-
"Minus",
|
|
8916
|
-
"%Item"
|
|
8917
|
-
],
|
|
8918
|
-
[
|
|
8919
|
-
"%Item*"
|
|
8920
|
-
]
|
|
8921
|
-
],
|
|
8922
|
-
fragment: true
|
|
8923
|
-
},
|
|
8924
|
-
{
|
|
8925
|
-
name: "Minus",
|
|
8926
|
-
bnf: [
|
|
8927
|
-
[
|
|
8928
|
-
'"-"'
|
|
8929
|
-
]
|
|
8930
|
-
]
|
|
8931
|
-
},
|
|
8932
|
-
{
|
|
8933
|
-
name: "%Item",
|
|
8934
|
-
bnf: [
|
|
8935
|
-
[
|
|
8936
|
-
"RULE_WHITESPACE*",
|
|
8937
|
-
"PrimaryPreDecoration?",
|
|
8938
|
-
"%Primary",
|
|
8939
|
-
"PrimaryDecoration?"
|
|
8940
|
-
]
|
|
8941
|
-
],
|
|
8942
|
-
fragment: true
|
|
8943
|
-
},
|
|
8944
|
-
{
|
|
8945
|
-
name: "PrimaryDecoration",
|
|
8946
|
-
bnf: [
|
|
8947
|
-
[
|
|
8948
|
-
'"?"'
|
|
8949
|
-
],
|
|
8950
|
-
[
|
|
8951
|
-
'"*"'
|
|
8952
|
-
],
|
|
8953
|
-
[
|
|
8954
|
-
'"+"'
|
|
8955
|
-
]
|
|
8956
|
-
]
|
|
8957
|
-
},
|
|
8958
|
-
{
|
|
8959
|
-
name: "PrimaryPreDecoration",
|
|
8960
|
-
bnf: [
|
|
8961
|
-
[
|
|
8962
|
-
'"&"'
|
|
8963
|
-
],
|
|
8964
|
-
[
|
|
8965
|
-
'"!"'
|
|
8966
|
-
],
|
|
8967
|
-
[
|
|
8968
|
-
'"~"'
|
|
8969
|
-
]
|
|
8970
|
-
]
|
|
8971
|
-
},
|
|
8972
|
-
{
|
|
8973
|
-
name: "%Primary",
|
|
8974
|
-
bnf: [
|
|
8975
|
-
[
|
|
8976
|
-
"NCName"
|
|
8977
|
-
],
|
|
8978
|
-
[
|
|
8979
|
-
"StringLiteral"
|
|
8980
|
-
],
|
|
8981
|
-
[
|
|
8982
|
-
"CharCode"
|
|
8983
|
-
],
|
|
8984
|
-
[
|
|
8985
|
-
"CharClass"
|
|
8986
|
-
],
|
|
8987
|
-
[
|
|
8988
|
-
"SubItem"
|
|
8989
|
-
]
|
|
8990
|
-
],
|
|
8991
|
-
fragment: true
|
|
8992
|
-
},
|
|
8993
|
-
{
|
|
8994
|
-
name: "SubItem",
|
|
8995
|
-
bnf: [
|
|
8996
|
-
[
|
|
8997
|
-
'"("',
|
|
8998
|
-
"RULE_S*",
|
|
8999
|
-
"%Choice",
|
|
9000
|
-
"RULE_S*",
|
|
9001
|
-
'")"'
|
|
9002
|
-
]
|
|
9003
|
-
]
|
|
9004
|
-
},
|
|
9005
|
-
{
|
|
9006
|
-
name: "StringLiteral",
|
|
9007
|
-
bnf: [
|
|
9008
|
-
[
|
|
9009
|
-
"'\"'",
|
|
9010
|
-
/[^"]*/,
|
|
9011
|
-
"'\"'"
|
|
9012
|
-
],
|
|
9013
|
-
[
|
|
9014
|
-
'"\'"',
|
|
9015
|
-
/[^']*/,
|
|
9016
|
-
'"\'"'
|
|
9017
|
-
]
|
|
9018
|
-
]
|
|
9019
|
-
},
|
|
9020
|
-
{
|
|
9021
|
-
name: "CharCode",
|
|
9022
|
-
bnf: [
|
|
9023
|
-
[
|
|
9024
|
-
'"#x"',
|
|
9025
|
-
/[0-9a-zA-Z]+/
|
|
9026
|
-
]
|
|
9027
|
-
]
|
|
9028
|
-
},
|
|
9029
|
-
{
|
|
9030
|
-
name: "CharClass",
|
|
9031
|
-
bnf: [
|
|
9032
|
-
[
|
|
9033
|
-
"'['",
|
|
9034
|
-
"'^'?",
|
|
9035
|
-
"%RULE_CharClass_1+",
|
|
9036
|
-
'"]"'
|
|
9037
|
-
]
|
|
9038
|
-
]
|
|
9039
|
-
},
|
|
9040
|
-
{
|
|
9041
|
-
name: "%RULE_CharClass_1",
|
|
9042
|
-
bnf: [
|
|
9043
|
-
[
|
|
9044
|
-
"CharCodeRange"
|
|
9045
|
-
],
|
|
9046
|
-
[
|
|
9047
|
-
"CharRange"
|
|
9048
|
-
],
|
|
9049
|
-
[
|
|
9050
|
-
"CharCode"
|
|
9051
|
-
],
|
|
9052
|
-
[
|
|
9053
|
-
"RULE_Char"
|
|
9054
|
-
]
|
|
9055
|
-
],
|
|
9056
|
-
fragment: true
|
|
9057
|
-
},
|
|
9058
|
-
{
|
|
9059
|
-
name: "RULE_Char",
|
|
9060
|
-
bnf: [
|
|
9061
|
-
[
|
|
9062
|
-
/\x09/
|
|
9063
|
-
],
|
|
9064
|
-
[
|
|
9065
|
-
/\x0A/
|
|
9066
|
-
],
|
|
9067
|
-
[
|
|
9068
|
-
/\x0D/
|
|
9069
|
-
],
|
|
9070
|
-
[
|
|
9071
|
-
/[\x20-\x5c]/
|
|
9072
|
-
],
|
|
9073
|
-
[
|
|
9074
|
-
/[\x5e-\uD7FF]/
|
|
9075
|
-
],
|
|
9076
|
-
[
|
|
9077
|
-
/[\uE000-\uFFFD]/
|
|
9078
|
-
]
|
|
9079
|
-
]
|
|
9080
|
-
},
|
|
9081
|
-
{
|
|
9082
|
-
name: "CharRange",
|
|
9083
|
-
bnf: [
|
|
9084
|
-
[
|
|
9085
|
-
"RULE_Char",
|
|
9086
|
-
'"-"',
|
|
9087
|
-
"RULE_Char"
|
|
9088
|
-
]
|
|
9089
|
-
]
|
|
9090
|
-
},
|
|
9091
|
-
{
|
|
9092
|
-
name: "CharCodeRange",
|
|
9093
|
-
bnf: [
|
|
9094
|
-
[
|
|
9095
|
-
"CharCode",
|
|
9096
|
-
'"-"',
|
|
9097
|
-
"CharCode"
|
|
9098
|
-
]
|
|
9099
|
-
]
|
|
9100
|
-
},
|
|
9101
|
-
{
|
|
9102
|
-
name: "RULE_WHITESPACE",
|
|
9103
|
-
bnf: [
|
|
9104
|
-
[
|
|
9105
|
-
"%RULE_WHITESPACE_CHAR*"
|
|
9106
|
-
],
|
|
9107
|
-
[
|
|
9108
|
-
"Comment",
|
|
9109
|
-
"RULE_WHITESPACE*"
|
|
9110
|
-
]
|
|
9111
|
-
]
|
|
9112
|
-
},
|
|
9113
|
-
{
|
|
9114
|
-
name: "RULE_S",
|
|
9115
|
-
bnf: [
|
|
9116
|
-
[
|
|
9117
|
-
"RULE_WHITESPACE",
|
|
9118
|
-
"RULE_S*"
|
|
9119
|
-
],
|
|
9120
|
-
[
|
|
9121
|
-
"RULE_EOL",
|
|
9122
|
-
"RULE_S*"
|
|
9123
|
-
]
|
|
9124
|
-
]
|
|
9125
|
-
},
|
|
9126
|
-
{
|
|
9127
|
-
name: "%RULE_WHITESPACE_CHAR",
|
|
9128
|
-
bnf: [
|
|
9129
|
-
[
|
|
9130
|
-
/\x09/
|
|
9131
|
-
],
|
|
9132
|
-
[
|
|
9133
|
-
/\x20/
|
|
9134
|
-
]
|
|
9135
|
-
],
|
|
9136
|
-
fragment: true
|
|
9137
|
-
},
|
|
9138
|
-
{
|
|
9139
|
-
name: "Comment",
|
|
9140
|
-
bnf: [
|
|
9141
|
-
[
|
|
9142
|
-
'"/*"',
|
|
9143
|
-
"%RULE_Comment_Body*",
|
|
9144
|
-
'"*/"'
|
|
9145
|
-
]
|
|
9146
|
-
]
|
|
9147
|
-
},
|
|
9148
|
-
{
|
|
9149
|
-
name: "%RULE_Comment_Body",
|
|
9150
|
-
bnf: [
|
|
9151
|
-
[
|
|
9152
|
-
/[^*]/
|
|
9153
|
-
],
|
|
9154
|
-
[
|
|
9155
|
-
'"*"+',
|
|
9156
|
-
/[^/]*/
|
|
9157
|
-
]
|
|
9158
|
-
],
|
|
9159
|
-
fragment: true
|
|
9160
|
-
},
|
|
9161
|
-
{
|
|
9162
|
-
name: "RULE_EOL",
|
|
9163
|
-
bnf: [
|
|
9164
|
-
[
|
|
9165
|
-
/\x0D/,
|
|
9166
|
-
/\x0A/
|
|
9167
|
-
],
|
|
9168
|
-
[
|
|
9169
|
-
/\x0A/
|
|
9170
|
-
],
|
|
9171
|
-
[
|
|
9172
|
-
/\x0D/
|
|
9173
|
-
]
|
|
9174
|
-
]
|
|
9175
|
-
},
|
|
9176
|
-
{
|
|
9177
|
-
name: "Link",
|
|
9178
|
-
bnf: [
|
|
9179
|
-
[
|
|
9180
|
-
"'['",
|
|
9181
|
-
"Url",
|
|
9182
|
-
"']'"
|
|
9183
|
-
]
|
|
9184
|
-
]
|
|
9185
|
-
},
|
|
9186
|
-
{
|
|
9187
|
-
name: "Url",
|
|
9188
|
-
bnf: [
|
|
9189
|
-
[
|
|
9190
|
-
/[^\x5D:/?#]/,
|
|
9191
|
-
'"://"',
|
|
9192
|
-
/[^\x5D#]+/,
|
|
9193
|
-
"%Url1?"
|
|
9194
|
-
]
|
|
9195
|
-
]
|
|
9196
|
-
},
|
|
9197
|
-
{
|
|
9198
|
-
name: "%Url1",
|
|
9199
|
-
bnf: [
|
|
9200
|
-
[
|
|
9201
|
-
'"#"',
|
|
9202
|
-
"NCName"
|
|
9203
|
-
]
|
|
9204
|
-
],
|
|
9205
|
-
fragment: true
|
|
9206
|
-
}
|
|
9207
|
-
];
|
|
9208
|
-
BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, {
|
|
9209
|
-
debug: false
|
|
9210
|
-
});
|
|
9211
|
-
var preDecorationRE = /^(!|&)/;
|
|
9212
|
-
var decorationRE = /(\?|\+|\*)$/;
|
|
9213
|
-
var subExpressionRE = /^%/;
|
|
9214
|
-
function getBNFRule(name, parser2) {
|
|
9215
|
-
if (typeof name == "string") {
|
|
9216
|
-
var decoration = decorationRE.exec(name);
|
|
9217
|
-
var preDecoration = preDecorationRE.exec(name);
|
|
9218
|
-
var preDecorationText = preDecoration ? preDecoration[0] : "";
|
|
9219
|
-
var decorationText = decoration ? decoration[0] + " " : "";
|
|
9220
|
-
var subexpression = subExpressionRE.test(name);
|
|
9221
|
-
if (subexpression) {
|
|
9222
|
-
var lonely = isLonelyRule(name, parser2);
|
|
9223
|
-
if (lonely) return preDecorationText + getBNFBody(name, parser2) + decorationText;
|
|
9224
|
-
return preDecorationText + "(" + getBNFBody(name, parser2) + ")" + decorationText;
|
|
9225
|
-
}
|
|
9226
|
-
return name.replace(preDecorationRE, preDecorationText);
|
|
9227
|
-
} else {
|
|
9228
|
-
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]");
|
|
9229
|
-
}
|
|
9230
|
-
}
|
|
9231
|
-
function isLonelyRule(name, parser2) {
|
|
9232
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
9233
|
-
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] == "'");
|
|
9234
|
-
}
|
|
9235
|
-
function getBNFChoice(rules, parser2) {
|
|
9236
|
-
return rules.map(function(x) {
|
|
9237
|
-
return getBNFRule(x, parser2);
|
|
9238
|
-
}).join(" ");
|
|
9239
|
-
}
|
|
9240
|
-
function getBNFBody(name, parser2) {
|
|
9241
|
-
var rule = Parser_1.findRuleByName(name, parser2);
|
|
9242
|
-
if (rule) return rule.bnf.map(function(x) {
|
|
9243
|
-
return getBNFChoice(x, parser2);
|
|
9244
|
-
}).join(" | ");
|
|
9245
|
-
return "RULE_NOT_FOUND {" + name + "}";
|
|
9246
|
-
}
|
|
9247
|
-
function emit(parser2) {
|
|
9248
|
-
var acumulator = [];
|
|
9249
|
-
parser2.grammarRules.forEach(function(l) {
|
|
9250
|
-
if (!/^%/.test(l.name)) {
|
|
9251
|
-
var recover = l.recover ? " { recoverUntil=" + l.recover + " }" : "";
|
|
9252
|
-
acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser2) + recover);
|
|
9253
|
-
}
|
|
9254
|
-
});
|
|
9255
|
-
return acumulator.join("\n");
|
|
9256
|
-
}
|
|
9257
|
-
BNF2.emit = emit;
|
|
9258
|
-
var subitems = 0;
|
|
9259
|
-
function restar(total, resta) {
|
|
9260
|
-
console.log("reberia restar " + resta + " a " + total);
|
|
9261
|
-
throw new Error("Difference not supported yet");
|
|
9262
|
-
}
|
|
9263
|
-
function convertRegex(txt) {
|
|
9264
|
-
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"));
|
|
9265
|
-
}
|
|
9266
|
-
function getSubItems(tmpRules, seq, parentName, parentAttributes) {
|
|
9267
|
-
var anterior = null;
|
|
9268
|
-
var bnfSeq = [];
|
|
9269
|
-
seq.children.forEach(function(x, i) {
|
|
9270
|
-
if (x.type == "Minus") {
|
|
9271
|
-
restar(anterior, x);
|
|
9272
|
-
} else {}
|
|
9273
|
-
var decoration = seq.children[i + 1];
|
|
9274
|
-
decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || "";
|
|
9275
|
-
var preDecoration = "";
|
|
9276
|
-
if (anterior && anterior.type == "PrimaryPreDecoration") {
|
|
9277
|
-
preDecoration = anterior.text;
|
|
9278
|
-
}
|
|
9279
|
-
var pinned = preDecoration == "~" ? 1 : void 0;
|
|
9280
|
-
if (pinned) {
|
|
9281
|
-
preDecoration = "";
|
|
9282
|
-
}
|
|
9283
|
-
switch(x.type){
|
|
9284
|
-
case "SubItem":
|
|
9285
|
-
var name = "%" + (parentName + subitems++);
|
|
9286
|
-
createRule(tmpRules, x, name, parentAttributes);
|
|
9287
|
-
bnfSeq.push(preDecoration + name + decoration);
|
|
9288
|
-
break;
|
|
9289
|
-
case "NCName":
|
|
9290
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
9291
|
-
break;
|
|
9292
|
-
case "StringLiteral":
|
|
9293
|
-
if (decoration || preDecoration || !/^['"/()a-zA-Z0-9&_.:=,+*\-\^\\]+$/.test(x.text)) {
|
|
9294
|
-
bnfSeq.push(preDecoration + x.text + decoration);
|
|
9295
|
-
} else {
|
|
9296
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
9297
|
-
try {
|
|
9298
|
-
for(var _iterator = x.text.slice(1, -1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
9299
|
-
var c = _step.value;
|
|
9300
|
-
if (parentAttributes && parentAttributes["ignoreCase"] == "true" && /[a-zA-Z]/.test(c)) {
|
|
9301
|
-
bnfSeq.push(new RegExp("[" + c.toUpperCase() + c.toLowerCase() + "]"));
|
|
9302
|
-
} else {
|
|
9303
|
-
bnfSeq.push(new RegExp(Parser_1.escapeRegExp(c)));
|
|
9304
|
-
}
|
|
9305
|
-
}
|
|
9306
|
-
} catch (err) {
|
|
9307
|
-
_didIteratorError = true;
|
|
9308
|
-
_iteratorError = err;
|
|
9309
|
-
} finally{
|
|
9310
|
-
try {
|
|
9311
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
9312
|
-
_iterator.return();
|
|
9313
|
-
}
|
|
9314
|
-
} finally{
|
|
9315
|
-
if (_didIteratorError) {
|
|
9316
|
-
throw _iteratorError;
|
|
9317
|
-
}
|
|
9318
|
-
}
|
|
9319
|
-
}
|
|
9320
|
-
}
|
|
9321
|
-
break;
|
|
9322
|
-
case "CharCode":
|
|
9323
|
-
case "CharClass":
|
|
9324
|
-
if (decoration || preDecoration) {
|
|
9325
|
-
var newRule = {
|
|
9326
|
-
name: "%" + (parentName + subitems++),
|
|
9327
|
-
bnf: [
|
|
9328
|
-
[
|
|
9329
|
-
convertRegex(x.text)
|
|
9330
|
-
]
|
|
9331
|
-
],
|
|
9332
|
-
pinned: pinned
|
|
9333
|
-
};
|
|
9334
|
-
tmpRules.push(newRule);
|
|
9335
|
-
bnfSeq.push(preDecoration + newRule.name + decoration);
|
|
9336
|
-
} else {
|
|
9337
|
-
bnfSeq.push(convertRegex(x.text));
|
|
9338
|
-
}
|
|
9339
|
-
break;
|
|
9340
|
-
case "PrimaryPreDecoration":
|
|
9341
|
-
case "PrimaryDecoration":
|
|
9342
|
-
break;
|
|
9343
|
-
default:
|
|
9344
|
-
throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text));
|
|
9345
|
-
}
|
|
9346
|
-
anterior = x;
|
|
9347
|
-
});
|
|
9348
|
-
return bnfSeq;
|
|
9349
|
-
}
|
|
9350
|
-
function createRule(tmpRules, token, name) {
|
|
9351
|
-
var parentAttributes = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : void 0;
|
|
9352
|
-
var attrNode = token.children.filter(function(x) {
|
|
9353
|
-
return x.type == "Attributes";
|
|
9354
|
-
})[0];
|
|
9355
|
-
var attributes = {};
|
|
9356
|
-
if (attrNode) {
|
|
9357
|
-
attrNode.children.forEach(function(x) {
|
|
9358
|
-
var name2 = x.children.filter(function(x2) {
|
|
9359
|
-
return x2.type == "NCName";
|
|
9360
|
-
})[0].text;
|
|
9361
|
-
if (name2 in attributes) {
|
|
9362
|
-
throw new TokenError_1.TokenError("Duplicated attribute " + name2, x);
|
|
9363
|
-
} else {
|
|
9364
|
-
attributes[name2] = x.children.filter(function(x2) {
|
|
9365
|
-
return x2.type == "AttributeValue";
|
|
9366
|
-
})[0].text;
|
|
9367
|
-
}
|
|
9368
|
-
});
|
|
9369
|
-
}
|
|
9370
|
-
var bnf = token.children.filter(function(x) {
|
|
9371
|
-
return x.type == "SequenceOrDifference";
|
|
9372
|
-
}).map(function(s) {
|
|
9373
|
-
return getSubItems(tmpRules, s, name, parentAttributes ? parentAttributes : attributes);
|
|
9374
|
-
});
|
|
9375
|
-
var rule = {
|
|
9376
|
-
name: name,
|
|
9377
|
-
bnf: bnf
|
|
9378
|
-
};
|
|
9379
|
-
if (name.indexOf("%") == 0) rule.fragment = true;
|
|
9380
|
-
if (attributes["recoverUntil"]) {
|
|
9381
|
-
rule.recover = attributes["recoverUntil"];
|
|
9382
|
-
if (rule.bnf.length > 1) throw new TokenError_1.TokenError("only one-option productions are suitable for error recovering", token);
|
|
9383
|
-
}
|
|
9384
|
-
if ("pin" in attributes) {
|
|
9385
|
-
var num = parseInt(attributes["pin"]);
|
|
9386
|
-
if (!isNaN(num)) {
|
|
9387
|
-
rule.pinned = num;
|
|
9388
|
-
}
|
|
9389
|
-
if (rule.bnf.length > 1) throw new TokenError_1.TokenError("only one-option productions are suitable for pinning", token);
|
|
9390
|
-
}
|
|
9391
|
-
if ("ws" in attributes) {
|
|
9392
|
-
rule.implicitWs = attributes["ws"] != "explicit";
|
|
9393
|
-
} else {
|
|
9394
|
-
rule.implicitWs = null;
|
|
9395
|
-
}
|
|
9396
|
-
rule.fragment = rule.fragment || attributes["fragment"] == "true";
|
|
9397
|
-
rule.simplifyWhenOneChildren = attributes["simplifyWhenOneChildren"] == "true";
|
|
9398
|
-
tmpRules.push(rule);
|
|
9399
|
-
}
|
|
9400
|
-
function getRules(source) {
|
|
9401
|
-
var parser2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
9402
|
-
var ast = parser2.getAST(source);
|
|
9403
|
-
if (!ast) throw new Error("Could not parse " + source);
|
|
9404
|
-
if (ast.errors && ast.errors.length) {
|
|
9405
|
-
throw ast.errors[0];
|
|
9406
|
-
}
|
|
9407
|
-
var implicitWs = null;
|
|
9408
|
-
var attrNode = ast.children.filter(function(x) {
|
|
9409
|
-
return x.type == "Attributes";
|
|
9410
|
-
})[0];
|
|
9411
|
-
var attributes = {};
|
|
9412
|
-
if (attrNode) {
|
|
9413
|
-
attrNode.children.forEach(function(x) {
|
|
9414
|
-
var name = x.children.filter(function(x2) {
|
|
9415
|
-
return x2.type == "NCName";
|
|
9416
|
-
})[0].text;
|
|
9417
|
-
if (name in attributes) {
|
|
9418
|
-
throw new TokenError_1.TokenError("Duplicated attribute " + name, x);
|
|
9419
|
-
} else {
|
|
9420
|
-
attributes[name] = x.children.filter(function(x2) {
|
|
9421
|
-
return x2.type == "AttributeValue";
|
|
9422
|
-
})[0].text;
|
|
9423
|
-
}
|
|
9424
|
-
});
|
|
9425
|
-
}
|
|
9426
|
-
implicitWs = attributes["ws"] == "implicit";
|
|
9427
|
-
var tmpRules = [];
|
|
9428
|
-
ast.children.filter(function(x) {
|
|
9429
|
-
return x.type == "Production";
|
|
9430
|
-
}).map(function(x) {
|
|
9431
|
-
var name = x.children.filter(function(x2) {
|
|
9432
|
-
return x2.type == "NCName";
|
|
9433
|
-
})[0].text;
|
|
9434
|
-
createRule(tmpRules, x, name);
|
|
9435
|
-
});
|
|
9436
|
-
tmpRules.forEach(function(rule) {
|
|
9437
|
-
if (rule.implicitWs === null) rule.implicitWs = implicitWs;
|
|
9438
|
-
});
|
|
9439
|
-
return tmpRules;
|
|
9440
|
-
}
|
|
9441
|
-
BNF2.getRules = getRules;
|
|
9442
|
-
function Transform(source) {
|
|
9443
|
-
var subParser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : BNF2.defaultParser;
|
|
9444
|
-
return getRules(source.join(""), subParser);
|
|
9445
|
-
}
|
|
9446
|
-
BNF2.Transform = Transform;
|
|
9447
|
-
var Parser2 = /*#__PURE__*/ function(_Parser_1_Parser) {
|
|
9448
|
-
_inherits(Parser2, _Parser_1_Parser);
|
|
9449
|
-
var _super = _create_super(Parser2);
|
|
9450
|
-
function Parser2(source, options) {
|
|
9451
|
-
_class_call_check(this, Parser2);
|
|
9452
|
-
var subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, {
|
|
9453
|
-
debug: true
|
|
9454
|
-
}) : BNF2.defaultParser;
|
|
9455
|
-
return _super.call(this, getRules(source, subParser), options);
|
|
9456
|
-
}
|
|
9457
|
-
_create_class(Parser2, [
|
|
9458
|
-
{
|
|
9459
|
-
key: "emitSource",
|
|
9460
|
-
value: function emitSource() {
|
|
9461
|
-
return emit(this);
|
|
9462
|
-
}
|
|
9463
|
-
}
|
|
9464
|
-
]);
|
|
9465
|
-
return Parser2;
|
|
9466
|
-
}(Parser_1.Parser);
|
|
9467
|
-
BNF2.Parser = Parser2;
|
|
9468
|
-
})(BNF || (BNF = {}));
|
|
9469
|
-
exports.default = BNF;
|
|
9470
|
-
}
|
|
9471
|
-
});
|
|
9472
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/Grammars/index.js
|
|
9473
|
-
var require_Grammars = __commonJS({
|
|
9474
|
-
"../../../../../../../../../../../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) {
|
|
9475
|
-
"use strict";
|
|
9476
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9477
|
-
value: true
|
|
9478
|
-
});
|
|
9479
|
-
var BNF_1 = require_BNF();
|
|
9480
|
-
Object.defineProperty(exports, "BNF", {
|
|
9481
|
-
enumerable: true,
|
|
9482
|
-
get: function get() {
|
|
9483
|
-
return BNF_1.default;
|
|
9484
|
-
}
|
|
9485
|
-
});
|
|
9486
|
-
var W3CEBNF_1 = require_W3CEBNF();
|
|
9487
|
-
Object.defineProperty(exports, "W3C", {
|
|
9488
|
-
enumerable: true,
|
|
9489
|
-
get: function get() {
|
|
9490
|
-
return W3CEBNF_1.default;
|
|
9491
|
-
}
|
|
9492
|
-
});
|
|
9493
|
-
var Custom_1 = require_Custom();
|
|
9494
|
-
Object.defineProperty(exports, "Custom", {
|
|
9495
|
-
enumerable: true,
|
|
9496
|
-
get: function get() {
|
|
9497
|
-
return Custom_1.default;
|
|
9498
|
-
}
|
|
9499
|
-
});
|
|
9500
|
-
}
|
|
9501
|
-
});
|
|
9502
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/index.js
|
|
9503
|
-
var require_dist = __commonJS({
|
|
9504
|
-
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/ebnf@1.9.1/node_modules/ebnf/dist/index.js": function(exports) {
|
|
9505
|
-
"use strict";
|
|
9506
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9507
|
-
value: true
|
|
9508
|
-
});
|
|
9509
|
-
var Parser_1 = require_Parser();
|
|
9510
|
-
Object.defineProperty(exports, "Parser", {
|
|
9511
|
-
enumerable: true,
|
|
9512
|
-
get: function get() {
|
|
9513
|
-
return Parser_1.Parser;
|
|
9514
|
-
}
|
|
9515
|
-
});
|
|
9516
|
-
var TokenError_1 = require_TokenError();
|
|
9517
|
-
Object.defineProperty(exports, "TokenError", {
|
|
9518
|
-
enumerable: true,
|
|
9519
|
-
get: function get() {
|
|
9520
|
-
return TokenError_1.TokenError;
|
|
9521
|
-
}
|
|
9522
|
-
});
|
|
9523
|
-
exports.Grammars = require_Grammars();
|
|
9524
|
-
}
|
|
9525
|
-
});
|
|
9526
5944
|
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/timm@1.7.1/node_modules/timm/lib/timm.js
|
|
9527
5945
|
var require_timm = __commonJS({
|
|
9528
5946
|
"../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/timm@1.7.1/node_modules/timm/lib/timm.js": function(exports) {
|
|
@@ -9615,14 +6033,14 @@ var MarkdownPlugin = function() {
|
|
|
9615
6033
|
result[idx] = newItem;
|
|
9616
6034
|
return result;
|
|
9617
6035
|
}
|
|
9618
|
-
function getIn(obj,
|
|
9619
|
-
if (!Array.isArray(
|
|
6036
|
+
function getIn(obj, path) {
|
|
6037
|
+
if (!Array.isArray(path)) {
|
|
9620
6038
|
throwStr(IS_DEV ? "A path array should be provided when calling getIn()" : INVALID_ARGS);
|
|
9621
6039
|
}
|
|
9622
6040
|
if (obj == null) return void 0;
|
|
9623
6041
|
var ptr = obj;
|
|
9624
|
-
for(var i = 0; i <
|
|
9625
|
-
var key =
|
|
6042
|
+
for(var i = 0; i < path.length; i++){
|
|
6043
|
+
var key = path[i];
|
|
9626
6044
|
ptr = ptr != null ? ptr[key] : void 0;
|
|
9627
6045
|
if (ptr === void 0) return ptr;
|
|
9628
6046
|
}
|
|
@@ -9636,18 +6054,18 @@ var MarkdownPlugin = function() {
|
|
|
9636
6054
|
obj2[key] = val;
|
|
9637
6055
|
return obj2;
|
|
9638
6056
|
}
|
|
9639
|
-
function setIn8(obj,
|
|
9640
|
-
if (!
|
|
9641
|
-
return doSetIn(obj,
|
|
6057
|
+
function setIn8(obj, path, val) {
|
|
6058
|
+
if (!path.length) return val;
|
|
6059
|
+
return doSetIn(obj, path, val, 0);
|
|
9642
6060
|
}
|
|
9643
|
-
function doSetIn(obj,
|
|
6061
|
+
function doSetIn(obj, path, val, idx) {
|
|
9644
6062
|
var newValue;
|
|
9645
|
-
var key =
|
|
9646
|
-
if (idx ===
|
|
6063
|
+
var key = path[idx];
|
|
6064
|
+
if (idx === path.length - 1) {
|
|
9647
6065
|
newValue = val;
|
|
9648
6066
|
} else {
|
|
9649
|
-
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof
|
|
9650
|
-
newValue = doSetIn(nestedObj,
|
|
6067
|
+
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === "number" ? [] : {};
|
|
6068
|
+
newValue = doSetIn(nestedObj, path, val, idx + 1);
|
|
9651
6069
|
}
|
|
9652
6070
|
return set2(obj, key, newValue);
|
|
9653
6071
|
}
|
|
@@ -9656,10 +6074,10 @@ var MarkdownPlugin = function() {
|
|
|
9656
6074
|
var nextVal = fnUpdate(prevVal);
|
|
9657
6075
|
return set2(obj, key, nextVal);
|
|
9658
6076
|
}
|
|
9659
|
-
function updateIn(obj,
|
|
9660
|
-
var prevVal = getIn(obj,
|
|
6077
|
+
function updateIn(obj, path, fnUpdate) {
|
|
6078
|
+
var prevVal = getIn(obj, path);
|
|
9661
6079
|
var nextVal = fnUpdate(prevVal);
|
|
9662
|
-
return setIn8(obj,
|
|
6080
|
+
return setIn8(obj, path, nextVal);
|
|
9663
6081
|
}
|
|
9664
6082
|
function merge(a, b, c, d, e, f) {
|
|
9665
6083
|
for(var _len = arguments.length, rest = new Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++){
|
|
@@ -9695,11 +6113,11 @@ var MarkdownPlugin = function() {
|
|
|
9695
6113
|
f
|
|
9696
6114
|
].concat(_to_consumable_array(rest))) : doMerge(false, true, a, b, c, d, e, f);
|
|
9697
6115
|
}
|
|
9698
|
-
function mergeIn(a,
|
|
6116
|
+
function mergeIn(a, path, b, c, d, e, f) {
|
|
9699
6117
|
for(var _len = arguments.length, rest = new Array(_len > 7 ? _len - 7 : 0), _key = 7; _key < _len; _key++){
|
|
9700
6118
|
rest[_key - 7] = arguments[_key];
|
|
9701
6119
|
}
|
|
9702
|
-
var prevVal = getIn(a,
|
|
6120
|
+
var prevVal = getIn(a, path);
|
|
9703
6121
|
if (prevVal == null) prevVal = {};
|
|
9704
6122
|
var nextVal;
|
|
9705
6123
|
if (rest.length) {
|
|
@@ -9718,7 +6136,7 @@ var MarkdownPlugin = function() {
|
|
|
9718
6136
|
} else {
|
|
9719
6137
|
nextVal = doMerge(false, false, prevVal, b, c, d, e, f);
|
|
9720
6138
|
}
|
|
9721
|
-
return setIn8(a,
|
|
6139
|
+
return setIn8(a, path, nextVal);
|
|
9722
6140
|
}
|
|
9723
6141
|
function omit4(obj, attrs) {
|
|
9724
6142
|
var omitList = Array.isArray(attrs) ? attrs : [
|
|
@@ -10220,9 +6638,6 @@ var MarkdownPlugin = function() {
|
|
|
10220
6638
|
}(Hook);
|
|
10221
6639
|
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+player@0.0.0/node_modules/@player-ui/player/dist/index.mjs
|
|
10222
6640
|
var import_ts_nested_error = __toESM(require_nested_error(), 1);
|
|
10223
|
-
var import_arr_flatten = __toESM(require_arr_flatten(), 1);
|
|
10224
|
-
var import_parsimmon = __toESM(require_parsimmon(), 1);
|
|
10225
|
-
var import_ebnf = __toESM(require_dist(), 1);
|
|
10226
6641
|
var import_ts_nested_error2 = __toESM(require_nested_error(), 1);
|
|
10227
6642
|
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+player@0.0.0/node_modules/@player-ui/player/dist/index.mjs
|
|
10228
6643
|
var import_timm = __toESM(require_timm(), 1);
|
|
@@ -10346,20 +6761,20 @@ var MarkdownPlugin = function() {
|
|
|
10346
6761
|
// ../../../../../../../../../../../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
|
|
10347
6762
|
var import_sorted_array = __toESM(require_sorted_array(), 1);
|
|
10348
6763
|
function traverseObj(object) {
|
|
10349
|
-
var
|
|
6764
|
+
var path = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], pairs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : /* @__PURE__ */ new Map();
|
|
10350
6765
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10351
6766
|
try {
|
|
10352
6767
|
for(var _iterator = Object.keys(object)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
10353
6768
|
var key = _step.value;
|
|
10354
6769
|
"";
|
|
10355
6770
|
var val = object[key];
|
|
10356
|
-
var
|
|
6771
|
+
var nestedPath = _to_consumable_array(path).concat([
|
|
10357
6772
|
key
|
|
10358
6773
|
]);
|
|
10359
6774
|
if (typeof val === "object") {
|
|
10360
|
-
traverseObj(val,
|
|
6775
|
+
traverseObj(val, nestedPath, pairs);
|
|
10361
6776
|
} else {
|
|
10362
|
-
pairs.set(
|
|
6777
|
+
pairs.set(nestedPath, val);
|
|
10363
6778
|
}
|
|
10364
6779
|
}
|
|
10365
6780
|
} catch (err) {
|
|
@@ -10407,12 +6822,12 @@ var MarkdownPlugin = function() {
|
|
|
10407
6822
|
},
|
|
10408
6823
|
{
|
|
10409
6824
|
/** Fetch the best match in the registry */ key: "get",
|
|
10410
|
-
value: function get(
|
|
6825
|
+
value: function get(query) {
|
|
10411
6826
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10412
6827
|
try {
|
|
10413
6828
|
for(var _iterator = this.store.array[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
10414
6829
|
var entry = _step.value;
|
|
10415
|
-
if (entry.matcher(
|
|
6830
|
+
if (entry.matcher(query)) {
|
|
10416
6831
|
return entry.value;
|
|
10417
6832
|
}
|
|
10418
6833
|
}
|
|
@@ -10486,10 +6901,10 @@ var MarkdownPlugin = function() {
|
|
|
10486
6901
|
value: value
|
|
10487
6902
|
};
|
|
10488
6903
|
};
|
|
10489
|
-
var toPath = function(
|
|
6904
|
+
var toPath = function(path) {
|
|
10490
6905
|
return {
|
|
10491
6906
|
name: "PathNode",
|
|
10492
|
-
path:
|
|
6907
|
+
path: path
|
|
10493
6908
|
};
|
|
10494
6909
|
};
|
|
10495
6910
|
var toQuery = function(key, value) {
|
|
@@ -10508,30 +6923,6 @@ var MarkdownPlugin = function() {
|
|
|
10508
6923
|
value: values
|
|
10509
6924
|
};
|
|
10510
6925
|
};
|
|
10511
|
-
var doubleQuote = import_parsimmon.default.string('"');
|
|
10512
|
-
var singleQuote = import_parsimmon.default.string("'");
|
|
10513
|
-
var backTick = import_parsimmon.default.string("`");
|
|
10514
|
-
var identifier = import_parsimmon.default.regex(/[\w\-@]+/).desc("identifier").map(toValue);
|
|
10515
|
-
var path;
|
|
10516
|
-
var futurePath = import_parsimmon.default.lazy(function() {
|
|
10517
|
-
return path;
|
|
10518
|
-
});
|
|
10519
|
-
var nestedPath = futurePath.trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("{{"), import_parsimmon.default.string("}}")).map(toPath);
|
|
10520
|
-
var nestedExpression = import_parsimmon.default.regex(/[^`]*/).wrap(backTick, backTick).map(toExpression);
|
|
10521
|
-
var segment = import_parsimmon.default.alt(identifier, nestedPath, nestedExpression).atLeast(1).map(import_arr_flatten.default).map(toConcatenatedNode);
|
|
10522
|
-
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);
|
|
10523
|
-
var query = import_parsimmon.default.seq(optionallyQuotedSegment, import_parsimmon.default.string("=").times(1, 3).trim(import_parsimmon.default.optWhitespace), optionallyQuotedSegment).map(function(param) {
|
|
10524
|
-
var _param = _sliced_to_array(param, 3), key = _param[0], value = _param[2];
|
|
10525
|
-
return toQuery(key, value);
|
|
10526
|
-
});
|
|
10527
|
-
var brackets = import_parsimmon.default.alt(query, optionallyQuotedSegment).trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("["), import_parsimmon.default.string("]")).many();
|
|
10528
|
-
var segmentAndBrackets = import_parsimmon.default.seqMap(segment, brackets, function(s, bs) {
|
|
10529
|
-
return [
|
|
10530
|
-
s
|
|
10531
|
-
].concat(_to_consumable_array(bs));
|
|
10532
|
-
});
|
|
10533
|
-
path = import_parsimmon.default.sepBy(segmentAndBrackets, import_parsimmon.default.string(".")).map(import_arr_flatten.default);
|
|
10534
|
-
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');
|
|
10535
6926
|
var SEGMENT_SEPARATOR = ".";
|
|
10536
6927
|
var OPEN_CURL = "{";
|
|
10537
6928
|
var CLOSE_CURL = "}";
|
|
@@ -10561,14 +6952,14 @@ var MarkdownPlugin = function() {
|
|
|
10561
6952
|
charCode === 125;
|
|
10562
6953
|
return !matches;
|
|
10563
6954
|
};
|
|
10564
|
-
var parse = function(
|
|
6955
|
+
var parse = function(path) {
|
|
10565
6956
|
var index2 = 1;
|
|
10566
|
-
var ch =
|
|
6957
|
+
var ch = path.charAt(0);
|
|
10567
6958
|
var next = function(expected) {
|
|
10568
6959
|
if (expected && ch !== expected) {
|
|
10569
6960
|
throw new Error("Expected char: ".concat(expected, " but got: ").concat(ch));
|
|
10570
6961
|
}
|
|
10571
|
-
ch =
|
|
6962
|
+
ch = path.charAt(index2);
|
|
10572
6963
|
index2 += 1;
|
|
10573
6964
|
return ch;
|
|
10574
6965
|
};
|
|
@@ -10577,7 +6968,7 @@ var MarkdownPlugin = function() {
|
|
|
10577
6968
|
next();
|
|
10578
6969
|
}
|
|
10579
6970
|
};
|
|
10580
|
-
var
|
|
6971
|
+
var identifier = function() {
|
|
10581
6972
|
if (!isIdentifierChar(ch)) {
|
|
10582
6973
|
return;
|
|
10583
6974
|
}
|
|
@@ -10623,7 +7014,7 @@ var MarkdownPlugin = function() {
|
|
|
10623
7014
|
return toValue(value);
|
|
10624
7015
|
}
|
|
10625
7016
|
};
|
|
10626
|
-
var
|
|
7017
|
+
var nestedPath = function() {
|
|
10627
7018
|
if (ch === OPEN_CURL) {
|
|
10628
7019
|
next(OPEN_CURL);
|
|
10629
7020
|
next(OPEN_CURL);
|
|
@@ -10634,10 +7025,10 @@ var MarkdownPlugin = function() {
|
|
|
10634
7025
|
}
|
|
10635
7026
|
};
|
|
10636
7027
|
var simpleSegment = function() {
|
|
10637
|
-
var
|
|
10638
|
-
return (_ref = (
|
|
7028
|
+
var _nestedPath, _ref;
|
|
7029
|
+
return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
|
|
10639
7030
|
};
|
|
10640
|
-
var
|
|
7031
|
+
var segment = function() {
|
|
10641
7032
|
var segments = [];
|
|
10642
7033
|
var nextSegment = simpleSegment();
|
|
10643
7034
|
while(nextSegment !== void 0){
|
|
@@ -10649,13 +7040,13 @@ var MarkdownPlugin = function() {
|
|
|
10649
7040
|
}
|
|
10650
7041
|
return toConcatenatedNode(segments);
|
|
10651
7042
|
};
|
|
10652
|
-
var
|
|
7043
|
+
var optionallyQuotedSegment = function() {
|
|
10653
7044
|
whitespace();
|
|
10654
7045
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
10655
|
-
var
|
|
10656
|
-
next(
|
|
7046
|
+
var singleQuote = ch === SINGLE_QUOTE;
|
|
7047
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
10657
7048
|
var id = regex(/[^'"]+/);
|
|
10658
|
-
next(
|
|
7049
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
10659
7050
|
return id;
|
|
10660
7051
|
}
|
|
10661
7052
|
return simpleSegment();
|
|
@@ -10673,12 +7064,12 @@ var MarkdownPlugin = function() {
|
|
|
10673
7064
|
if (ch === OPEN_BRACKET) {
|
|
10674
7065
|
next(OPEN_BRACKET);
|
|
10675
7066
|
whitespace();
|
|
10676
|
-
var value =
|
|
7067
|
+
var value = optionallyQuotedSegment();
|
|
10677
7068
|
if (value) {
|
|
10678
7069
|
whitespace();
|
|
10679
7070
|
if (equals()) {
|
|
10680
7071
|
whitespace();
|
|
10681
|
-
var second =
|
|
7072
|
+
var second = optionallyQuotedSegment();
|
|
10682
7073
|
value = toQuery(value, second);
|
|
10683
7074
|
whitespace();
|
|
10684
7075
|
}
|
|
@@ -10693,7 +7084,7 @@ var MarkdownPlugin = function() {
|
|
|
10693
7084
|
};
|
|
10694
7085
|
var parseSegmentAndBrackets = function() {
|
|
10695
7086
|
var parsed = [];
|
|
10696
|
-
var firstSegment =
|
|
7087
|
+
var firstSegment = segment();
|
|
10697
7088
|
if (firstSegment) {
|
|
10698
7089
|
parsed.push(firstSegment);
|
|
10699
7090
|
var bracketSegment = parseBracket();
|
|
@@ -10741,12 +7132,12 @@ var MarkdownPlugin = function() {
|
|
|
10741
7132
|
};
|
|
10742
7133
|
_class_call_check(this, _BindingInstance);
|
|
10743
7134
|
var split = Array.isArray(raw) ? raw : raw.split(".");
|
|
10744
|
-
this.split = split.map(function(
|
|
10745
|
-
if (typeof
|
|
10746
|
-
return
|
|
7135
|
+
this.split = split.map(function(segment) {
|
|
7136
|
+
if (typeof segment === "number") {
|
|
7137
|
+
return segment;
|
|
10747
7138
|
}
|
|
10748
|
-
var tryNum = Number(
|
|
10749
|
-
return isNaN(tryNum) ?
|
|
7139
|
+
var tryNum = Number(segment);
|
|
7140
|
+
return isNaN(tryNum) ? segment : tryNum;
|
|
10750
7141
|
});
|
|
10751
7142
|
Object.freeze(this.split);
|
|
10752
7143
|
this.joined = this.split.join(".");
|
|
@@ -10844,13 +7235,13 @@ var MarkdownPlugin = function() {
|
|
|
10844
7235
|
}
|
|
10845
7236
|
throw new Error("Unable to resolve value for node: ".concat(node2.name));
|
|
10846
7237
|
}
|
|
10847
|
-
function appendPathSegments(
|
|
10848
|
-
if (typeof
|
|
10849
|
-
|
|
7238
|
+
function appendPathSegments(segment) {
|
|
7239
|
+
if (typeof segment === "string" && segment.indexOf(".") > -1) {
|
|
7240
|
+
segment.split(".").forEach(function(i) {
|
|
10850
7241
|
context.path.push(maybeConvertToNum(i));
|
|
10851
7242
|
});
|
|
10852
7243
|
} else {
|
|
10853
|
-
context.path.push(
|
|
7244
|
+
context.path.push(segment);
|
|
10854
7245
|
}
|
|
10855
7246
|
}
|
|
10856
7247
|
function resolveNode(_node) {
|
|
@@ -10928,24 +7319,24 @@ var MarkdownPlugin = function() {
|
|
|
10928
7319
|
* Takes a binding path, parses it, and returns an equivalent, normalized
|
|
10929
7320
|
* representation of that path.
|
|
10930
7321
|
*/ key: "normalizePath",
|
|
10931
|
-
value: function normalizePath(
|
|
10932
|
-
if (!BINDING_BRACKETS_REGEX.test(
|
|
7322
|
+
value: function normalizePath(path, resolveOptions) {
|
|
7323
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
10933
7324
|
return {
|
|
10934
|
-
path:
|
|
7325
|
+
path: path.split("."),
|
|
10935
7326
|
updates: void 0
|
|
10936
7327
|
};
|
|
10937
7328
|
}
|
|
10938
|
-
var
|
|
10939
|
-
var ast = (
|
|
10940
|
-
this.parseCache[
|
|
7329
|
+
var _this_parseCache_path;
|
|
7330
|
+
var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
|
|
7331
|
+
this.parseCache[path] = ast;
|
|
10941
7332
|
if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
|
|
10942
7333
|
var _ast_error;
|
|
10943
|
-
throw new TypeError('Cannot normalize path "'.concat(
|
|
7334
|
+
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."));
|
|
10944
7335
|
}
|
|
10945
7336
|
try {
|
|
10946
7337
|
return resolveBindingAST(ast.path, resolveOptions, this.hooks);
|
|
10947
7338
|
} catch (e) {
|
|
10948
|
-
throw new import_ts_nested_error.NestedError("Cannot resolve binding: ".concat(
|
|
7339
|
+
throw new import_ts_nested_error.NestedError("Cannot resolve binding: ".concat(path), e);
|
|
10949
7340
|
}
|
|
10950
7341
|
}
|
|
10951
7342
|
},
|
|
@@ -10973,21 +7364,21 @@ var MarkdownPlugin = function() {
|
|
|
10973
7364
|
var updates = {};
|
|
10974
7365
|
var joined = Array.isArray(rawBinding) ? rawBinding.join(".") : String(rawBinding);
|
|
10975
7366
|
var normalizeConfig = {
|
|
10976
|
-
getValue: function(
|
|
10977
|
-
var normalized2 = _this.normalizePath(
|
|
7367
|
+
getValue: function(path) {
|
|
7368
|
+
var normalized2 = _this.normalizePath(path.join("."), normalizeConfig);
|
|
10978
7369
|
return options.get(_this.getBindingForNormalizedResult(normalized2));
|
|
10979
7370
|
},
|
|
10980
7371
|
evaluate: function(exp) {
|
|
10981
7372
|
return options.evaluate(exp);
|
|
10982
7373
|
},
|
|
10983
|
-
convertToPath: function(
|
|
10984
|
-
if (
|
|
7374
|
+
convertToPath: function(path) {
|
|
7375
|
+
if (path === void 0) {
|
|
10985
7376
|
throw new Error("Attempted to convert undefined value to binding path");
|
|
10986
7377
|
}
|
|
10987
|
-
if (typeof
|
|
10988
|
-
throw new Error("Attempting to convert ".concat(typeof
|
|
7378
|
+
if (typeof path !== "string" && typeof path !== "number" && typeof path !== "boolean") {
|
|
7379
|
+
throw new Error("Attempting to convert ".concat(typeof path === "undefined" ? "undefined" : _type_of(path), " to a binding path."));
|
|
10989
7380
|
}
|
|
10990
|
-
var normalized2 = _this.normalizePath(String(
|
|
7381
|
+
var normalized2 = _this.normalizePath(String(path), normalizeConfig);
|
|
10991
7382
|
if (normalized2.updates) {
|
|
10992
7383
|
updates = _object_spread({}, updates, normalized2.updates);
|
|
10993
7384
|
}
|
|
@@ -11888,7 +8279,7 @@ var MarkdownPlugin = function() {
|
|
|
11888
8279
|
this.hooks = {
|
|
11889
8280
|
resolveTypeForBinding: new SyncWaterfallHook()
|
|
11890
8281
|
};
|
|
11891
|
-
this.schema = schema ?
|
|
8282
|
+
this.schema = schema ? parse2(schema) : /* @__PURE__ */ new Map();
|
|
11892
8283
|
}
|
|
11893
8284
|
_create_class(SchemaController, [
|
|
11894
8285
|
{
|
|
@@ -12279,7 +8670,7 @@ var MarkdownPlugin = function() {
|
|
|
12279
8670
|
}
|
|
12280
8671
|
}
|
|
12281
8672
|
var parseLocalObject = function(currentValue, objToParse) {
|
|
12282
|
-
var
|
|
8673
|
+
var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
12283
8674
|
if (typeof objToParse !== "object" || objToParse === null) {
|
|
12284
8675
|
return {
|
|
12285
8676
|
value: objToParse,
|
|
@@ -12316,7 +8707,7 @@ var MarkdownPlugin = function() {
|
|
|
12316
8707
|
return _object_spread_props(_object_spread({}, rest), {
|
|
12317
8708
|
children: _to_consumable_array(children2).concat([
|
|
12318
8709
|
{
|
|
12319
|
-
path: _to_consumable_array(
|
|
8710
|
+
path: _to_consumable_array(path).concat([
|
|
12320
8711
|
"asset"
|
|
12321
8712
|
]),
|
|
12322
8713
|
value: assetAST
|
|
@@ -12341,7 +8732,7 @@ var MarkdownPlugin = function() {
|
|
|
12341
8732
|
}
|
|
12342
8733
|
if (templateAST) {
|
|
12343
8734
|
return {
|
|
12344
|
-
path: _to_consumable_array(
|
|
8735
|
+
path: _to_consumable_array(path).concat([
|
|
12345
8736
|
template.output
|
|
12346
8737
|
]),
|
|
12347
8738
|
value: templateAST
|
|
@@ -12362,7 +8753,7 @@ var MarkdownPlugin = function() {
|
|
|
12362
8753
|
return _object_spread_props(_object_spread({}, rest), {
|
|
12363
8754
|
children: _to_consumable_array(children2).concat([
|
|
12364
8755
|
{
|
|
12365
|
-
path: _to_consumable_array(
|
|
8756
|
+
path: _to_consumable_array(path).concat([
|
|
12366
8757
|
localKey
|
|
12367
8758
|
], _to_consumable_array(firstChild.path)),
|
|
12368
8759
|
value: firstChild.value
|
|
@@ -12374,7 +8765,7 @@ var MarkdownPlugin = function() {
|
|
|
12374
8765
|
return _object_spread_props(_object_spread({}, rest), {
|
|
12375
8766
|
children: _to_consumable_array(children2).concat([
|
|
12376
8767
|
{
|
|
12377
|
-
path: _to_consumable_array(
|
|
8768
|
+
path: _to_consumable_array(path).concat([
|
|
12378
8769
|
localKey
|
|
12379
8770
|
]),
|
|
12380
8771
|
value: localSwitch
|
|
@@ -12386,7 +8777,7 @@ var MarkdownPlugin = function() {
|
|
|
12386
8777
|
var localAsync = _this.parseAsync(localValue, "value", options);
|
|
12387
8778
|
if (localAsync) {
|
|
12388
8779
|
children2.push({
|
|
12389
|
-
path: _to_consumable_array(
|
|
8780
|
+
path: _to_consumable_array(path).concat([
|
|
12390
8781
|
localKey
|
|
12391
8782
|
]),
|
|
12392
8783
|
value: localAsync
|
|
@@ -12413,7 +8804,7 @@ var MarkdownPlugin = function() {
|
|
|
12413
8804
|
return _object_spread_props(_object_spread({}, rest), {
|
|
12414
8805
|
children: _to_consumable_array(children2).concat([
|
|
12415
8806
|
{
|
|
12416
|
-
path: _to_consumable_array(
|
|
8807
|
+
path: _to_consumable_array(path).concat([
|
|
12417
8808
|
localKey
|
|
12418
8809
|
]),
|
|
12419
8810
|
value: multiNode
|
|
@@ -12430,7 +8821,7 @@ var MarkdownPlugin = function() {
|
|
|
12430
8821
|
return _object_spread_props(_object_spread({}, rest), {
|
|
12431
8822
|
children: _to_consumable_array(children2).concat([
|
|
12432
8823
|
{
|
|
12433
|
-
path: _to_consumable_array(
|
|
8824
|
+
path: _to_consumable_array(path).concat([
|
|
12434
8825
|
localKey
|
|
12435
8826
|
]),
|
|
12436
8827
|
value: parsedNode
|
|
@@ -12439,7 +8830,7 @@ var MarkdownPlugin = function() {
|
|
|
12439
8830
|
});
|
|
12440
8831
|
}
|
|
12441
8832
|
} else {
|
|
12442
|
-
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(
|
|
8833
|
+
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
12443
8834
|
localKey
|
|
12444
8835
|
]));
|
|
12445
8836
|
return {
|
|
@@ -12448,7 +8839,7 @@ var MarkdownPlugin = function() {
|
|
|
12448
8839
|
};
|
|
12449
8840
|
}
|
|
12450
8841
|
} else {
|
|
12451
|
-
var value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(
|
|
8842
|
+
var value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(path).concat([
|
|
12452
8843
|
localKey
|
|
12453
8844
|
]), localValue);
|
|
12454
8845
|
return {
|
|
@@ -12753,17 +9144,17 @@ var MarkdownPlugin = function() {
|
|
|
12753
9144
|
return Resolver;
|
|
12754
9145
|
}();
|
|
12755
9146
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
12756
|
-
function CrossfieldProvider(initialView,
|
|
9147
|
+
function CrossfieldProvider(initialView, parser, logger) {
|
|
12757
9148
|
_class_call_check(this, CrossfieldProvider);
|
|
12758
9149
|
this.allValidations = /* @__PURE__ */ new Set();
|
|
12759
9150
|
this.byBinding = /* @__PURE__ */ new Map();
|
|
12760
9151
|
this.logger = logger;
|
|
12761
|
-
this.parse(initialView,
|
|
9152
|
+
this.parse(initialView, parser);
|
|
12762
9153
|
}
|
|
12763
9154
|
_create_class(CrossfieldProvider, [
|
|
12764
9155
|
{
|
|
12765
9156
|
key: "parse",
|
|
12766
|
-
value: function parse(contentView,
|
|
9157
|
+
value: function parse(contentView, parser) {
|
|
12767
9158
|
var _this = this;
|
|
12768
9159
|
var xfieldRefs = contentView.validation;
|
|
12769
9160
|
if (xfieldRefs === void 0) {
|
|
@@ -12782,7 +9173,7 @@ var MarkdownPlugin = function() {
|
|
|
12782
9173
|
_this.allValidations.add(withDefaults);
|
|
12783
9174
|
var ref = vRef.ref;
|
|
12784
9175
|
if (ref) {
|
|
12785
|
-
var parsed =
|
|
9176
|
+
var parsed = parser(ref);
|
|
12786
9177
|
if (_this.byBinding.has(parsed)) {
|
|
12787
9178
|
var _this_byBinding_get;
|
|
12788
9179
|
(_this_byBinding_get = _this.byBinding.get(parsed)) === null || _this_byBinding_get === void 0 ? void 0 : _this_byBinding_get.push(withDefaults);
|
|
@@ -12843,11 +9234,11 @@ var MarkdownPlugin = function() {
|
|
|
12843
9234
|
var _this_resolverOptions_logger;
|
|
12844
9235
|
(_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");
|
|
12845
9236
|
}
|
|
12846
|
-
var
|
|
12847
|
-
this.hooks.parser.call(
|
|
12848
|
-
this.rootNode =
|
|
9237
|
+
var parser = new Parser();
|
|
9238
|
+
this.hooks.parser.call(parser);
|
|
9239
|
+
this.rootNode = parser.parseView(this.initialView);
|
|
12849
9240
|
this.resolver = new Resolver(this.rootNode, _object_spread_props(_object_spread({}, this.resolverOptions), {
|
|
12850
|
-
parseNode:
|
|
9241
|
+
parseNode: parser.parseObject.bind(parser)
|
|
12851
9242
|
}));
|
|
12852
9243
|
this.hooks.resolver.call(this.resolver);
|
|
12853
9244
|
}
|
|
@@ -12945,23 +9336,23 @@ var MarkdownPlugin = function() {
|
|
|
12945
9336
|
},
|
|
12946
9337
|
{
|
|
12947
9338
|
key: "applyParser",
|
|
12948
|
-
value: function applyParser(
|
|
9339
|
+
value: function applyParser(parser) {
|
|
12949
9340
|
var _this = this;
|
|
12950
|
-
|
|
9341
|
+
parser.hooks.onCreateASTNode.tap("template", function(node2) {
|
|
12951
9342
|
if (node2 && node2.type === "template" && !node2.dynamic) {
|
|
12952
|
-
return _this.parseTemplate(
|
|
9343
|
+
return _this.parseTemplate(parser.parseObject.bind(parser), node2, _this.options);
|
|
12953
9344
|
}
|
|
12954
9345
|
return node2;
|
|
12955
9346
|
});
|
|
12956
|
-
|
|
9347
|
+
parser.hooks.determineNodeType.tap("template", function(obj) {
|
|
12957
9348
|
if (obj === "template") {
|
|
12958
9349
|
return "template";
|
|
12959
9350
|
}
|
|
12960
9351
|
});
|
|
12961
|
-
|
|
9352
|
+
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, determinedNodeType) {
|
|
12962
9353
|
if (determinedNodeType === "template") {
|
|
12963
9354
|
var _options_templateDepth, _obj_dynamic;
|
|
12964
|
-
var templateNode =
|
|
9355
|
+
var templateNode = parser.createASTNode({
|
|
12965
9356
|
type: "template",
|
|
12966
9357
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
12967
9358
|
data: obj.data,
|
|
@@ -13089,8 +9480,8 @@ var MarkdownPlugin = function() {
|
|
|
13089
9480
|
]);
|
|
13090
9481
|
}
|
|
13091
9482
|
var nodePath = findBasePath(node2, resolver2);
|
|
13092
|
-
if (nodePath.length > 0 && nodePath.some(function(
|
|
13093
|
-
return propsToSkip.has(
|
|
9483
|
+
if (nodePath.length > 0 && nodePath.some(function(segment) {
|
|
9484
|
+
return propsToSkip.has(segment.toString());
|
|
13094
9485
|
})) {
|
|
13095
9486
|
return node2.value;
|
|
13096
9487
|
}
|
|
@@ -13132,17 +9523,17 @@ var MarkdownPlugin = function() {
|
|
|
13132
9523
|
},
|
|
13133
9524
|
{
|
|
13134
9525
|
key: "applyParser",
|
|
13135
|
-
value: function applyParser(
|
|
13136
|
-
|
|
9526
|
+
value: function applyParser(parser) {
|
|
9527
|
+
parser.hooks.determineNodeType.tap("applicability", function(obj) {
|
|
13137
9528
|
if (Object.prototype.hasOwnProperty.call(obj, "applicability")) {
|
|
13138
9529
|
return "applicability";
|
|
13139
9530
|
}
|
|
13140
9531
|
});
|
|
13141
|
-
|
|
9532
|
+
parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, determinedNodeType) {
|
|
13142
9533
|
if (determinedNodeType === "applicability") {
|
|
13143
|
-
var parsedApplicability =
|
|
9534
|
+
var parsedApplicability = parser.parseObject((0, import_timm7.omit)(obj, "applicability"), nodeType, options);
|
|
13144
9535
|
if (parsedApplicability !== null) {
|
|
13145
|
-
var applicabilityNode =
|
|
9536
|
+
var applicabilityNode = parser.createASTNode({
|
|
13146
9537
|
type: "applicability",
|
|
13147
9538
|
expression: obj.applicability,
|
|
13148
9539
|
value: parsedApplicability
|
|
@@ -13203,20 +9594,20 @@ var MarkdownPlugin = function() {
|
|
|
13203
9594
|
},
|
|
13204
9595
|
{
|
|
13205
9596
|
key: "applyParser",
|
|
13206
|
-
value: function applyParser(
|
|
9597
|
+
value: function applyParser(parser) {
|
|
13207
9598
|
var _this = this;
|
|
13208
|
-
|
|
9599
|
+
parser.hooks.onCreateASTNode.tap("switch", function(node2) {
|
|
13209
9600
|
if (node2 && node2.type === "switch" && !node2.dynamic) {
|
|
13210
9601
|
return _this.resolveSwitch(node2, _this.options);
|
|
13211
9602
|
}
|
|
13212
9603
|
return node2;
|
|
13213
9604
|
});
|
|
13214
|
-
|
|
9605
|
+
parser.hooks.determineNodeType.tap("switch", function(obj) {
|
|
13215
9606
|
if (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch")) {
|
|
13216
9607
|
return "switch";
|
|
13217
9608
|
}
|
|
13218
9609
|
});
|
|
13219
|
-
|
|
9610
|
+
parser.hooks.parseNode.tap("switch", function(obj, _nodeType, options, determinedNodeType) {
|
|
13220
9611
|
if (determinedNodeType === "switch") {
|
|
13221
9612
|
var dynamic = "dynamicSwitch" in obj;
|
|
13222
9613
|
var switchContent = "dynamicSwitch" in obj ? obj.dynamicSwitch : obj.staticSwitch;
|
|
@@ -13225,7 +9616,7 @@ var MarkdownPlugin = function() {
|
|
|
13225
9616
|
var switchCaseExpr = switchCase.case, switchBody = _object_without_properties(switchCase, [
|
|
13226
9617
|
"case"
|
|
13227
9618
|
]);
|
|
13228
|
-
var value =
|
|
9619
|
+
var value = parser.parseObject(switchBody, "value", options);
|
|
13229
9620
|
if (value) {
|
|
13230
9621
|
cases.push({
|
|
13231
9622
|
case: switchCaseExpr,
|
|
@@ -13233,7 +9624,7 @@ var MarkdownPlugin = function() {
|
|
|
13233
9624
|
});
|
|
13234
9625
|
}
|
|
13235
9626
|
});
|
|
13236
|
-
var switchAST =
|
|
9627
|
+
var switchAST = parser.hooks.onCreateASTNode.call({
|
|
13237
9628
|
type: "switch",
|
|
13238
9629
|
dynamic: dynamic,
|
|
13239
9630
|
cases: cases
|
|
@@ -14254,11 +10645,11 @@ var MarkdownPlugin = function() {
|
|
|
14254
10645
|
},
|
|
14255
10646
|
{
|
|
14256
10647
|
key: "forView",
|
|
14257
|
-
value: function forView(
|
|
10648
|
+
value: function forView(parser) {
|
|
14258
10649
|
var _this = this;
|
|
14259
10650
|
return {
|
|
14260
10651
|
_getValidationForBinding: function(binding) {
|
|
14261
|
-
return _this.getValidationForBinding(isBinding(binding) ? binding :
|
|
10652
|
+
return _this.getValidationForBinding(isBinding(binding) ? binding : parser(binding));
|
|
14262
10653
|
},
|
|
14263
10654
|
getAll: function() {
|
|
14264
10655
|
var bindings = _this.getBindings();
|
|
@@ -14294,7 +10685,7 @@ var MarkdownPlugin = function() {
|
|
|
14294
10685
|
throw new Error("Section functionality should be provided by the view plugin");
|
|
14295
10686
|
},
|
|
14296
10687
|
type: function(binding) {
|
|
14297
|
-
return _this.schema.getType(isBinding(binding) ? binding :
|
|
10688
|
+
return _this.schema.getType(isBinding(binding) ? binding : parser(binding));
|
|
14298
10689
|
}
|
|
14299
10690
|
};
|
|
14300
10691
|
}
|
|
@@ -14794,11 +11185,11 @@ var MarkdownPlugin = function() {
|
|
|
14794
11185
|
]);
|
|
14795
11186
|
return DataController;
|
|
14796
11187
|
}();
|
|
14797
|
-
function
|
|
11188
|
+
function flatten(obj) {
|
|
14798
11189
|
var roots = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], sep = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
14799
11190
|
return Object.keys(obj).reduce(function(memo, prop) {
|
|
14800
11191
|
return _object_spread({}, memo, Object.prototype.toString.call(obj[prop]) === "[object Object]" ? // keep working if value is an object
|
|
14801
|
-
|
|
11192
|
+
flatten(obj[prop], roots.concat([
|
|
14802
11193
|
prop
|
|
14803
11194
|
])) : _define_property({}, roots.concat([
|
|
14804
11195
|
prop
|
|
@@ -14827,9 +11218,9 @@ var MarkdownPlugin = function() {
|
|
|
14827
11218
|
key: "getConstants",
|
|
14828
11219
|
value: function getConstants(key, namespace, fallback) {
|
|
14829
11220
|
var _this_tempStore_get, _this_store_get;
|
|
14830
|
-
var
|
|
11221
|
+
var path = new BindingInstance(key);
|
|
14831
11222
|
var _this_tempStore_get_get, _ref;
|
|
14832
|
-
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(
|
|
11223
|
+
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;
|
|
14833
11224
|
}
|
|
14834
11225
|
},
|
|
14835
11226
|
{
|
|
@@ -18332,14 +14723,6 @@ var MarkdownPlugin = function() {
|
|
|
18332
14723
|
return __toCommonJS(src_exports);
|
|
18333
14724
|
}(); /*! Bundled license information:
|
|
18334
14725
|
|
|
18335
|
-
arr-flatten/index.js:
|
|
18336
|
-
(*!
|
|
18337
|
-
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
|
|
18338
|
-
*
|
|
18339
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
18340
|
-
* Released under the MIT License.
|
|
18341
|
-
*)
|
|
18342
|
-
|
|
18343
14726
|
timm/lib/timm.js:
|
|
18344
14727
|
(*!
|
|
18345
14728
|
* Timm
|