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