json-p3 1.3.0 → 1.3.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/json-p3.cjs.js +1300 -7
- package/dist/json-p3.esm.js +1300 -7
- package/dist/json-p3.iife.js +1300 -7
- package/dist/json-p3.iife.min.js +1 -1
- package/dist/json-p3.iife.min.js.map +1 -1
- package/dist/path/errors.d.ts +7 -0
- package/dist/path/functions/index.d.ts +2 -0
- package/dist/path/functions/match.d.ts +13 -3
- package/dist/path/functions/pattern.d.ts +1 -0
- package/dist/path/functions/search.d.ts +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
package/dist/json-p3.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* json-p3 version 1.3.
|
|
2
|
+
* json-p3 version 1.3.2
|
|
3
3
|
* https://github.com/jg-rp/json-p3
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
@@ -136,6 +136,18 @@ class JSONPathRecursionLimitError extends JSONPathError {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Error thrown due to invalid I-Regexp syntax.
|
|
141
|
+
*/
|
|
142
|
+
class IRegexpError extends Error {
|
|
143
|
+
constructor(message) {
|
|
144
|
+
super(message);
|
|
145
|
+
this.message = message;
|
|
146
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
147
|
+
this.name = "IRegexpError";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
139
151
|
/**
|
|
140
152
|
* Common types and type predicates.
|
|
141
153
|
*/
|
|
@@ -1080,6 +1092,1255 @@ class LRUCache extends Map {
|
|
|
1080
1092
|
}
|
|
1081
1093
|
}
|
|
1082
1094
|
|
|
1095
|
+
// See https://datatracker.ietf.org/doc/html/rfc9485#name-ecmascript-regexps
|
|
1096
|
+
function mapRegexp(pattern) {
|
|
1097
|
+
let escaped = false;
|
|
1098
|
+
let charClass = false;
|
|
1099
|
+
const parts = [];
|
|
1100
|
+
for (const ch of pattern) {
|
|
1101
|
+
if (escaped) {
|
|
1102
|
+
parts.push(ch);
|
|
1103
|
+
escaped = false;
|
|
1104
|
+
continue;
|
|
1105
|
+
}
|
|
1106
|
+
switch (ch) {
|
|
1107
|
+
case ".":
|
|
1108
|
+
if (!charClass) {
|
|
1109
|
+
parts.push("(?:(?![\r\n])\\P{Cs}|\\p{Cs}\\p{Cs})");
|
|
1110
|
+
} else {
|
|
1111
|
+
parts.push(ch);
|
|
1112
|
+
}
|
|
1113
|
+
break;
|
|
1114
|
+
case "\\":
|
|
1115
|
+
escaped = true;
|
|
1116
|
+
parts.push(ch);
|
|
1117
|
+
break;
|
|
1118
|
+
case "[":
|
|
1119
|
+
charClass = true;
|
|
1120
|
+
parts.push(ch);
|
|
1121
|
+
break;
|
|
1122
|
+
case "]":
|
|
1123
|
+
charClass = false;
|
|
1124
|
+
parts.push(ch);
|
|
1125
|
+
break;
|
|
1126
|
+
default:
|
|
1127
|
+
parts.push(ch);
|
|
1128
|
+
break;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
return parts.join("");
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/*
|
|
1135
|
+
* iregexp-check version 0.1.1
|
|
1136
|
+
* https://github.com/jg-rp/js-iregexp
|
|
1137
|
+
*
|
|
1138
|
+
* MIT License
|
|
1139
|
+
*
|
|
1140
|
+
* Copyright (c) 2024 James Prior
|
|
1141
|
+
*
|
|
1142
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1143
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1144
|
+
* in the Software without restriction, including without limitation the rights
|
|
1145
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1146
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1147
|
+
* furnished to do so, subject to the following conditions:
|
|
1148
|
+
*
|
|
1149
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
1150
|
+
* copies or substantial portions of the Software.
|
|
1151
|
+
*
|
|
1152
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1153
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1154
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1155
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1156
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1157
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1158
|
+
* SOFTWARE.
|
|
1159
|
+
*
|
|
1160
|
+
*/
|
|
1161
|
+
function isNormalChar(c) {
|
|
1162
|
+
return c < "\u0027" || c === "," || c === "-" || c >= "\u002F" && c <= "\u003E" ||
|
|
1163
|
+
// / .. >
|
|
1164
|
+
c >= "\u0040" && c <= "\u005A" ||
|
|
1165
|
+
// @ .. Z
|
|
1166
|
+
c >= "\u005E" && c <= "\u007A" ||
|
|
1167
|
+
// ^ .. z
|
|
1168
|
+
c >= "\u007E" && c <= "\uD7FF" ||
|
|
1169
|
+
// skip surrogate code points
|
|
1170
|
+
c >= "\uE000";
|
|
1171
|
+
}
|
|
1172
|
+
function isCCChar(c) {
|
|
1173
|
+
return c < "\u002C" || c >= "\u002E" && c <= "\u005A" ||
|
|
1174
|
+
// '.' .. Z
|
|
1175
|
+
c >= "\u005E" && c <= "\uD7FF" ||
|
|
1176
|
+
// skip surrogate code points
|
|
1177
|
+
c >= "\uE000";
|
|
1178
|
+
}
|
|
1179
|
+
function peg$subclass(child, parent) {
|
|
1180
|
+
function C() {
|
|
1181
|
+
this.constructor = child;
|
|
1182
|
+
}
|
|
1183
|
+
C.prototype = parent.prototype;
|
|
1184
|
+
child.prototype = new C();
|
|
1185
|
+
}
|
|
1186
|
+
function peg$SyntaxError(message, expected, found, location) {
|
|
1187
|
+
var self = Error.call(this, message);
|
|
1188
|
+
// istanbul ignore next Check is a necessary evil to support older environments
|
|
1189
|
+
if (Object.setPrototypeOf) {
|
|
1190
|
+
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
|
|
1191
|
+
}
|
|
1192
|
+
self.expected = expected;
|
|
1193
|
+
self.found = found;
|
|
1194
|
+
self.location = location;
|
|
1195
|
+
self.name = "SyntaxError";
|
|
1196
|
+
return self;
|
|
1197
|
+
}
|
|
1198
|
+
peg$subclass(peg$SyntaxError, Error);
|
|
1199
|
+
function peg$padEnd(str, targetLength, padString) {
|
|
1200
|
+
padString = padString || " ";
|
|
1201
|
+
if (str.length > targetLength) {
|
|
1202
|
+
return str;
|
|
1203
|
+
}
|
|
1204
|
+
targetLength -= str.length;
|
|
1205
|
+
padString += padString.repeat(targetLength);
|
|
1206
|
+
return str + padString.slice(0, targetLength);
|
|
1207
|
+
}
|
|
1208
|
+
peg$SyntaxError.prototype.format = function (sources) {
|
|
1209
|
+
var str = "Error: " + this.message;
|
|
1210
|
+
if (this.location) {
|
|
1211
|
+
var src = null;
|
|
1212
|
+
var k;
|
|
1213
|
+
for (k = 0; k < sources.length; k++) {
|
|
1214
|
+
if (sources[k].source === this.location.source) {
|
|
1215
|
+
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
var s = this.location.start;
|
|
1220
|
+
var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
|
|
1221
|
+
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
|
|
1222
|
+
if (src) {
|
|
1223
|
+
var e = this.location.end;
|
|
1224
|
+
var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
|
|
1225
|
+
var line = src[s.line - 1];
|
|
1226
|
+
var last = s.line === e.line ? e.column : line.length + 1;
|
|
1227
|
+
var hatLen = last - s.column || 1;
|
|
1228
|
+
str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " + line + "\n" + filler + " | " + peg$padEnd("", s.column - 1, ' ') + peg$padEnd("", hatLen, "^");
|
|
1229
|
+
} else {
|
|
1230
|
+
str += "\n at " + loc;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
return str;
|
|
1234
|
+
};
|
|
1235
|
+
peg$SyntaxError.buildMessage = function (expected, found) {
|
|
1236
|
+
var DESCRIBE_EXPECTATION_FNS = {
|
|
1237
|
+
literal: function (expectation) {
|
|
1238
|
+
return "\"" + literalEscape(expectation.text) + "\"";
|
|
1239
|
+
},
|
|
1240
|
+
class: function (expectation) {
|
|
1241
|
+
var escapedParts = expectation.parts.map(function (part) {
|
|
1242
|
+
return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
|
|
1243
|
+
});
|
|
1244
|
+
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
|
1245
|
+
},
|
|
1246
|
+
any: function () {
|
|
1247
|
+
return "any character";
|
|
1248
|
+
},
|
|
1249
|
+
end: function () {
|
|
1250
|
+
return "end of input";
|
|
1251
|
+
},
|
|
1252
|
+
other: function (expectation) {
|
|
1253
|
+
return expectation.description;
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
function hex(ch) {
|
|
1257
|
+
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
1258
|
+
}
|
|
1259
|
+
function literalEscape(s) {
|
|
1260
|
+
return s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function (ch) {
|
|
1261
|
+
return "\\x0" + hex(ch);
|
|
1262
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
|
1263
|
+
return "\\x" + hex(ch);
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
function classEscape(s) {
|
|
1267
|
+
return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function (ch) {
|
|
1268
|
+
return "\\x0" + hex(ch);
|
|
1269
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
|
1270
|
+
return "\\x" + hex(ch);
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
function describeExpectation(expectation) {
|
|
1274
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
1275
|
+
}
|
|
1276
|
+
function describeExpected(expected) {
|
|
1277
|
+
var descriptions = expected.map(describeExpectation);
|
|
1278
|
+
var i, j;
|
|
1279
|
+
descriptions.sort();
|
|
1280
|
+
if (descriptions.length > 0) {
|
|
1281
|
+
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
1282
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
|
1283
|
+
descriptions[j] = descriptions[i];
|
|
1284
|
+
j++;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
descriptions.length = j;
|
|
1288
|
+
}
|
|
1289
|
+
switch (descriptions.length) {
|
|
1290
|
+
case 1:
|
|
1291
|
+
return descriptions[0];
|
|
1292
|
+
case 2:
|
|
1293
|
+
return descriptions[0] + " or " + descriptions[1];
|
|
1294
|
+
default:
|
|
1295
|
+
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
function describeFound(found) {
|
|
1299
|
+
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
|
1300
|
+
}
|
|
1301
|
+
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
1302
|
+
};
|
|
1303
|
+
function peg$parse(input, options) {
|
|
1304
|
+
options = options !== undefined ? options : {};
|
|
1305
|
+
var peg$FAILED = {};
|
|
1306
|
+
var peg$source = options.grammarSource;
|
|
1307
|
+
var peg$startRuleFunctions = {
|
|
1308
|
+
start: peg$parsestart
|
|
1309
|
+
};
|
|
1310
|
+
var peg$startRuleFunction = peg$parsestart;
|
|
1311
|
+
var peg$c0 = "|";
|
|
1312
|
+
var peg$c1 = "{";
|
|
1313
|
+
var peg$c2 = ",";
|
|
1314
|
+
var peg$c3 = "}";
|
|
1315
|
+
var peg$c4 = "(";
|
|
1316
|
+
var peg$c5 = ")";
|
|
1317
|
+
var peg$c6 = ".";
|
|
1318
|
+
var peg$c7 = "\\";
|
|
1319
|
+
var peg$c8 = "[";
|
|
1320
|
+
var peg$c9 = "^";
|
|
1321
|
+
var peg$c10 = "-";
|
|
1322
|
+
var peg$c11 = "]";
|
|
1323
|
+
var peg$c12 = "\\p{";
|
|
1324
|
+
var peg$c13 = "\\P{";
|
|
1325
|
+
var peg$c14 = "L";
|
|
1326
|
+
var peg$c15 = "M";
|
|
1327
|
+
var peg$c16 = "N";
|
|
1328
|
+
var peg$c17 = "P";
|
|
1329
|
+
var peg$c18 = "Z";
|
|
1330
|
+
var peg$c19 = "S";
|
|
1331
|
+
var peg$c20 = "C";
|
|
1332
|
+
var peg$r0 = /^[*-+?]/;
|
|
1333
|
+
var peg$r1 = /^[0-9]/;
|
|
1334
|
+
var peg$r2 = /^[(-+\--.?[-\^nrt{-}]/;
|
|
1335
|
+
var peg$r3 = /^[l-mot-u]/;
|
|
1336
|
+
var peg$r4 = /^[cen]/;
|
|
1337
|
+
var peg$r5 = /^[dlo]/;
|
|
1338
|
+
var peg$r6 = /^[c-fios]/;
|
|
1339
|
+
var peg$r7 = /^[lps]/;
|
|
1340
|
+
var peg$r8 = /^[ckmo]/;
|
|
1341
|
+
var peg$r9 = /^[cfn-o]/;
|
|
1342
|
+
var peg$e0 = peg$literalExpectation("|", false);
|
|
1343
|
+
var peg$e1 = peg$classExpectation([["*", "+"], "?"], false, false);
|
|
1344
|
+
var peg$e2 = peg$literalExpectation("{", false);
|
|
1345
|
+
var peg$e3 = peg$classExpectation([["0", "9"]], false, false);
|
|
1346
|
+
var peg$e4 = peg$literalExpectation(",", false);
|
|
1347
|
+
var peg$e5 = peg$literalExpectation("}", false);
|
|
1348
|
+
var peg$e6 = peg$literalExpectation("(", false);
|
|
1349
|
+
var peg$e7 = peg$literalExpectation(")", false);
|
|
1350
|
+
var peg$e8 = peg$anyExpectation();
|
|
1351
|
+
var peg$e9 = peg$literalExpectation(".", false);
|
|
1352
|
+
var peg$e10 = peg$literalExpectation("\\", false);
|
|
1353
|
+
var peg$e11 = peg$classExpectation([["(", "+"], ["-", "."], "?", ["[", "^"], "n", "r", "t", ["{", "}"]], false, false);
|
|
1354
|
+
var peg$e12 = peg$literalExpectation("[", false);
|
|
1355
|
+
var peg$e13 = peg$literalExpectation("^", false);
|
|
1356
|
+
var peg$e14 = peg$literalExpectation("-", false);
|
|
1357
|
+
var peg$e15 = peg$literalExpectation("]", false);
|
|
1358
|
+
var peg$e16 = peg$literalExpectation("\\p{", false);
|
|
1359
|
+
var peg$e17 = peg$literalExpectation("\\P{", false);
|
|
1360
|
+
var peg$e18 = peg$literalExpectation("L", false);
|
|
1361
|
+
var peg$e19 = peg$classExpectation([["l", "m"], "o", ["t", "u"]], false, false);
|
|
1362
|
+
var peg$e20 = peg$literalExpectation("M", false);
|
|
1363
|
+
var peg$e21 = peg$classExpectation(["c", "e", "n"], false, false);
|
|
1364
|
+
var peg$e22 = peg$literalExpectation("N", false);
|
|
1365
|
+
var peg$e23 = peg$classExpectation(["d", "l", "o"], false, false);
|
|
1366
|
+
var peg$e24 = peg$literalExpectation("P", false);
|
|
1367
|
+
var peg$e25 = peg$classExpectation([["c", "f"], "i", "o", "s"], false, false);
|
|
1368
|
+
var peg$e26 = peg$literalExpectation("Z", false);
|
|
1369
|
+
var peg$e27 = peg$classExpectation(["l", "p", "s"], false, false);
|
|
1370
|
+
var peg$e28 = peg$literalExpectation("S", false);
|
|
1371
|
+
var peg$e29 = peg$classExpectation(["c", "k", "m", "o"], false, false);
|
|
1372
|
+
var peg$e30 = peg$literalExpectation("C", false);
|
|
1373
|
+
var peg$e31 = peg$classExpectation(["c", "f", ["n", "o"]], false, false);
|
|
1374
|
+
var peg$f0 = function (c) {
|
|
1375
|
+
return isNormalChar(c);
|
|
1376
|
+
};
|
|
1377
|
+
var peg$f1 = function (c) {
|
|
1378
|
+
return isCCChar(c);
|
|
1379
|
+
};
|
|
1380
|
+
var peg$currPos = options.peg$currPos | 0;
|
|
1381
|
+
var peg$posDetailsCache = [{
|
|
1382
|
+
line: 1,
|
|
1383
|
+
column: 1
|
|
1384
|
+
}];
|
|
1385
|
+
var peg$maxFailPos = peg$currPos;
|
|
1386
|
+
var peg$maxFailExpected = options.peg$maxFailExpected || [];
|
|
1387
|
+
var peg$silentFails = options.peg$silentFails | 0;
|
|
1388
|
+
var peg$result;
|
|
1389
|
+
if (options.startRule) {
|
|
1390
|
+
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
1391
|
+
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
1392
|
+
}
|
|
1393
|
+
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
1394
|
+
}
|
|
1395
|
+
function peg$literalExpectation(text, ignoreCase) {
|
|
1396
|
+
return {
|
|
1397
|
+
type: "literal",
|
|
1398
|
+
text: text,
|
|
1399
|
+
ignoreCase: ignoreCase
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
1403
|
+
return {
|
|
1404
|
+
type: "class",
|
|
1405
|
+
parts: parts,
|
|
1406
|
+
inverted: inverted,
|
|
1407
|
+
ignoreCase: ignoreCase
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
function peg$anyExpectation() {
|
|
1411
|
+
return {
|
|
1412
|
+
type: "any"
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
function peg$endExpectation() {
|
|
1416
|
+
return {
|
|
1417
|
+
type: "end"
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
function peg$computePosDetails(pos) {
|
|
1421
|
+
var details = peg$posDetailsCache[pos];
|
|
1422
|
+
var p;
|
|
1423
|
+
if (details) {
|
|
1424
|
+
return details;
|
|
1425
|
+
} else {
|
|
1426
|
+
if (pos >= peg$posDetailsCache.length) {
|
|
1427
|
+
p = peg$posDetailsCache.length - 1;
|
|
1428
|
+
} else {
|
|
1429
|
+
p = pos;
|
|
1430
|
+
while (!peg$posDetailsCache[--p]) {}
|
|
1431
|
+
}
|
|
1432
|
+
details = peg$posDetailsCache[p];
|
|
1433
|
+
details = {
|
|
1434
|
+
line: details.line,
|
|
1435
|
+
column: details.column
|
|
1436
|
+
};
|
|
1437
|
+
while (p < pos) {
|
|
1438
|
+
if (input.charCodeAt(p) === 10) {
|
|
1439
|
+
details.line++;
|
|
1440
|
+
details.column = 1;
|
|
1441
|
+
} else {
|
|
1442
|
+
details.column++;
|
|
1443
|
+
}
|
|
1444
|
+
p++;
|
|
1445
|
+
}
|
|
1446
|
+
peg$posDetailsCache[pos] = details;
|
|
1447
|
+
return details;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
function peg$computeLocation(startPos, endPos, offset) {
|
|
1451
|
+
var startPosDetails = peg$computePosDetails(startPos);
|
|
1452
|
+
var endPosDetails = peg$computePosDetails(endPos);
|
|
1453
|
+
var res = {
|
|
1454
|
+
source: peg$source,
|
|
1455
|
+
start: {
|
|
1456
|
+
offset: startPos,
|
|
1457
|
+
line: startPosDetails.line,
|
|
1458
|
+
column: startPosDetails.column
|
|
1459
|
+
},
|
|
1460
|
+
end: {
|
|
1461
|
+
offset: endPos,
|
|
1462
|
+
line: endPosDetails.line,
|
|
1463
|
+
column: endPosDetails.column
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
return res;
|
|
1467
|
+
}
|
|
1468
|
+
function peg$fail(expected) {
|
|
1469
|
+
if (peg$currPos < peg$maxFailPos) {
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
if (peg$currPos > peg$maxFailPos) {
|
|
1473
|
+
peg$maxFailPos = peg$currPos;
|
|
1474
|
+
peg$maxFailExpected = [];
|
|
1475
|
+
}
|
|
1476
|
+
peg$maxFailExpected.push(expected);
|
|
1477
|
+
}
|
|
1478
|
+
function peg$buildStructuredError(expected, found, location) {
|
|
1479
|
+
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
|
|
1480
|
+
}
|
|
1481
|
+
function peg$parsestart() {
|
|
1482
|
+
var s0;
|
|
1483
|
+
s0 = peg$parseiregexp();
|
|
1484
|
+
return s0;
|
|
1485
|
+
}
|
|
1486
|
+
function peg$parseiregexp() {
|
|
1487
|
+
var s0, s1, s2, s3, s4, s5;
|
|
1488
|
+
s0 = peg$currPos;
|
|
1489
|
+
s1 = peg$parsebranch();
|
|
1490
|
+
s2 = [];
|
|
1491
|
+
s3 = peg$currPos;
|
|
1492
|
+
if (input.charCodeAt(peg$currPos) === 124) {
|
|
1493
|
+
s4 = peg$c0;
|
|
1494
|
+
peg$currPos++;
|
|
1495
|
+
} else {
|
|
1496
|
+
s4 = peg$FAILED;
|
|
1497
|
+
if (peg$silentFails === 0) {
|
|
1498
|
+
peg$fail(peg$e0);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
if (s4 !== peg$FAILED) {
|
|
1502
|
+
s5 = peg$parsebranch();
|
|
1503
|
+
s4 = [s4, s5];
|
|
1504
|
+
s3 = s4;
|
|
1505
|
+
} else {
|
|
1506
|
+
peg$currPos = s3;
|
|
1507
|
+
s3 = peg$FAILED;
|
|
1508
|
+
}
|
|
1509
|
+
while (s3 !== peg$FAILED) {
|
|
1510
|
+
s2.push(s3);
|
|
1511
|
+
s3 = peg$currPos;
|
|
1512
|
+
if (input.charCodeAt(peg$currPos) === 124) {
|
|
1513
|
+
s4 = peg$c0;
|
|
1514
|
+
peg$currPos++;
|
|
1515
|
+
} else {
|
|
1516
|
+
s4 = peg$FAILED;
|
|
1517
|
+
if (peg$silentFails === 0) {
|
|
1518
|
+
peg$fail(peg$e0);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
if (s4 !== peg$FAILED) {
|
|
1522
|
+
s5 = peg$parsebranch();
|
|
1523
|
+
s4 = [s4, s5];
|
|
1524
|
+
s3 = s4;
|
|
1525
|
+
} else {
|
|
1526
|
+
peg$currPos = s3;
|
|
1527
|
+
s3 = peg$FAILED;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
s1 = [s1, s2];
|
|
1531
|
+
s0 = s1;
|
|
1532
|
+
return s0;
|
|
1533
|
+
}
|
|
1534
|
+
function peg$parsebranch() {
|
|
1535
|
+
var s0, s1;
|
|
1536
|
+
s0 = [];
|
|
1537
|
+
s1 = peg$parsepiece();
|
|
1538
|
+
while (s1 !== peg$FAILED) {
|
|
1539
|
+
s0.push(s1);
|
|
1540
|
+
s1 = peg$parsepiece();
|
|
1541
|
+
}
|
|
1542
|
+
return s0;
|
|
1543
|
+
}
|
|
1544
|
+
function peg$parsepiece() {
|
|
1545
|
+
var s0, s1, s2;
|
|
1546
|
+
s0 = peg$currPos;
|
|
1547
|
+
s1 = peg$parseatom();
|
|
1548
|
+
if (s1 !== peg$FAILED) {
|
|
1549
|
+
s2 = peg$parsequantifier();
|
|
1550
|
+
if (s2 === peg$FAILED) {
|
|
1551
|
+
s2 = null;
|
|
1552
|
+
}
|
|
1553
|
+
s1 = [s1, s2];
|
|
1554
|
+
s0 = s1;
|
|
1555
|
+
} else {
|
|
1556
|
+
peg$currPos = s0;
|
|
1557
|
+
s0 = peg$FAILED;
|
|
1558
|
+
}
|
|
1559
|
+
return s0;
|
|
1560
|
+
}
|
|
1561
|
+
function peg$parsequantifier() {
|
|
1562
|
+
var s0;
|
|
1563
|
+
s0 = input.charAt(peg$currPos);
|
|
1564
|
+
if (peg$r0.test(s0)) {
|
|
1565
|
+
peg$currPos++;
|
|
1566
|
+
} else {
|
|
1567
|
+
s0 = peg$FAILED;
|
|
1568
|
+
if (peg$silentFails === 0) {
|
|
1569
|
+
peg$fail(peg$e1);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
if (s0 === peg$FAILED) {
|
|
1573
|
+
s0 = peg$parserange_quantifier();
|
|
1574
|
+
}
|
|
1575
|
+
return s0;
|
|
1576
|
+
}
|
|
1577
|
+
function peg$parserange_quantifier() {
|
|
1578
|
+
var s0, s1, s2, s3, s4, s5;
|
|
1579
|
+
s0 = peg$currPos;
|
|
1580
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
|
1581
|
+
s1 = peg$c1;
|
|
1582
|
+
peg$currPos++;
|
|
1583
|
+
} else {
|
|
1584
|
+
s1 = peg$FAILED;
|
|
1585
|
+
if (peg$silentFails === 0) {
|
|
1586
|
+
peg$fail(peg$e2);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
if (s1 !== peg$FAILED) {
|
|
1590
|
+
s2 = input.charAt(peg$currPos);
|
|
1591
|
+
if (peg$r1.test(s2)) {
|
|
1592
|
+
peg$currPos++;
|
|
1593
|
+
} else {
|
|
1594
|
+
s2 = peg$FAILED;
|
|
1595
|
+
if (peg$silentFails === 0) {
|
|
1596
|
+
peg$fail(peg$e3);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
if (s2 !== peg$FAILED) {
|
|
1600
|
+
s3 = peg$currPos;
|
|
1601
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
1602
|
+
s4 = peg$c2;
|
|
1603
|
+
peg$currPos++;
|
|
1604
|
+
} else {
|
|
1605
|
+
s4 = peg$FAILED;
|
|
1606
|
+
if (peg$silentFails === 0) {
|
|
1607
|
+
peg$fail(peg$e4);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
if (s4 !== peg$FAILED) {
|
|
1611
|
+
s5 = input.charAt(peg$currPos);
|
|
1612
|
+
if (peg$r1.test(s5)) {
|
|
1613
|
+
peg$currPos++;
|
|
1614
|
+
} else {
|
|
1615
|
+
s5 = peg$FAILED;
|
|
1616
|
+
if (peg$silentFails === 0) {
|
|
1617
|
+
peg$fail(peg$e3);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (s5 === peg$FAILED) {
|
|
1621
|
+
s5 = null;
|
|
1622
|
+
}
|
|
1623
|
+
s4 = [s4, s5];
|
|
1624
|
+
s3 = s4;
|
|
1625
|
+
} else {
|
|
1626
|
+
peg$currPos = s3;
|
|
1627
|
+
s3 = peg$FAILED;
|
|
1628
|
+
}
|
|
1629
|
+
if (s3 === peg$FAILED) {
|
|
1630
|
+
s3 = null;
|
|
1631
|
+
}
|
|
1632
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
1633
|
+
s4 = peg$c3;
|
|
1634
|
+
peg$currPos++;
|
|
1635
|
+
} else {
|
|
1636
|
+
s4 = peg$FAILED;
|
|
1637
|
+
if (peg$silentFails === 0) {
|
|
1638
|
+
peg$fail(peg$e5);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
if (s4 !== peg$FAILED) {
|
|
1642
|
+
s1 = [s1, s2, s3, s4];
|
|
1643
|
+
s0 = s1;
|
|
1644
|
+
} else {
|
|
1645
|
+
peg$currPos = s0;
|
|
1646
|
+
s0 = peg$FAILED;
|
|
1647
|
+
}
|
|
1648
|
+
} else {
|
|
1649
|
+
peg$currPos = s0;
|
|
1650
|
+
s0 = peg$FAILED;
|
|
1651
|
+
}
|
|
1652
|
+
} else {
|
|
1653
|
+
peg$currPos = s0;
|
|
1654
|
+
s0 = peg$FAILED;
|
|
1655
|
+
}
|
|
1656
|
+
return s0;
|
|
1657
|
+
}
|
|
1658
|
+
function peg$parseatom() {
|
|
1659
|
+
var s0, s1, s2, s3;
|
|
1660
|
+
s0 = peg$parsenormal_char();
|
|
1661
|
+
if (s0 === peg$FAILED) {
|
|
1662
|
+
s0 = peg$parsechar_class();
|
|
1663
|
+
if (s0 === peg$FAILED) {
|
|
1664
|
+
s0 = peg$currPos;
|
|
1665
|
+
if (input.charCodeAt(peg$currPos) === 40) {
|
|
1666
|
+
s1 = peg$c4;
|
|
1667
|
+
peg$currPos++;
|
|
1668
|
+
} else {
|
|
1669
|
+
s1 = peg$FAILED;
|
|
1670
|
+
if (peg$silentFails === 0) {
|
|
1671
|
+
peg$fail(peg$e6);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
if (s1 !== peg$FAILED) {
|
|
1675
|
+
s2 = peg$parseiregexp();
|
|
1676
|
+
if (s2 !== peg$FAILED) {
|
|
1677
|
+
if (input.charCodeAt(peg$currPos) === 41) {
|
|
1678
|
+
s3 = peg$c5;
|
|
1679
|
+
peg$currPos++;
|
|
1680
|
+
} else {
|
|
1681
|
+
s3 = peg$FAILED;
|
|
1682
|
+
if (peg$silentFails === 0) {
|
|
1683
|
+
peg$fail(peg$e7);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
if (s3 !== peg$FAILED) {
|
|
1687
|
+
s1 = [s1, s2, s3];
|
|
1688
|
+
s0 = s1;
|
|
1689
|
+
} else {
|
|
1690
|
+
peg$currPos = s0;
|
|
1691
|
+
s0 = peg$FAILED;
|
|
1692
|
+
}
|
|
1693
|
+
} else {
|
|
1694
|
+
peg$currPos = s0;
|
|
1695
|
+
s0 = peg$FAILED;
|
|
1696
|
+
}
|
|
1697
|
+
} else {
|
|
1698
|
+
peg$currPos = s0;
|
|
1699
|
+
s0 = peg$FAILED;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
return s0;
|
|
1704
|
+
}
|
|
1705
|
+
function peg$parsenormal_char() {
|
|
1706
|
+
var s0, s1, s2;
|
|
1707
|
+
s0 = peg$currPos;
|
|
1708
|
+
if (input.length > peg$currPos) {
|
|
1709
|
+
s1 = input.charAt(peg$currPos);
|
|
1710
|
+
peg$currPos++;
|
|
1711
|
+
} else {
|
|
1712
|
+
s1 = peg$FAILED;
|
|
1713
|
+
if (peg$silentFails === 0) {
|
|
1714
|
+
peg$fail(peg$e8);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
if (s1 !== peg$FAILED) {
|
|
1718
|
+
s2 = peg$f0(s1);
|
|
1719
|
+
if (s2) {
|
|
1720
|
+
s2 = undefined;
|
|
1721
|
+
} else {
|
|
1722
|
+
s2 = peg$FAILED;
|
|
1723
|
+
}
|
|
1724
|
+
if (s2 !== peg$FAILED) {
|
|
1725
|
+
s0 = s1;
|
|
1726
|
+
} else {
|
|
1727
|
+
peg$currPos = s0;
|
|
1728
|
+
s0 = peg$FAILED;
|
|
1729
|
+
}
|
|
1730
|
+
} else {
|
|
1731
|
+
peg$currPos = s0;
|
|
1732
|
+
s0 = peg$FAILED;
|
|
1733
|
+
}
|
|
1734
|
+
return s0;
|
|
1735
|
+
}
|
|
1736
|
+
function peg$parsechar_class() {
|
|
1737
|
+
var s0;
|
|
1738
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
|
1739
|
+
s0 = peg$c6;
|
|
1740
|
+
peg$currPos++;
|
|
1741
|
+
} else {
|
|
1742
|
+
s0 = peg$FAILED;
|
|
1743
|
+
if (peg$silentFails === 0) {
|
|
1744
|
+
peg$fail(peg$e9);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
if (s0 === peg$FAILED) {
|
|
1748
|
+
s0 = peg$parsesingle_char_esc();
|
|
1749
|
+
if (s0 === peg$FAILED) {
|
|
1750
|
+
s0 = peg$parsechar_class_esc();
|
|
1751
|
+
if (s0 === peg$FAILED) {
|
|
1752
|
+
s0 = peg$parsechar_class_expr();
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return s0;
|
|
1757
|
+
}
|
|
1758
|
+
function peg$parsesingle_char_esc() {
|
|
1759
|
+
var s0, s1, s2;
|
|
1760
|
+
s0 = peg$currPos;
|
|
1761
|
+
if (input.charCodeAt(peg$currPos) === 92) {
|
|
1762
|
+
s1 = peg$c7;
|
|
1763
|
+
peg$currPos++;
|
|
1764
|
+
} else {
|
|
1765
|
+
s1 = peg$FAILED;
|
|
1766
|
+
if (peg$silentFails === 0) {
|
|
1767
|
+
peg$fail(peg$e10);
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
if (s1 !== peg$FAILED) {
|
|
1771
|
+
s2 = input.charAt(peg$currPos);
|
|
1772
|
+
if (peg$r2.test(s2)) {
|
|
1773
|
+
peg$currPos++;
|
|
1774
|
+
} else {
|
|
1775
|
+
s2 = peg$FAILED;
|
|
1776
|
+
if (peg$silentFails === 0) {
|
|
1777
|
+
peg$fail(peg$e11);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
if (s2 !== peg$FAILED) {
|
|
1781
|
+
s1 = [s1, s2];
|
|
1782
|
+
s0 = s1;
|
|
1783
|
+
} else {
|
|
1784
|
+
peg$currPos = s0;
|
|
1785
|
+
s0 = peg$FAILED;
|
|
1786
|
+
}
|
|
1787
|
+
} else {
|
|
1788
|
+
peg$currPos = s0;
|
|
1789
|
+
s0 = peg$FAILED;
|
|
1790
|
+
}
|
|
1791
|
+
return s0;
|
|
1792
|
+
}
|
|
1793
|
+
function peg$parsechar_class_esc() {
|
|
1794
|
+
var s0;
|
|
1795
|
+
s0 = peg$parsecat_esc();
|
|
1796
|
+
if (s0 === peg$FAILED) {
|
|
1797
|
+
s0 = peg$parsecompl_esc();
|
|
1798
|
+
}
|
|
1799
|
+
return s0;
|
|
1800
|
+
}
|
|
1801
|
+
function peg$parsechar_class_expr() {
|
|
1802
|
+
var s0, s1, s2, s3, s4, s5, s6;
|
|
1803
|
+
s0 = peg$currPos;
|
|
1804
|
+
if (input.charCodeAt(peg$currPos) === 91) {
|
|
1805
|
+
s1 = peg$c8;
|
|
1806
|
+
peg$currPos++;
|
|
1807
|
+
} else {
|
|
1808
|
+
s1 = peg$FAILED;
|
|
1809
|
+
if (peg$silentFails === 0) {
|
|
1810
|
+
peg$fail(peg$e12);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
if (s1 !== peg$FAILED) {
|
|
1814
|
+
if (input.charCodeAt(peg$currPos) === 94) {
|
|
1815
|
+
s2 = peg$c9;
|
|
1816
|
+
peg$currPos++;
|
|
1817
|
+
} else {
|
|
1818
|
+
s2 = peg$FAILED;
|
|
1819
|
+
if (peg$silentFails === 0) {
|
|
1820
|
+
peg$fail(peg$e13);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
if (s2 === peg$FAILED) {
|
|
1824
|
+
s2 = null;
|
|
1825
|
+
}
|
|
1826
|
+
if (input.charCodeAt(peg$currPos) === 45) {
|
|
1827
|
+
s3 = peg$c10;
|
|
1828
|
+
peg$currPos++;
|
|
1829
|
+
} else {
|
|
1830
|
+
s3 = peg$FAILED;
|
|
1831
|
+
if (peg$silentFails === 0) {
|
|
1832
|
+
peg$fail(peg$e14);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
if (s3 === peg$FAILED) {
|
|
1836
|
+
s3 = peg$parsecce1();
|
|
1837
|
+
}
|
|
1838
|
+
if (s3 !== peg$FAILED) {
|
|
1839
|
+
s4 = [];
|
|
1840
|
+
s5 = peg$parsecce1();
|
|
1841
|
+
while (s5 !== peg$FAILED) {
|
|
1842
|
+
s4.push(s5);
|
|
1843
|
+
s5 = peg$parsecce1();
|
|
1844
|
+
}
|
|
1845
|
+
if (input.charCodeAt(peg$currPos) === 45) {
|
|
1846
|
+
s5 = peg$c10;
|
|
1847
|
+
peg$currPos++;
|
|
1848
|
+
} else {
|
|
1849
|
+
s5 = peg$FAILED;
|
|
1850
|
+
if (peg$silentFails === 0) {
|
|
1851
|
+
peg$fail(peg$e14);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
if (s5 === peg$FAILED) {
|
|
1855
|
+
s5 = null;
|
|
1856
|
+
}
|
|
1857
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
|
1858
|
+
s6 = peg$c11;
|
|
1859
|
+
peg$currPos++;
|
|
1860
|
+
} else {
|
|
1861
|
+
s6 = peg$FAILED;
|
|
1862
|
+
if (peg$silentFails === 0) {
|
|
1863
|
+
peg$fail(peg$e15);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
if (s6 !== peg$FAILED) {
|
|
1867
|
+
s1 = [s1, s2, s3, s4, s5, s6];
|
|
1868
|
+
s0 = s1;
|
|
1869
|
+
} else {
|
|
1870
|
+
peg$currPos = s0;
|
|
1871
|
+
s0 = peg$FAILED;
|
|
1872
|
+
}
|
|
1873
|
+
} else {
|
|
1874
|
+
peg$currPos = s0;
|
|
1875
|
+
s0 = peg$FAILED;
|
|
1876
|
+
}
|
|
1877
|
+
} else {
|
|
1878
|
+
peg$currPos = s0;
|
|
1879
|
+
s0 = peg$FAILED;
|
|
1880
|
+
}
|
|
1881
|
+
return s0;
|
|
1882
|
+
}
|
|
1883
|
+
function peg$parsecce1() {
|
|
1884
|
+
var s0, s1, s2, s3, s4;
|
|
1885
|
+
s0 = peg$currPos;
|
|
1886
|
+
s1 = peg$parsecc_char();
|
|
1887
|
+
if (s1 !== peg$FAILED) {
|
|
1888
|
+
s2 = peg$currPos;
|
|
1889
|
+
if (input.charCodeAt(peg$currPos) === 45) {
|
|
1890
|
+
s3 = peg$c10;
|
|
1891
|
+
peg$currPos++;
|
|
1892
|
+
} else {
|
|
1893
|
+
s3 = peg$FAILED;
|
|
1894
|
+
if (peg$silentFails === 0) {
|
|
1895
|
+
peg$fail(peg$e14);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
if (s3 !== peg$FAILED) {
|
|
1899
|
+
s4 = peg$parsecc_char();
|
|
1900
|
+
if (s4 !== peg$FAILED) {
|
|
1901
|
+
s3 = [s3, s4];
|
|
1902
|
+
s2 = s3;
|
|
1903
|
+
} else {
|
|
1904
|
+
peg$currPos = s2;
|
|
1905
|
+
s2 = peg$FAILED;
|
|
1906
|
+
}
|
|
1907
|
+
} else {
|
|
1908
|
+
peg$currPos = s2;
|
|
1909
|
+
s2 = peg$FAILED;
|
|
1910
|
+
}
|
|
1911
|
+
if (s2 === peg$FAILED) {
|
|
1912
|
+
s2 = null;
|
|
1913
|
+
}
|
|
1914
|
+
s1 = [s1, s2];
|
|
1915
|
+
s0 = s1;
|
|
1916
|
+
} else {
|
|
1917
|
+
peg$currPos = s0;
|
|
1918
|
+
s0 = peg$FAILED;
|
|
1919
|
+
}
|
|
1920
|
+
if (s0 === peg$FAILED) {
|
|
1921
|
+
s0 = peg$parsechar_class_esc();
|
|
1922
|
+
}
|
|
1923
|
+
return s0;
|
|
1924
|
+
}
|
|
1925
|
+
function peg$parsecc_char() {
|
|
1926
|
+
var s0, s1, s2;
|
|
1927
|
+
s0 = peg$currPos;
|
|
1928
|
+
if (input.length > peg$currPos) {
|
|
1929
|
+
s1 = input.charAt(peg$currPos);
|
|
1930
|
+
peg$currPos++;
|
|
1931
|
+
} else {
|
|
1932
|
+
s1 = peg$FAILED;
|
|
1933
|
+
if (peg$silentFails === 0) {
|
|
1934
|
+
peg$fail(peg$e8);
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
if (s1 !== peg$FAILED) {
|
|
1938
|
+
s2 = peg$f1(s1);
|
|
1939
|
+
if (s2) {
|
|
1940
|
+
s2 = undefined;
|
|
1941
|
+
} else {
|
|
1942
|
+
s2 = peg$FAILED;
|
|
1943
|
+
}
|
|
1944
|
+
if (s2 !== peg$FAILED) {
|
|
1945
|
+
s0 = s1;
|
|
1946
|
+
} else {
|
|
1947
|
+
peg$currPos = s0;
|
|
1948
|
+
s0 = peg$FAILED;
|
|
1949
|
+
}
|
|
1950
|
+
} else {
|
|
1951
|
+
peg$currPos = s0;
|
|
1952
|
+
s0 = peg$FAILED;
|
|
1953
|
+
}
|
|
1954
|
+
if (s0 === peg$FAILED) {
|
|
1955
|
+
s0 = peg$parsesingle_char_esc();
|
|
1956
|
+
}
|
|
1957
|
+
return s0;
|
|
1958
|
+
}
|
|
1959
|
+
function peg$parsecat_esc() {
|
|
1960
|
+
var s0, s1, s2, s3;
|
|
1961
|
+
s0 = peg$currPos;
|
|
1962
|
+
if (input.substr(peg$currPos, 3) === peg$c12) {
|
|
1963
|
+
s1 = peg$c12;
|
|
1964
|
+
peg$currPos += 3;
|
|
1965
|
+
} else {
|
|
1966
|
+
s1 = peg$FAILED;
|
|
1967
|
+
if (peg$silentFails === 0) {
|
|
1968
|
+
peg$fail(peg$e16);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
if (s1 !== peg$FAILED) {
|
|
1972
|
+
s2 = peg$parseis_category();
|
|
1973
|
+
if (s2 !== peg$FAILED) {
|
|
1974
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
1975
|
+
s3 = peg$c3;
|
|
1976
|
+
peg$currPos++;
|
|
1977
|
+
} else {
|
|
1978
|
+
s3 = peg$FAILED;
|
|
1979
|
+
if (peg$silentFails === 0) {
|
|
1980
|
+
peg$fail(peg$e5);
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
if (s3 !== peg$FAILED) {
|
|
1984
|
+
s1 = [s1, s2, s3];
|
|
1985
|
+
s0 = s1;
|
|
1986
|
+
} else {
|
|
1987
|
+
peg$currPos = s0;
|
|
1988
|
+
s0 = peg$FAILED;
|
|
1989
|
+
}
|
|
1990
|
+
} else {
|
|
1991
|
+
peg$currPos = s0;
|
|
1992
|
+
s0 = peg$FAILED;
|
|
1993
|
+
}
|
|
1994
|
+
} else {
|
|
1995
|
+
peg$currPos = s0;
|
|
1996
|
+
s0 = peg$FAILED;
|
|
1997
|
+
}
|
|
1998
|
+
return s0;
|
|
1999
|
+
}
|
|
2000
|
+
function peg$parsecompl_esc() {
|
|
2001
|
+
var s0, s1, s2, s3;
|
|
2002
|
+
s0 = peg$currPos;
|
|
2003
|
+
if (input.substr(peg$currPos, 3) === peg$c13) {
|
|
2004
|
+
s1 = peg$c13;
|
|
2005
|
+
peg$currPos += 3;
|
|
2006
|
+
} else {
|
|
2007
|
+
s1 = peg$FAILED;
|
|
2008
|
+
if (peg$silentFails === 0) {
|
|
2009
|
+
peg$fail(peg$e17);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
if (s1 !== peg$FAILED) {
|
|
2013
|
+
s2 = peg$parseis_category();
|
|
2014
|
+
if (s2 !== peg$FAILED) {
|
|
2015
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
2016
|
+
s3 = peg$c3;
|
|
2017
|
+
peg$currPos++;
|
|
2018
|
+
} else {
|
|
2019
|
+
s3 = peg$FAILED;
|
|
2020
|
+
if (peg$silentFails === 0) {
|
|
2021
|
+
peg$fail(peg$e5);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
if (s3 !== peg$FAILED) {
|
|
2025
|
+
s1 = [s1, s2, s3];
|
|
2026
|
+
s0 = s1;
|
|
2027
|
+
} else {
|
|
2028
|
+
peg$currPos = s0;
|
|
2029
|
+
s0 = peg$FAILED;
|
|
2030
|
+
}
|
|
2031
|
+
} else {
|
|
2032
|
+
peg$currPos = s0;
|
|
2033
|
+
s0 = peg$FAILED;
|
|
2034
|
+
}
|
|
2035
|
+
} else {
|
|
2036
|
+
peg$currPos = s0;
|
|
2037
|
+
s0 = peg$FAILED;
|
|
2038
|
+
}
|
|
2039
|
+
return s0;
|
|
2040
|
+
}
|
|
2041
|
+
function peg$parseis_category() {
|
|
2042
|
+
var s0;
|
|
2043
|
+
s0 = peg$parseletters();
|
|
2044
|
+
if (s0 === peg$FAILED) {
|
|
2045
|
+
s0 = peg$parsemarks();
|
|
2046
|
+
if (s0 === peg$FAILED) {
|
|
2047
|
+
s0 = peg$parsenumbers();
|
|
2048
|
+
if (s0 === peg$FAILED) {
|
|
2049
|
+
s0 = peg$parsepunctuation();
|
|
2050
|
+
if (s0 === peg$FAILED) {
|
|
2051
|
+
s0 = peg$parseseparators();
|
|
2052
|
+
if (s0 === peg$FAILED) {
|
|
2053
|
+
s0 = peg$parsesymbols();
|
|
2054
|
+
if (s0 === peg$FAILED) {
|
|
2055
|
+
s0 = peg$parseothers();
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
return s0;
|
|
2063
|
+
}
|
|
2064
|
+
function peg$parseletters() {
|
|
2065
|
+
var s0, s1, s2;
|
|
2066
|
+
s0 = peg$currPos;
|
|
2067
|
+
if (input.charCodeAt(peg$currPos) === 76) {
|
|
2068
|
+
s1 = peg$c14;
|
|
2069
|
+
peg$currPos++;
|
|
2070
|
+
} else {
|
|
2071
|
+
s1 = peg$FAILED;
|
|
2072
|
+
if (peg$silentFails === 0) {
|
|
2073
|
+
peg$fail(peg$e18);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
if (s1 !== peg$FAILED) {
|
|
2077
|
+
s2 = input.charAt(peg$currPos);
|
|
2078
|
+
if (peg$r3.test(s2)) {
|
|
2079
|
+
peg$currPos++;
|
|
2080
|
+
} else {
|
|
2081
|
+
s2 = peg$FAILED;
|
|
2082
|
+
if (peg$silentFails === 0) {
|
|
2083
|
+
peg$fail(peg$e19);
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
if (s2 === peg$FAILED) {
|
|
2087
|
+
s2 = null;
|
|
2088
|
+
}
|
|
2089
|
+
s1 = [s1, s2];
|
|
2090
|
+
s0 = s1;
|
|
2091
|
+
} else {
|
|
2092
|
+
peg$currPos = s0;
|
|
2093
|
+
s0 = peg$FAILED;
|
|
2094
|
+
}
|
|
2095
|
+
return s0;
|
|
2096
|
+
}
|
|
2097
|
+
function peg$parsemarks() {
|
|
2098
|
+
var s0, s1, s2;
|
|
2099
|
+
s0 = peg$currPos;
|
|
2100
|
+
if (input.charCodeAt(peg$currPos) === 77) {
|
|
2101
|
+
s1 = peg$c15;
|
|
2102
|
+
peg$currPos++;
|
|
2103
|
+
} else {
|
|
2104
|
+
s1 = peg$FAILED;
|
|
2105
|
+
if (peg$silentFails === 0) {
|
|
2106
|
+
peg$fail(peg$e20);
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
if (s1 !== peg$FAILED) {
|
|
2110
|
+
s2 = input.charAt(peg$currPos);
|
|
2111
|
+
if (peg$r4.test(s2)) {
|
|
2112
|
+
peg$currPos++;
|
|
2113
|
+
} else {
|
|
2114
|
+
s2 = peg$FAILED;
|
|
2115
|
+
if (peg$silentFails === 0) {
|
|
2116
|
+
peg$fail(peg$e21);
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
if (s2 === peg$FAILED) {
|
|
2120
|
+
s2 = null;
|
|
2121
|
+
}
|
|
2122
|
+
s1 = [s1, s2];
|
|
2123
|
+
s0 = s1;
|
|
2124
|
+
} else {
|
|
2125
|
+
peg$currPos = s0;
|
|
2126
|
+
s0 = peg$FAILED;
|
|
2127
|
+
}
|
|
2128
|
+
return s0;
|
|
2129
|
+
}
|
|
2130
|
+
function peg$parsenumbers() {
|
|
2131
|
+
var s0, s1, s2;
|
|
2132
|
+
s0 = peg$currPos;
|
|
2133
|
+
if (input.charCodeAt(peg$currPos) === 78) {
|
|
2134
|
+
s1 = peg$c16;
|
|
2135
|
+
peg$currPos++;
|
|
2136
|
+
} else {
|
|
2137
|
+
s1 = peg$FAILED;
|
|
2138
|
+
if (peg$silentFails === 0) {
|
|
2139
|
+
peg$fail(peg$e22);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
if (s1 !== peg$FAILED) {
|
|
2143
|
+
s2 = input.charAt(peg$currPos);
|
|
2144
|
+
if (peg$r5.test(s2)) {
|
|
2145
|
+
peg$currPos++;
|
|
2146
|
+
} else {
|
|
2147
|
+
s2 = peg$FAILED;
|
|
2148
|
+
if (peg$silentFails === 0) {
|
|
2149
|
+
peg$fail(peg$e23);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
if (s2 === peg$FAILED) {
|
|
2153
|
+
s2 = null;
|
|
2154
|
+
}
|
|
2155
|
+
s1 = [s1, s2];
|
|
2156
|
+
s0 = s1;
|
|
2157
|
+
} else {
|
|
2158
|
+
peg$currPos = s0;
|
|
2159
|
+
s0 = peg$FAILED;
|
|
2160
|
+
}
|
|
2161
|
+
return s0;
|
|
2162
|
+
}
|
|
2163
|
+
function peg$parsepunctuation() {
|
|
2164
|
+
var s0, s1, s2;
|
|
2165
|
+
s0 = peg$currPos;
|
|
2166
|
+
if (input.charCodeAt(peg$currPos) === 80) {
|
|
2167
|
+
s1 = peg$c17;
|
|
2168
|
+
peg$currPos++;
|
|
2169
|
+
} else {
|
|
2170
|
+
s1 = peg$FAILED;
|
|
2171
|
+
if (peg$silentFails === 0) {
|
|
2172
|
+
peg$fail(peg$e24);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
if (s1 !== peg$FAILED) {
|
|
2176
|
+
s2 = input.charAt(peg$currPos);
|
|
2177
|
+
if (peg$r6.test(s2)) {
|
|
2178
|
+
peg$currPos++;
|
|
2179
|
+
} else {
|
|
2180
|
+
s2 = peg$FAILED;
|
|
2181
|
+
if (peg$silentFails === 0) {
|
|
2182
|
+
peg$fail(peg$e25);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
if (s2 === peg$FAILED) {
|
|
2186
|
+
s2 = null;
|
|
2187
|
+
}
|
|
2188
|
+
s1 = [s1, s2];
|
|
2189
|
+
s0 = s1;
|
|
2190
|
+
} else {
|
|
2191
|
+
peg$currPos = s0;
|
|
2192
|
+
s0 = peg$FAILED;
|
|
2193
|
+
}
|
|
2194
|
+
return s0;
|
|
2195
|
+
}
|
|
2196
|
+
function peg$parseseparators() {
|
|
2197
|
+
var s0, s1, s2;
|
|
2198
|
+
s0 = peg$currPos;
|
|
2199
|
+
if (input.charCodeAt(peg$currPos) === 90) {
|
|
2200
|
+
s1 = peg$c18;
|
|
2201
|
+
peg$currPos++;
|
|
2202
|
+
} else {
|
|
2203
|
+
s1 = peg$FAILED;
|
|
2204
|
+
if (peg$silentFails === 0) {
|
|
2205
|
+
peg$fail(peg$e26);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
if (s1 !== peg$FAILED) {
|
|
2209
|
+
s2 = input.charAt(peg$currPos);
|
|
2210
|
+
if (peg$r7.test(s2)) {
|
|
2211
|
+
peg$currPos++;
|
|
2212
|
+
} else {
|
|
2213
|
+
s2 = peg$FAILED;
|
|
2214
|
+
if (peg$silentFails === 0) {
|
|
2215
|
+
peg$fail(peg$e27);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
if (s2 === peg$FAILED) {
|
|
2219
|
+
s2 = null;
|
|
2220
|
+
}
|
|
2221
|
+
s1 = [s1, s2];
|
|
2222
|
+
s0 = s1;
|
|
2223
|
+
} else {
|
|
2224
|
+
peg$currPos = s0;
|
|
2225
|
+
s0 = peg$FAILED;
|
|
2226
|
+
}
|
|
2227
|
+
return s0;
|
|
2228
|
+
}
|
|
2229
|
+
function peg$parsesymbols() {
|
|
2230
|
+
var s0, s1, s2;
|
|
2231
|
+
s0 = peg$currPos;
|
|
2232
|
+
if (input.charCodeAt(peg$currPos) === 83) {
|
|
2233
|
+
s1 = peg$c19;
|
|
2234
|
+
peg$currPos++;
|
|
2235
|
+
} else {
|
|
2236
|
+
s1 = peg$FAILED;
|
|
2237
|
+
if (peg$silentFails === 0) {
|
|
2238
|
+
peg$fail(peg$e28);
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
if (s1 !== peg$FAILED) {
|
|
2242
|
+
s2 = input.charAt(peg$currPos);
|
|
2243
|
+
if (peg$r8.test(s2)) {
|
|
2244
|
+
peg$currPos++;
|
|
2245
|
+
} else {
|
|
2246
|
+
s2 = peg$FAILED;
|
|
2247
|
+
if (peg$silentFails === 0) {
|
|
2248
|
+
peg$fail(peg$e29);
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
if (s2 === peg$FAILED) {
|
|
2252
|
+
s2 = null;
|
|
2253
|
+
}
|
|
2254
|
+
s1 = [s1, s2];
|
|
2255
|
+
s0 = s1;
|
|
2256
|
+
} else {
|
|
2257
|
+
peg$currPos = s0;
|
|
2258
|
+
s0 = peg$FAILED;
|
|
2259
|
+
}
|
|
2260
|
+
return s0;
|
|
2261
|
+
}
|
|
2262
|
+
function peg$parseothers() {
|
|
2263
|
+
var s0, s1, s2;
|
|
2264
|
+
s0 = peg$currPos;
|
|
2265
|
+
if (input.charCodeAt(peg$currPos) === 67) {
|
|
2266
|
+
s1 = peg$c20;
|
|
2267
|
+
peg$currPos++;
|
|
2268
|
+
} else {
|
|
2269
|
+
s1 = peg$FAILED;
|
|
2270
|
+
if (peg$silentFails === 0) {
|
|
2271
|
+
peg$fail(peg$e30);
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
if (s1 !== peg$FAILED) {
|
|
2275
|
+
s2 = input.charAt(peg$currPos);
|
|
2276
|
+
if (peg$r9.test(s2)) {
|
|
2277
|
+
peg$currPos++;
|
|
2278
|
+
} else {
|
|
2279
|
+
s2 = peg$FAILED;
|
|
2280
|
+
if (peg$silentFails === 0) {
|
|
2281
|
+
peg$fail(peg$e31);
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
if (s2 === peg$FAILED) {
|
|
2285
|
+
s2 = null;
|
|
2286
|
+
}
|
|
2287
|
+
s1 = [s1, s2];
|
|
2288
|
+
s0 = s1;
|
|
2289
|
+
} else {
|
|
2290
|
+
peg$currPos = s0;
|
|
2291
|
+
s0 = peg$FAILED;
|
|
2292
|
+
}
|
|
2293
|
+
return s0;
|
|
2294
|
+
}
|
|
2295
|
+
peg$result = peg$startRuleFunction();
|
|
2296
|
+
if (options.peg$library) {
|
|
2297
|
+
return /** @type {any} */{
|
|
2298
|
+
peg$result,
|
|
2299
|
+
peg$currPos,
|
|
2300
|
+
peg$FAILED,
|
|
2301
|
+
peg$maxFailExpected,
|
|
2302
|
+
peg$maxFailPos
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
2306
|
+
return peg$result;
|
|
2307
|
+
} else {
|
|
2308
|
+
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
2309
|
+
peg$fail(peg$endExpectation());
|
|
2310
|
+
}
|
|
2311
|
+
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
var iregexp$1 = {
|
|
2315
|
+
StartRules: ["start"],
|
|
2316
|
+
SyntaxError: peg$SyntaxError,
|
|
2317
|
+
parse: peg$parse
|
|
2318
|
+
};
|
|
2319
|
+
|
|
2320
|
+
const iregexp = iregexp$1;
|
|
2321
|
+
|
|
2322
|
+
/**
|
|
2323
|
+
* Return _true_ if _pattern_ is a valid I-Regexp
|
|
2324
|
+
* @param {string} pattern - Regular expression pattern to check.
|
|
2325
|
+
* @returns true if _pattern_ is valid, or false otherwise.
|
|
2326
|
+
*/
|
|
2327
|
+
function check(pattern) {
|
|
2328
|
+
try {
|
|
2329
|
+
iregexp.parse(pattern, {});
|
|
2330
|
+
} catch (error) {
|
|
2331
|
+
if (error instanceof iregexp.SyntaxError) {
|
|
2332
|
+
return false;
|
|
2333
|
+
}
|
|
2334
|
+
throw error;
|
|
2335
|
+
}
|
|
2336
|
+
return true;
|
|
2337
|
+
}
|
|
2338
|
+
var check_1 = {
|
|
2339
|
+
check
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2342
|
+
var check$1 = check_1.check;
|
|
2343
|
+
|
|
1083
2344
|
class Match {
|
|
1084
2345
|
argTypes = [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType];
|
|
1085
2346
|
returnType = FunctionExpressionType.LogicalType;
|
|
@@ -1089,8 +2350,11 @@ class Match {
|
|
|
1089
2350
|
this.options = options;
|
|
1090
2351
|
this.cacheSize = options.cacheSize ?? 10;
|
|
1091
2352
|
this.throwErrors = options.throwErrors ?? false;
|
|
2353
|
+
this.iRegexpCheck = options.iRegexpCheck ?? true;
|
|
1092
2354
|
this.#cache = new LRUCache(this.cacheSize);
|
|
1093
2355
|
}
|
|
2356
|
+
|
|
2357
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
1094
2358
|
call(s, pattern) {
|
|
1095
2359
|
if (this.cacheSize > 0) {
|
|
1096
2360
|
const re = this.#cache.get(pattern);
|
|
@@ -1103,6 +2367,18 @@ class Match {
|
|
|
1103
2367
|
}
|
|
1104
2368
|
}
|
|
1105
2369
|
}
|
|
2370
|
+
if (!isString(pattern)) {
|
|
2371
|
+
if (this.throwErrors) {
|
|
2372
|
+
throw new IRegexpError(`match() expected a string pattern, found ${pattern}`);
|
|
2373
|
+
}
|
|
2374
|
+
return false;
|
|
2375
|
+
}
|
|
2376
|
+
if (this.iRegexpCheck && !check$1(pattern)) {
|
|
2377
|
+
if (this.throwErrors) {
|
|
2378
|
+
throw new IRegexpError(`pattern ${pattern} is not a valid I-Regexp pattern`);
|
|
2379
|
+
}
|
|
2380
|
+
return false;
|
|
2381
|
+
}
|
|
1106
2382
|
try {
|
|
1107
2383
|
const re = new RegExp(this.fullMatch(pattern), "u");
|
|
1108
2384
|
if (this.cacheSize > 0) this.#cache.set(pattern, re);
|
|
@@ -1114,9 +2390,11 @@ class Match {
|
|
|
1114
2390
|
}
|
|
1115
2391
|
fullMatch(pattern) {
|
|
1116
2392
|
const parts = [];
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
if (!
|
|
2393
|
+
const explicitCaret = pattern.startsWith("^");
|
|
2394
|
+
const explicitDollar = pattern.endsWith("$");
|
|
2395
|
+
if (!explicitCaret && !explicitDollar) parts.push("^(?:");
|
|
2396
|
+
parts.push(mapRegexp(pattern));
|
|
2397
|
+
if (!explicitCaret && !explicitDollar) parts.push(")$");
|
|
1120
2398
|
return parts.join("");
|
|
1121
2399
|
}
|
|
1122
2400
|
}
|
|
@@ -1130,8 +2408,11 @@ class Search {
|
|
|
1130
2408
|
this.options = options;
|
|
1131
2409
|
this.cacheSize = options.cacheSize ?? 10;
|
|
1132
2410
|
this.throwErrors = options.throwErrors ?? false;
|
|
2411
|
+
this.iRegexpCheck = options.iRegexpCheck ?? true;
|
|
1133
2412
|
this.#cache = new LRUCache(this.cacheSize);
|
|
1134
2413
|
}
|
|
2414
|
+
|
|
2415
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
1135
2416
|
call(s, pattern) {
|
|
1136
2417
|
if (this.cacheSize > 0) {
|
|
1137
2418
|
const re = this.#cache.get(pattern);
|
|
@@ -1144,8 +2425,20 @@ class Search {
|
|
|
1144
2425
|
}
|
|
1145
2426
|
}
|
|
1146
2427
|
}
|
|
2428
|
+
if (!isString(pattern)) {
|
|
2429
|
+
if (this.throwErrors) {
|
|
2430
|
+
throw new IRegexpError(`match() expected a string pattern, found ${pattern}`);
|
|
2431
|
+
}
|
|
2432
|
+
return false;
|
|
2433
|
+
}
|
|
2434
|
+
if (this.iRegexpCheck && !check$1(pattern)) {
|
|
2435
|
+
if (this.throwErrors) {
|
|
2436
|
+
throw new IRegexpError(`pattern ${pattern} is not a valid I-Regexp pattern`);
|
|
2437
|
+
}
|
|
2438
|
+
return false;
|
|
2439
|
+
}
|
|
1147
2440
|
try {
|
|
1148
|
-
const re = new RegExp(pattern, "u");
|
|
2441
|
+
const re = new RegExp(mapRegexp(pattern), "u");
|
|
1149
2442
|
if (this.cacheSize > 0) this.#cache.set(pattern, re);
|
|
1150
2443
|
return !!s.match(re);
|
|
1151
2444
|
} catch (error) {
|
|
@@ -1567,6 +2860,7 @@ function lexInsideBracketedSelection(l) {
|
|
|
1567
2860
|
continue;
|
|
1568
2861
|
}
|
|
1569
2862
|
if (!l.environment.strict && l.acceptMatchRun(l.environment.keysPattern)) {
|
|
2863
|
+
// FIXME: fall back to legacy behavior if keysPattern is not the default
|
|
1570
2864
|
switch (l.peek()) {
|
|
1571
2865
|
case "'":
|
|
1572
2866
|
l.ignore(); // ~
|
|
@@ -1577,7 +2871,6 @@ function lexInsideBracketedSelection(l) {
|
|
|
1577
2871
|
l.next();
|
|
1578
2872
|
return lexDoubleQuoteKeyString(l);
|
|
1579
2873
|
case "?":
|
|
1580
|
-
l.ignore(); // ~
|
|
1581
2874
|
l.next();
|
|
1582
2875
|
l.emit(TokenKind.KEYS_FILTER);
|
|
1583
2876
|
l.filterLevel += 1;
|
|
@@ -3682,6 +4975,6 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3682
4975
|
apply: apply
|
|
3683
4976
|
});
|
|
3684
4977
|
|
|
3685
|
-
const version = "1.3.
|
|
4978
|
+
const version = "1.3.2";
|
|
3686
4979
|
|
|
3687
4980
|
export { DEFAULT_ENVIRONMENT, FunctionExpressionType, JSONPatch, JSONPatchError, JSONPatchTestFailure, JSONPath, JSONPathEnvironment, JSONPathError, JSONPathIndexError, JSONPathLexerError, JSONPathNode, JSONPathNodeList, JSONPathRecursionLimitError, JSONPathSyntaxError, JSONPathTypeError, JSONPointer, Nothing, RelativeJSONPointer, Token, TokenKind, UNDEFINED, apply, compile, index as jsonpatch, index$1 as jsonpath, index$3 as jsonpointer, lazyQuery, query, resolve, version };
|