@hpcc-js/observablehq-compiler 1.2.7 → 1.2.9
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/index.esm.js +524 -142
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +2 -2
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.js +524 -142
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/package.json +5 -5
- package/src/__package__.ts +2 -2
- package/types/__package__.d.ts +2 -2
- package/types-3.4/__package__.d.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
18
18
|
|
|
19
19
|
// These are a run-length and offset encoded representation of the
|
|
20
|
+
// >0xffff code points that are a valid part of identifiers. The
|
|
21
|
+
// offset starts at 0x10000, and each pair of numbers represents an
|
|
22
|
+
// offset to the next range, and then a size of the range.
|
|
20
23
|
|
|
21
24
|
// Reserved word lists for various dialects of the language
|
|
22
25
|
|
|
@@ -369,6 +372,10 @@
|
|
|
369
372
|
// allowed and treated as a line comment. Enabled by default when
|
|
370
373
|
// `ecmaVersion` >= 2023.
|
|
371
374
|
allowHashBang: false,
|
|
375
|
+
// By default, the parser will verify that private properties are
|
|
376
|
+
// only used in places where they are valid and have been declared.
|
|
377
|
+
// Set this to false to turn such checks off.
|
|
378
|
+
checkPrivateFields: true,
|
|
372
379
|
// When `locations` is on, `loc` properties holding objects with
|
|
373
380
|
// `start` and `end` properties in `{line, column}` form (with
|
|
374
381
|
// line being 1-based and column 0-based) will be attached to the
|
|
@@ -1135,6 +1142,16 @@
|
|
|
1135
1142
|
|
|
1136
1143
|
var empty$1 = [];
|
|
1137
1144
|
|
|
1145
|
+
pp$8.parseCatchClauseParam = function() {
|
|
1146
|
+
var param = this.parseBindingAtom();
|
|
1147
|
+
var simple = param.type === "Identifier";
|
|
1148
|
+
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
1149
|
+
this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
1150
|
+
this.expect(types$1.parenR);
|
|
1151
|
+
|
|
1152
|
+
return param
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1138
1155
|
pp$8.parseTryStatement = function(node) {
|
|
1139
1156
|
this.next();
|
|
1140
1157
|
node.block = this.parseBlock();
|
|
@@ -1143,11 +1160,7 @@
|
|
|
1143
1160
|
var clause = this.startNode();
|
|
1144
1161
|
this.next();
|
|
1145
1162
|
if (this.eat(types$1.parenL)) {
|
|
1146
|
-
clause.param = this.
|
|
1147
|
-
var simple = clause.param.type === "Identifier";
|
|
1148
|
-
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
1149
|
-
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
1150
|
-
this.expect(types$1.parenR);
|
|
1163
|
+
clause.param = this.parseCatchClauseParam();
|
|
1151
1164
|
} else {
|
|
1152
1165
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
1153
1166
|
clause.param = null;
|
|
@@ -1163,9 +1176,9 @@
|
|
|
1163
1176
|
return this.finishNode(node, "TryStatement")
|
|
1164
1177
|
};
|
|
1165
1178
|
|
|
1166
|
-
pp$8.parseVarStatement = function(node, kind) {
|
|
1179
|
+
pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
|
|
1167
1180
|
this.next();
|
|
1168
|
-
this.parseVar(node, false, kind);
|
|
1181
|
+
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
1169
1182
|
this.semicolon();
|
|
1170
1183
|
return this.finishNode(node, "VariableDeclaration")
|
|
1171
1184
|
};
|
|
@@ -1294,7 +1307,7 @@
|
|
|
1294
1307
|
|
|
1295
1308
|
// Parse a list of variable declarations.
|
|
1296
1309
|
|
|
1297
|
-
pp$8.parseVar = function(node, isFor, kind) {
|
|
1310
|
+
pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
1298
1311
|
node.declarations = [];
|
|
1299
1312
|
node.kind = kind;
|
|
1300
1313
|
for (;;) {
|
|
@@ -1302,9 +1315,9 @@
|
|
|
1302
1315
|
this.parseVarId(decl, kind);
|
|
1303
1316
|
if (this.eat(types$1.eq)) {
|
|
1304
1317
|
decl.init = this.parseMaybeAssign(isFor);
|
|
1305
|
-
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
1318
|
+
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
1306
1319
|
this.unexpected();
|
|
1307
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
1320
|
+
} else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
1308
1321
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
1309
1322
|
} else {
|
|
1310
1323
|
decl.init = null;
|
|
@@ -1393,7 +1406,7 @@
|
|
|
1393
1406
|
if (element) {
|
|
1394
1407
|
classBody.body.push(element);
|
|
1395
1408
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
1396
|
-
if (hadConstructor) { this.
|
|
1409
|
+
if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
|
|
1397
1410
|
hadConstructor = true;
|
|
1398
1411
|
} else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
1399
1412
|
this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
|
|
@@ -1591,6 +1604,7 @@
|
|
|
1591
1604
|
var ref = this.privateNameStack.pop();
|
|
1592
1605
|
var declared = ref.declared;
|
|
1593
1606
|
var used = ref.used;
|
|
1607
|
+
if (!this.options.checkPrivateFields) { return }
|
|
1594
1608
|
var len = this.privateNameStack.length;
|
|
1595
1609
|
var parent = len === 0 ? null : this.privateNameStack[len - 1];
|
|
1596
1610
|
for (var i = 0; i < used.length; ++i) {
|
|
@@ -1642,44 +1656,36 @@
|
|
|
1642
1656
|
|
|
1643
1657
|
// Parses module export declaration.
|
|
1644
1658
|
|
|
1659
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
1660
|
+
if (this.options.ecmaVersion >= 11) {
|
|
1661
|
+
if (this.eatContextual("as")) {
|
|
1662
|
+
node.exported = this.parseModuleExportName();
|
|
1663
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
1664
|
+
} else {
|
|
1665
|
+
node.exported = null;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
this.expectContextual("from");
|
|
1669
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
1670
|
+
node.source = this.parseExprAtom();
|
|
1671
|
+
this.semicolon();
|
|
1672
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
|
1673
|
+
};
|
|
1674
|
+
|
|
1645
1675
|
pp$8.parseExport = function(node, exports) {
|
|
1646
1676
|
this.next();
|
|
1647
1677
|
// export * from '...'
|
|
1648
1678
|
if (this.eat(types$1.star)) {
|
|
1649
|
-
|
|
1650
|
-
if (this.eatContextual("as")) {
|
|
1651
|
-
node.exported = this.parseModuleExportName();
|
|
1652
|
-
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
1653
|
-
} else {
|
|
1654
|
-
node.exported = null;
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
this.expectContextual("from");
|
|
1658
|
-
if (this.type !== types$1.string) { this.unexpected(); }
|
|
1659
|
-
node.source = this.parseExprAtom();
|
|
1660
|
-
this.semicolon();
|
|
1661
|
-
return this.finishNode(node, "ExportAllDeclaration")
|
|
1679
|
+
return this.parseExportAllDeclaration(node, exports)
|
|
1662
1680
|
}
|
|
1663
1681
|
if (this.eat(types$1._default)) { // export default ...
|
|
1664
1682
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
1665
|
-
|
|
1666
|
-
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
1667
|
-
var fNode = this.startNode();
|
|
1668
|
-
this.next();
|
|
1669
|
-
if (isAsync) { this.next(); }
|
|
1670
|
-
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
1671
|
-
} else if (this.type === types$1._class) {
|
|
1672
|
-
var cNode = this.startNode();
|
|
1673
|
-
node.declaration = this.parseClass(cNode, "nullableID");
|
|
1674
|
-
} else {
|
|
1675
|
-
node.declaration = this.parseMaybeAssign();
|
|
1676
|
-
this.semicolon();
|
|
1677
|
-
}
|
|
1683
|
+
node.declaration = this.parseExportDefaultDeclaration();
|
|
1678
1684
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
1679
1685
|
}
|
|
1680
1686
|
// export var|const|let|function|class ...
|
|
1681
1687
|
if (this.shouldParseExportStatement()) {
|
|
1682
|
-
node.declaration = this.
|
|
1688
|
+
node.declaration = this.parseExportDeclaration(node);
|
|
1683
1689
|
if (node.declaration.type === "VariableDeclaration")
|
|
1684
1690
|
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
1685
1691
|
else
|
|
@@ -1713,6 +1719,27 @@
|
|
|
1713
1719
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
1714
1720
|
};
|
|
1715
1721
|
|
|
1722
|
+
pp$8.parseExportDeclaration = function(node) {
|
|
1723
|
+
return this.parseStatement(null)
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
pp$8.parseExportDefaultDeclaration = function() {
|
|
1727
|
+
var isAsync;
|
|
1728
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
1729
|
+
var fNode = this.startNode();
|
|
1730
|
+
this.next();
|
|
1731
|
+
if (isAsync) { this.next(); }
|
|
1732
|
+
return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync)
|
|
1733
|
+
} else if (this.type === types$1._class) {
|
|
1734
|
+
var cNode = this.startNode();
|
|
1735
|
+
return this.parseClass(cNode, "nullableID")
|
|
1736
|
+
} else {
|
|
1737
|
+
var declaration = this.parseMaybeAssign();
|
|
1738
|
+
this.semicolon();
|
|
1739
|
+
return declaration
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1716
1743
|
pp$8.checkExport = function(exports, name, pos) {
|
|
1717
1744
|
if (!exports) { return }
|
|
1718
1745
|
if (typeof name !== "string")
|
|
@@ -1770,6 +1797,20 @@
|
|
|
1770
1797
|
|
|
1771
1798
|
// Parses a comma-separated list of module exports.
|
|
1772
1799
|
|
|
1800
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
1801
|
+
var node = this.startNode();
|
|
1802
|
+
node.local = this.parseModuleExportName();
|
|
1803
|
+
|
|
1804
|
+
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
1805
|
+
this.checkExport(
|
|
1806
|
+
exports,
|
|
1807
|
+
node.exported,
|
|
1808
|
+
node.exported.start
|
|
1809
|
+
);
|
|
1810
|
+
|
|
1811
|
+
return this.finishNode(node, "ExportSpecifier")
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1773
1814
|
pp$8.parseExportSpecifiers = function(exports) {
|
|
1774
1815
|
var nodes = [], first = true;
|
|
1775
1816
|
// export { x, y as z } [from '...']
|
|
@@ -1780,15 +1821,7 @@
|
|
|
1780
1821
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
1781
1822
|
} else { first = false; }
|
|
1782
1823
|
|
|
1783
|
-
|
|
1784
|
-
node.local = this.parseModuleExportName();
|
|
1785
|
-
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
1786
|
-
this.checkExport(
|
|
1787
|
-
exports,
|
|
1788
|
-
node.exported,
|
|
1789
|
-
node.exported.start
|
|
1790
|
-
);
|
|
1791
|
-
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
|
1824
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
1792
1825
|
}
|
|
1793
1826
|
return nodes
|
|
1794
1827
|
};
|
|
@@ -1797,6 +1830,7 @@
|
|
|
1797
1830
|
|
|
1798
1831
|
pp$8.parseImport = function(node) {
|
|
1799
1832
|
this.next();
|
|
1833
|
+
|
|
1800
1834
|
// import '...'
|
|
1801
1835
|
if (this.type === types$1.string) {
|
|
1802
1836
|
node.specifiers = empty$1;
|
|
@@ -1812,23 +1846,46 @@
|
|
|
1812
1846
|
|
|
1813
1847
|
// Parses a comma-separated list of module imports.
|
|
1814
1848
|
|
|
1849
|
+
pp$8.parseImportSpecifier = function() {
|
|
1850
|
+
var node = this.startNode();
|
|
1851
|
+
node.imported = this.parseModuleExportName();
|
|
1852
|
+
|
|
1853
|
+
if (this.eatContextual("as")) {
|
|
1854
|
+
node.local = this.parseIdent();
|
|
1855
|
+
} else {
|
|
1856
|
+
this.checkUnreserved(node.imported);
|
|
1857
|
+
node.local = node.imported;
|
|
1858
|
+
}
|
|
1859
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
1860
|
+
|
|
1861
|
+
return this.finishNode(node, "ImportSpecifier")
|
|
1862
|
+
};
|
|
1863
|
+
|
|
1864
|
+
pp$8.parseImportDefaultSpecifier = function() {
|
|
1865
|
+
// import defaultObj, { x, y as z } from '...'
|
|
1866
|
+
var node = this.startNode();
|
|
1867
|
+
node.local = this.parseIdent();
|
|
1868
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
1869
|
+
return this.finishNode(node, "ImportDefaultSpecifier")
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1872
|
+
pp$8.parseImportNamespaceSpecifier = function() {
|
|
1873
|
+
var node = this.startNode();
|
|
1874
|
+
this.next();
|
|
1875
|
+
this.expectContextual("as");
|
|
1876
|
+
node.local = this.parseIdent();
|
|
1877
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
1878
|
+
return this.finishNode(node, "ImportNamespaceSpecifier")
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1815
1881
|
pp$8.parseImportSpecifiers = function() {
|
|
1816
1882
|
var nodes = [], first = true;
|
|
1817
1883
|
if (this.type === types$1.name) {
|
|
1818
|
-
|
|
1819
|
-
var node = this.startNode();
|
|
1820
|
-
node.local = this.parseIdent();
|
|
1821
|
-
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
1822
|
-
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
1884
|
+
nodes.push(this.parseImportDefaultSpecifier());
|
|
1823
1885
|
if (!this.eat(types$1.comma)) { return nodes }
|
|
1824
1886
|
}
|
|
1825
1887
|
if (this.type === types$1.star) {
|
|
1826
|
-
|
|
1827
|
-
this.next();
|
|
1828
|
-
this.expectContextual("as");
|
|
1829
|
-
node$1.local = this.parseIdent();
|
|
1830
|
-
this.checkLValSimple(node$1.local, BIND_LEXICAL);
|
|
1831
|
-
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
1888
|
+
nodes.push(this.parseImportNamespaceSpecifier());
|
|
1832
1889
|
return nodes
|
|
1833
1890
|
}
|
|
1834
1891
|
this.expect(types$1.braceL);
|
|
@@ -1838,16 +1895,7 @@
|
|
|
1838
1895
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
1839
1896
|
} else { first = false; }
|
|
1840
1897
|
|
|
1841
|
-
|
|
1842
|
-
node$2.imported = this.parseModuleExportName();
|
|
1843
|
-
if (this.eatContextual("as")) {
|
|
1844
|
-
node$2.local = this.parseIdent();
|
|
1845
|
-
} else {
|
|
1846
|
-
this.checkUnreserved(node$2.imported);
|
|
1847
|
-
node$2.local = node$2.imported;
|
|
1848
|
-
}
|
|
1849
|
-
this.checkLValSimple(node$2.local, BIND_LEXICAL);
|
|
1850
|
-
nodes.push(this.finishNode(node$2, "ImportSpecifier"));
|
|
1898
|
+
nodes.push(this.parseImportSpecifier());
|
|
1851
1899
|
}
|
|
1852
1900
|
return nodes
|
|
1853
1901
|
};
|
|
@@ -2020,7 +2068,7 @@
|
|
|
2020
2068
|
return this.parseIdent()
|
|
2021
2069
|
};
|
|
2022
2070
|
|
|
2023
|
-
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
2071
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
|
|
2024
2072
|
var elts = [], first = true;
|
|
2025
2073
|
while (!this.eat(close)) {
|
|
2026
2074
|
if (first) { first = false; }
|
|
@@ -2033,18 +2081,22 @@
|
|
|
2033
2081
|
var rest = this.parseRestBinding();
|
|
2034
2082
|
this.parseBindingListItem(rest);
|
|
2035
2083
|
elts.push(rest);
|
|
2036
|
-
if (this.type === types$1.comma) { this.
|
|
2084
|
+
if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
|
|
2037
2085
|
this.expect(close);
|
|
2038
2086
|
break
|
|
2039
2087
|
} else {
|
|
2040
|
-
|
|
2041
|
-
this.parseBindingListItem(elem);
|
|
2042
|
-
elts.push(elem);
|
|
2088
|
+
elts.push(this.parseAssignableListItem(allowModifiers));
|
|
2043
2089
|
}
|
|
2044
2090
|
}
|
|
2045
2091
|
return elts
|
|
2046
2092
|
};
|
|
2047
2093
|
|
|
2094
|
+
pp$7.parseAssignableListItem = function(allowModifiers) {
|
|
2095
|
+
var elem = this.parseMaybeDefault(this.start, this.startLoc);
|
|
2096
|
+
this.parseBindingListItem(elem);
|
|
2097
|
+
return elem
|
|
2098
|
+
};
|
|
2099
|
+
|
|
2048
2100
|
pp$7.parseBindingListItem = function(param) {
|
|
2049
2101
|
return param
|
|
2050
2102
|
};
|
|
@@ -2210,6 +2262,9 @@
|
|
|
2210
2262
|
};
|
|
2211
2263
|
|
|
2212
2264
|
// The algorithm used to determine whether a regexp can appear at a
|
|
2265
|
+
// given point in the program is loosely based on sweet.js' approach.
|
|
2266
|
+
// See https://github.com/mozilla/sweet.js/wiki/design
|
|
2267
|
+
|
|
2213
2268
|
|
|
2214
2269
|
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
2215
2270
|
this.token = token;
|
|
@@ -2365,6 +2420,23 @@
|
|
|
2365
2420
|
};
|
|
2366
2421
|
|
|
2367
2422
|
// A recursive descent parser operates by defining functions for all
|
|
2423
|
+
// syntactic elements, and recursively calling those, each function
|
|
2424
|
+
// advancing the input stream and returning an AST node. Precedence
|
|
2425
|
+
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
|
|
2426
|
+
// instead of `(!x)[1]` is handled by the fact that the parser
|
|
2427
|
+
// function that parses unary prefix operators is called first, and
|
|
2428
|
+
// in turn calls the function that parses `[]` subscripts — that
|
|
2429
|
+
// way, it'll receive the node for `x[1]` already parsed, and wraps
|
|
2430
|
+
// *that* in the unary operator node.
|
|
2431
|
+
//
|
|
2432
|
+
// Acorn uses an [operator precedence parser][opp] to handle binary
|
|
2433
|
+
// operator precedence, because it is much more compact than using
|
|
2434
|
+
// the technique outlined above, which uses different, nesting
|
|
2435
|
+
// functions to specify precedence, for all of the ten binary
|
|
2436
|
+
// precedence levels that JavaScript defines.
|
|
2437
|
+
//
|
|
2438
|
+
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
|
|
2439
|
+
|
|
2368
2440
|
|
|
2369
2441
|
var pp$5 = Parser.prototype;
|
|
2370
2442
|
|
|
@@ -2594,7 +2666,7 @@
|
|
|
2594
2666
|
else { sawUnary = true; }
|
|
2595
2667
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
2596
2668
|
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
2597
|
-
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
2669
|
+
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }
|
|
2598
2670
|
expr = this.parsePrivateIdent();
|
|
2599
2671
|
// only could be private fields in 'in', such as #x in obj
|
|
2600
2672
|
if (this.type !== types$1._in) { this.unexpected(); }
|
|
@@ -2668,6 +2740,14 @@
|
|
|
2668
2740
|
}
|
|
2669
2741
|
};
|
|
2670
2742
|
|
|
2743
|
+
pp$5.shouldParseAsyncArrow = function() {
|
|
2744
|
+
return !this.canInsertSemicolon() && this.eat(types$1.arrow)
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2747
|
+
pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
|
|
2748
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
|
|
2749
|
+
};
|
|
2750
|
+
|
|
2671
2751
|
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
2672
2752
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
2673
2753
|
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
@@ -2696,7 +2776,7 @@
|
|
|
2696
2776
|
this.awaitPos = 0;
|
|
2697
2777
|
this.awaitIdentPos = 0;
|
|
2698
2778
|
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
2699
|
-
if (maybeAsyncArrow && !optional &&
|
|
2779
|
+
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
|
|
2700
2780
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
2701
2781
|
this.checkYieldAwaitInDefaultParams();
|
|
2702
2782
|
if (this.awaitIdentPos > 0)
|
|
@@ -2704,7 +2784,7 @@
|
|
|
2704
2784
|
this.yieldPos = oldYieldPos;
|
|
2705
2785
|
this.awaitPos = oldAwaitPos;
|
|
2706
2786
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
2707
|
-
return this.
|
|
2787
|
+
return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
|
|
2708
2788
|
}
|
|
2709
2789
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
2710
2790
|
this.yieldPos = oldYieldPos || this.yieldPos;
|
|
@@ -2734,7 +2814,7 @@
|
|
|
2734
2814
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
2735
2815
|
// or `{}`.
|
|
2736
2816
|
|
|
2737
|
-
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
2817
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
2738
2818
|
// If a division operator appears in an expression position, the
|
|
2739
2819
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
2740
2820
|
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
@@ -2835,17 +2915,21 @@
|
|
|
2835
2915
|
|
|
2836
2916
|
case types$1._import:
|
|
2837
2917
|
if (this.options.ecmaVersion >= 11) {
|
|
2838
|
-
return this.parseExprImport()
|
|
2918
|
+
return this.parseExprImport(forNew)
|
|
2839
2919
|
} else {
|
|
2840
2920
|
return this.unexpected()
|
|
2841
2921
|
}
|
|
2842
2922
|
|
|
2843
2923
|
default:
|
|
2844
|
-
this.
|
|
2924
|
+
return this.parseExprAtomDefault()
|
|
2845
2925
|
}
|
|
2846
2926
|
};
|
|
2847
2927
|
|
|
2848
|
-
pp$5.
|
|
2928
|
+
pp$5.parseExprAtomDefault = function() {
|
|
2929
|
+
this.unexpected();
|
|
2930
|
+
};
|
|
2931
|
+
|
|
2932
|
+
pp$5.parseExprImport = function(forNew) {
|
|
2849
2933
|
var node = this.startNode();
|
|
2850
2934
|
|
|
2851
2935
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -2853,13 +2937,12 @@
|
|
|
2853
2937
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
|
|
2854
2938
|
var meta = this.parseIdent(true);
|
|
2855
2939
|
|
|
2856
|
-
|
|
2857
|
-
case types$1.parenL:
|
|
2940
|
+
if (this.type === types$1.parenL && !forNew) {
|
|
2858
2941
|
return this.parseDynamicImport(node)
|
|
2859
|
-
|
|
2942
|
+
} else if (this.type === types$1.dot) {
|
|
2860
2943
|
node.meta = meta;
|
|
2861
2944
|
return this.parseImportMeta(node)
|
|
2862
|
-
|
|
2945
|
+
} else {
|
|
2863
2946
|
this.unexpected();
|
|
2864
2947
|
}
|
|
2865
2948
|
};
|
|
@@ -2915,6 +2998,10 @@
|
|
|
2915
2998
|
return val
|
|
2916
2999
|
};
|
|
2917
3000
|
|
|
3001
|
+
pp$5.shouldParseArrow = function(exprList) {
|
|
3002
|
+
return !this.canInsertSemicolon()
|
|
3003
|
+
};
|
|
3004
|
+
|
|
2918
3005
|
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
2919
3006
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
2920
3007
|
if (this.options.ecmaVersion >= 6) {
|
|
@@ -2934,7 +3021,12 @@
|
|
|
2934
3021
|
} else if (this.type === types$1.ellipsis) {
|
|
2935
3022
|
spreadStart = this.start;
|
|
2936
3023
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
2937
|
-
if (this.type === types$1.comma) {
|
|
3024
|
+
if (this.type === types$1.comma) {
|
|
3025
|
+
this.raiseRecoverable(
|
|
3026
|
+
this.start,
|
|
3027
|
+
"Comma is not permitted after the rest element"
|
|
3028
|
+
);
|
|
3029
|
+
}
|
|
2938
3030
|
break
|
|
2939
3031
|
} else {
|
|
2940
3032
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
@@ -2943,7 +3035,7 @@
|
|
|
2943
3035
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
2944
3036
|
this.expect(types$1.parenR);
|
|
2945
3037
|
|
|
2946
|
-
if (canBeArrow &&
|
|
3038
|
+
if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
|
|
2947
3039
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
2948
3040
|
this.checkYieldAwaitInDefaultParams();
|
|
2949
3041
|
this.yieldPos = oldYieldPos;
|
|
@@ -3009,11 +3101,8 @@
|
|
|
3009
3101
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
3010
3102
|
return this.finishNode(node, "MetaProperty")
|
|
3011
3103
|
}
|
|
3012
|
-
var startPos = this.start, startLoc = this.startLoc
|
|
3013
|
-
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
3014
|
-
if (isImport && node.callee.type === "ImportExpression") {
|
|
3015
|
-
this.raise(startPos, "Cannot use new with import()");
|
|
3016
|
-
}
|
|
3104
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
3105
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
3017
3106
|
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
3018
3107
|
else { node.arguments = empty; }
|
|
3019
3108
|
return this.finishNode(node, "NewExpression")
|
|
@@ -3095,7 +3184,7 @@
|
|
|
3095
3184
|
if (isPattern) {
|
|
3096
3185
|
prop.argument = this.parseIdent(false);
|
|
3097
3186
|
if (this.type === types$1.comma) {
|
|
3098
|
-
this.
|
|
3187
|
+
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
|
|
3099
3188
|
}
|
|
3100
3189
|
return this.finishNode(prop, "RestElement")
|
|
3101
3190
|
}
|
|
@@ -3131,6 +3220,23 @@
|
|
|
3131
3220
|
return this.finishNode(prop, "Property")
|
|
3132
3221
|
};
|
|
3133
3222
|
|
|
3223
|
+
pp$5.parseGetterSetter = function(prop) {
|
|
3224
|
+
prop.kind = prop.key.name;
|
|
3225
|
+
this.parsePropertyName(prop);
|
|
3226
|
+
prop.value = this.parseMethod(false);
|
|
3227
|
+
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
3228
|
+
if (prop.value.params.length !== paramCount) {
|
|
3229
|
+
var start = prop.value.start;
|
|
3230
|
+
if (prop.kind === "get")
|
|
3231
|
+
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
3232
|
+
else
|
|
3233
|
+
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
3234
|
+
} else {
|
|
3235
|
+
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
3236
|
+
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
3237
|
+
}
|
|
3238
|
+
};
|
|
3239
|
+
|
|
3134
3240
|
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
3135
3241
|
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
3136
3242
|
{ this.unexpected(); }
|
|
@@ -3148,20 +3254,7 @@
|
|
|
3148
3254
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
3149
3255
|
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
3150
3256
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
3151
|
-
|
|
3152
|
-
this.parsePropertyName(prop);
|
|
3153
|
-
prop.value = this.parseMethod(false);
|
|
3154
|
-
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
3155
|
-
if (prop.value.params.length !== paramCount) {
|
|
3156
|
-
var start = prop.value.start;
|
|
3157
|
-
if (prop.kind === "get")
|
|
3158
|
-
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
3159
|
-
else
|
|
3160
|
-
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
3161
|
-
} else {
|
|
3162
|
-
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
3163
|
-
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
3164
|
-
}
|
|
3257
|
+
this.parseGetterSetter(prop);
|
|
3165
3258
|
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
|
|
3166
3259
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
3167
3260
|
this.checkUnreserved(prop.key);
|
|
@@ -3373,6 +3466,18 @@
|
|
|
3373
3466
|
// identifiers.
|
|
3374
3467
|
|
|
3375
3468
|
pp$5.parseIdent = function(liberal) {
|
|
3469
|
+
var node = this.parseIdentNode();
|
|
3470
|
+
this.next(!!liberal);
|
|
3471
|
+
this.finishNode(node, "Identifier");
|
|
3472
|
+
if (!liberal) {
|
|
3473
|
+
this.checkUnreserved(node);
|
|
3474
|
+
if (node.name === "await" && !this.awaitIdentPos)
|
|
3475
|
+
{ this.awaitIdentPos = node.start; }
|
|
3476
|
+
}
|
|
3477
|
+
return node
|
|
3478
|
+
};
|
|
3479
|
+
|
|
3480
|
+
pp$5.parseIdentNode = function() {
|
|
3376
3481
|
var node = this.startNode();
|
|
3377
3482
|
if (this.type === types$1.name) {
|
|
3378
3483
|
node.name = this.value;
|
|
@@ -3384,19 +3489,12 @@
|
|
|
3384
3489
|
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
|
3385
3490
|
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
|
3386
3491
|
if ((node.name === "class" || node.name === "function") &&
|
|
3387
|
-
|
|
3492
|
+
(this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
3388
3493
|
this.context.pop();
|
|
3389
3494
|
}
|
|
3390
3495
|
} else {
|
|
3391
3496
|
this.unexpected();
|
|
3392
3497
|
}
|
|
3393
|
-
this.next(!!liberal);
|
|
3394
|
-
this.finishNode(node, "Identifier");
|
|
3395
|
-
if (!liberal) {
|
|
3396
|
-
this.checkUnreserved(node);
|
|
3397
|
-
if (node.name === "await" && !this.awaitIdentPos)
|
|
3398
|
-
{ this.awaitIdentPos = node.start; }
|
|
3399
|
-
}
|
|
3400
3498
|
return node
|
|
3401
3499
|
};
|
|
3402
3500
|
|
|
@@ -3411,10 +3509,12 @@
|
|
|
3411
3509
|
this.finishNode(node, "PrivateIdentifier");
|
|
3412
3510
|
|
|
3413
3511
|
// For validating existence
|
|
3414
|
-
if (this.
|
|
3415
|
-
this.
|
|
3416
|
-
|
|
3417
|
-
|
|
3512
|
+
if (this.options.checkPrivateFields) {
|
|
3513
|
+
if (this.privateNameStack.length === 0) {
|
|
3514
|
+
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
|
|
3515
|
+
} else {
|
|
3516
|
+
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
|
|
3517
|
+
}
|
|
3418
3518
|
}
|
|
3419
3519
|
|
|
3420
3520
|
return node
|
|
@@ -3636,6 +3736,18 @@
|
|
|
3636
3736
|
14: ecma14BinaryProperties
|
|
3637
3737
|
};
|
|
3638
3738
|
|
|
3739
|
+
// #table-binary-unicode-properties-of-strings
|
|
3740
|
+
var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
|
|
3741
|
+
|
|
3742
|
+
var unicodeBinaryPropertiesOfStrings = {
|
|
3743
|
+
9: "",
|
|
3744
|
+
10: "",
|
|
3745
|
+
11: "",
|
|
3746
|
+
12: "",
|
|
3747
|
+
13: "",
|
|
3748
|
+
14: ecma14BinaryPropertiesOfStrings
|
|
3749
|
+
};
|
|
3750
|
+
|
|
3639
3751
|
// #table-unicode-general-category-values
|
|
3640
3752
|
var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
|
|
3641
3753
|
|
|
@@ -3645,7 +3757,7 @@
|
|
|
3645
3757
|
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
|
|
3646
3758
|
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
|
|
3647
3759
|
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
|
|
3648
|
-
var ecma14ScriptValues = ecma13ScriptValues + " Kawi Nag_Mundari Nagm";
|
|
3760
|
+
var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
|
|
3649
3761
|
|
|
3650
3762
|
var unicodeScriptValues = {
|
|
3651
3763
|
9: ecma9ScriptValues,
|
|
@@ -3660,6 +3772,7 @@
|
|
|
3660
3772
|
function buildUnicodeData(ecmaVersion) {
|
|
3661
3773
|
var d = data[ecmaVersion] = {
|
|
3662
3774
|
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
|
|
3775
|
+
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
|
|
3663
3776
|
nonBinary: {
|
|
3664
3777
|
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
|
|
3665
3778
|
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
|
|
@@ -3682,12 +3795,13 @@
|
|
|
3682
3795
|
|
|
3683
3796
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
3684
3797
|
this.parser = parser;
|
|
3685
|
-
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
|
|
3798
|
+
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
3686
3799
|
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
3687
3800
|
this.source = "";
|
|
3688
3801
|
this.flags = "";
|
|
3689
3802
|
this.start = 0;
|
|
3690
3803
|
this.switchU = false;
|
|
3804
|
+
this.switchV = false;
|
|
3691
3805
|
this.switchN = false;
|
|
3692
3806
|
this.pos = 0;
|
|
3693
3807
|
this.lastIntValue = 0;
|
|
@@ -3700,12 +3814,20 @@
|
|
|
3700
3814
|
};
|
|
3701
3815
|
|
|
3702
3816
|
RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
|
|
3817
|
+
var unicodeSets = flags.indexOf("v") !== -1;
|
|
3703
3818
|
var unicode = flags.indexOf("u") !== -1;
|
|
3704
3819
|
this.start = start | 0;
|
|
3705
3820
|
this.source = pattern + "";
|
|
3706
3821
|
this.flags = flags;
|
|
3707
|
-
|
|
3708
|
-
|
|
3822
|
+
if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
|
|
3823
|
+
this.switchU = true;
|
|
3824
|
+
this.switchV = true;
|
|
3825
|
+
this.switchN = true;
|
|
3826
|
+
} else {
|
|
3827
|
+
this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
|
|
3828
|
+
this.switchV = false;
|
|
3829
|
+
this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
|
|
3830
|
+
}
|
|
3709
3831
|
};
|
|
3710
3832
|
|
|
3711
3833
|
RegExpValidationState.prototype.raise = function raise (message) {
|
|
@@ -3774,6 +3896,23 @@
|
|
|
3774
3896
|
return false
|
|
3775
3897
|
};
|
|
3776
3898
|
|
|
3899
|
+
RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
|
|
3900
|
+
if ( forceU === void 0 ) forceU = false;
|
|
3901
|
+
|
|
3902
|
+
var pos = this.pos;
|
|
3903
|
+
for (var i = 0, list = chs; i < list.length; i += 1) {
|
|
3904
|
+
var ch = list[i];
|
|
3905
|
+
|
|
3906
|
+
var current = this.at(pos, forceU);
|
|
3907
|
+
if (current === -1 || current !== ch) {
|
|
3908
|
+
return false
|
|
3909
|
+
}
|
|
3910
|
+
pos = this.nextIndex(pos, forceU);
|
|
3911
|
+
}
|
|
3912
|
+
this.pos = pos;
|
|
3913
|
+
return true
|
|
3914
|
+
};
|
|
3915
|
+
|
|
3777
3916
|
/**
|
|
3778
3917
|
* Validate the flags part of a given RegExpLiteral.
|
|
3779
3918
|
*
|
|
@@ -3784,6 +3923,9 @@
|
|
|
3784
3923
|
var validFlags = state.validFlags;
|
|
3785
3924
|
var flags = state.flags;
|
|
3786
3925
|
|
|
3926
|
+
var u = false;
|
|
3927
|
+
var v = false;
|
|
3928
|
+
|
|
3787
3929
|
for (var i = 0; i < flags.length; i++) {
|
|
3788
3930
|
var flag = flags.charAt(i);
|
|
3789
3931
|
if (validFlags.indexOf(flag) === -1) {
|
|
@@ -3792,6 +3934,11 @@
|
|
|
3792
3934
|
if (flags.indexOf(flag, i + 1) > -1) {
|
|
3793
3935
|
this.raise(state.start, "Duplicate regular expression flag");
|
|
3794
3936
|
}
|
|
3937
|
+
if (flag === "u") { u = true; }
|
|
3938
|
+
if (flag === "v") { v = true; }
|
|
3939
|
+
}
|
|
3940
|
+
if (this.options.ecmaVersion >= 15 && u && v) {
|
|
3941
|
+
this.raise(state.start, "Invalid regular expression flag");
|
|
3795
3942
|
}
|
|
3796
3943
|
};
|
|
3797
3944
|
|
|
@@ -4410,6 +4557,12 @@
|
|
|
4410
4557
|
return false
|
|
4411
4558
|
};
|
|
4412
4559
|
|
|
4560
|
+
// Return values used by character set parsing methods, needed to
|
|
4561
|
+
// forbid negation of sets that can match strings.
|
|
4562
|
+
var CharSetNone = 0; // Nothing parsed
|
|
4563
|
+
var CharSetOk = 1; // Construct parsed, cannot contain strings
|
|
4564
|
+
var CharSetString = 2; // Construct parsed, can contain strings
|
|
4565
|
+
|
|
4413
4566
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
4414
4567
|
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
4415
4568
|
var ch = state.current();
|
|
@@ -4417,28 +4570,32 @@
|
|
|
4417
4570
|
if (isCharacterClassEscape(ch)) {
|
|
4418
4571
|
state.lastIntValue = -1;
|
|
4419
4572
|
state.advance();
|
|
4420
|
-
return
|
|
4573
|
+
return CharSetOk
|
|
4421
4574
|
}
|
|
4422
4575
|
|
|
4576
|
+
var negate = false;
|
|
4423
4577
|
if (
|
|
4424
4578
|
state.switchU &&
|
|
4425
4579
|
this.options.ecmaVersion >= 9 &&
|
|
4426
|
-
(ch === 0x50 /* P */ || ch === 0x70 /* p */)
|
|
4580
|
+
((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
|
|
4427
4581
|
) {
|
|
4428
4582
|
state.lastIntValue = -1;
|
|
4429
4583
|
state.advance();
|
|
4584
|
+
var result;
|
|
4430
4585
|
if (
|
|
4431
4586
|
state.eat(0x7B /* { */) &&
|
|
4432
|
-
this.regexp_eatUnicodePropertyValueExpression(state) &&
|
|
4587
|
+
(result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
|
|
4433
4588
|
state.eat(0x7D /* } */)
|
|
4434
4589
|
) {
|
|
4435
|
-
|
|
4590
|
+
if (negate && result === CharSetString) { state.raise("Invalid property name"); }
|
|
4591
|
+
return result
|
|
4436
4592
|
}
|
|
4437
4593
|
state.raise("Invalid property name");
|
|
4438
4594
|
}
|
|
4439
4595
|
|
|
4440
|
-
return
|
|
4596
|
+
return CharSetNone
|
|
4441
4597
|
};
|
|
4598
|
+
|
|
4442
4599
|
function isCharacterClassEscape(ch) {
|
|
4443
4600
|
return (
|
|
4444
4601
|
ch === 0x64 /* d */ ||
|
|
@@ -4462,7 +4619,7 @@
|
|
|
4462
4619
|
if (this.regexp_eatUnicodePropertyValue(state)) {
|
|
4463
4620
|
var value = state.lastStringValue;
|
|
4464
4621
|
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
|
|
4465
|
-
return
|
|
4622
|
+
return CharSetOk
|
|
4466
4623
|
}
|
|
4467
4624
|
}
|
|
4468
4625
|
state.pos = start;
|
|
@@ -4470,20 +4627,22 @@
|
|
|
4470
4627
|
// LoneUnicodePropertyNameOrValue
|
|
4471
4628
|
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
|
|
4472
4629
|
var nameOrValue = state.lastStringValue;
|
|
4473
|
-
this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
4474
|
-
return true
|
|
4630
|
+
return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
4475
4631
|
}
|
|
4476
|
-
return
|
|
4632
|
+
return CharSetNone
|
|
4477
4633
|
};
|
|
4634
|
+
|
|
4478
4635
|
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
4479
4636
|
if (!hasOwn(state.unicodeProperties.nonBinary, name))
|
|
4480
4637
|
{ state.raise("Invalid property name"); }
|
|
4481
4638
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
4482
4639
|
{ state.raise("Invalid property value"); }
|
|
4483
4640
|
};
|
|
4641
|
+
|
|
4484
4642
|
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
4485
|
-
if (
|
|
4486
|
-
|
|
4643
|
+
if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }
|
|
4644
|
+
if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }
|
|
4645
|
+
state.raise("Invalid property name");
|
|
4487
4646
|
};
|
|
4488
4647
|
|
|
4489
4648
|
// UnicodePropertyName ::
|
|
@@ -4497,6 +4656,7 @@
|
|
|
4497
4656
|
}
|
|
4498
4657
|
return state.lastStringValue !== ""
|
|
4499
4658
|
};
|
|
4659
|
+
|
|
4500
4660
|
function isUnicodePropertyNameCharacter(ch) {
|
|
4501
4661
|
return isControlLetter(ch) || ch === 0x5F /* _ */
|
|
4502
4662
|
}
|
|
@@ -4525,21 +4685,29 @@
|
|
|
4525
4685
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
4526
4686
|
pp$1.regexp_eatCharacterClass = function(state) {
|
|
4527
4687
|
if (state.eat(0x5B /* [ */)) {
|
|
4528
|
-
state.eat(0x5E /* ^ */);
|
|
4529
|
-
this.
|
|
4530
|
-
if (state.eat(0x5D /* ] */))
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4688
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
4689
|
+
var result = this.regexp_classContents(state);
|
|
4690
|
+
if (!state.eat(0x5D /* ] */))
|
|
4691
|
+
{ state.raise("Unterminated character class"); }
|
|
4692
|
+
if (negate && result === CharSetString)
|
|
4693
|
+
{ state.raise("Negated character class may contain strings"); }
|
|
4694
|
+
return true
|
|
4535
4695
|
}
|
|
4536
4696
|
return false
|
|
4537
4697
|
};
|
|
4538
4698
|
|
|
4699
|
+
// https://tc39.es/ecma262/#prod-ClassContents
|
|
4539
4700
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
4701
|
+
pp$1.regexp_classContents = function(state) {
|
|
4702
|
+
if (state.current() === 0x5D /* ] */) { return CharSetOk }
|
|
4703
|
+
if (state.switchV) { return this.regexp_classSetExpression(state) }
|
|
4704
|
+
this.regexp_nonEmptyClassRanges(state);
|
|
4705
|
+
return CharSetOk
|
|
4706
|
+
};
|
|
4707
|
+
|
|
4540
4708
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
4541
4709
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
4542
|
-
pp$1.
|
|
4710
|
+
pp$1.regexp_nonEmptyClassRanges = function(state) {
|
|
4543
4711
|
while (this.regexp_eatClassAtom(state)) {
|
|
4544
4712
|
var left = state.lastIntValue;
|
|
4545
4713
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -4611,6 +4779,205 @@
|
|
|
4611
4779
|
)
|
|
4612
4780
|
};
|
|
4613
4781
|
|
|
4782
|
+
// https://tc39.es/ecma262/#prod-ClassSetExpression
|
|
4783
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
4784
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
4785
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
4786
|
+
pp$1.regexp_classSetExpression = function(state) {
|
|
4787
|
+
var result = CharSetOk, subResult;
|
|
4788
|
+
if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
|
|
4789
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
4790
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
4791
|
+
var start = state.pos;
|
|
4792
|
+
while (state.eatChars([0x26, 0x26] /* && */)) {
|
|
4793
|
+
if (
|
|
4794
|
+
state.current() !== 0x26 /* & */ &&
|
|
4795
|
+
(subResult = this.regexp_eatClassSetOperand(state))
|
|
4796
|
+
) {
|
|
4797
|
+
if (subResult !== CharSetString) { result = CharSetOk; }
|
|
4798
|
+
continue
|
|
4799
|
+
}
|
|
4800
|
+
state.raise("Invalid character in character class");
|
|
4801
|
+
}
|
|
4802
|
+
if (start !== state.pos) { return result }
|
|
4803
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
4804
|
+
while (state.eatChars([0x2D, 0x2D] /* -- */)) {
|
|
4805
|
+
if (this.regexp_eatClassSetOperand(state)) { continue }
|
|
4806
|
+
state.raise("Invalid character in character class");
|
|
4807
|
+
}
|
|
4808
|
+
if (start !== state.pos) { return result }
|
|
4809
|
+
} else {
|
|
4810
|
+
state.raise("Invalid character in character class");
|
|
4811
|
+
}
|
|
4812
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
4813
|
+
for (;;) {
|
|
4814
|
+
if (this.regexp_eatClassSetRange(state)) { continue }
|
|
4815
|
+
subResult = this.regexp_eatClassSetOperand(state);
|
|
4816
|
+
if (!subResult) { return result }
|
|
4817
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
4818
|
+
}
|
|
4819
|
+
};
|
|
4820
|
+
|
|
4821
|
+
// https://tc39.es/ecma262/#prod-ClassSetRange
|
|
4822
|
+
pp$1.regexp_eatClassSetRange = function(state) {
|
|
4823
|
+
var start = state.pos;
|
|
4824
|
+
if (this.regexp_eatClassSetCharacter(state)) {
|
|
4825
|
+
var left = state.lastIntValue;
|
|
4826
|
+
if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
|
|
4827
|
+
var right = state.lastIntValue;
|
|
4828
|
+
if (left !== -1 && right !== -1 && left > right) {
|
|
4829
|
+
state.raise("Range out of order in character class");
|
|
4830
|
+
}
|
|
4831
|
+
return true
|
|
4832
|
+
}
|
|
4833
|
+
state.pos = start;
|
|
4834
|
+
}
|
|
4835
|
+
return false
|
|
4836
|
+
};
|
|
4837
|
+
|
|
4838
|
+
// https://tc39.es/ecma262/#prod-ClassSetOperand
|
|
4839
|
+
pp$1.regexp_eatClassSetOperand = function(state) {
|
|
4840
|
+
if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }
|
|
4841
|
+
return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)
|
|
4842
|
+
};
|
|
4843
|
+
|
|
4844
|
+
// https://tc39.es/ecma262/#prod-NestedClass
|
|
4845
|
+
pp$1.regexp_eatNestedClass = function(state) {
|
|
4846
|
+
var start = state.pos;
|
|
4847
|
+
if (state.eat(0x5B /* [ */)) {
|
|
4848
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
4849
|
+
var result = this.regexp_classContents(state);
|
|
4850
|
+
if (state.eat(0x5D /* ] */)) {
|
|
4851
|
+
if (negate && result === CharSetString) {
|
|
4852
|
+
state.raise("Negated character class may contain strings");
|
|
4853
|
+
}
|
|
4854
|
+
return result
|
|
4855
|
+
}
|
|
4856
|
+
state.pos = start;
|
|
4857
|
+
}
|
|
4858
|
+
if (state.eat(0x5C /* \ */)) {
|
|
4859
|
+
var result$1 = this.regexp_eatCharacterClassEscape(state);
|
|
4860
|
+
if (result$1) {
|
|
4861
|
+
return result$1
|
|
4862
|
+
}
|
|
4863
|
+
state.pos = start;
|
|
4864
|
+
}
|
|
4865
|
+
return null
|
|
4866
|
+
};
|
|
4867
|
+
|
|
4868
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunction
|
|
4869
|
+
pp$1.regexp_eatClassStringDisjunction = function(state) {
|
|
4870
|
+
var start = state.pos;
|
|
4871
|
+
if (state.eatChars([0x5C, 0x71] /* \q */)) {
|
|
4872
|
+
if (state.eat(0x7B /* { */)) {
|
|
4873
|
+
var result = this.regexp_classStringDisjunctionContents(state);
|
|
4874
|
+
if (state.eat(0x7D /* } */)) {
|
|
4875
|
+
return result
|
|
4876
|
+
}
|
|
4877
|
+
} else {
|
|
4878
|
+
// Make the same message as V8.
|
|
4879
|
+
state.raise("Invalid escape");
|
|
4880
|
+
}
|
|
4881
|
+
state.pos = start;
|
|
4882
|
+
}
|
|
4883
|
+
return null
|
|
4884
|
+
};
|
|
4885
|
+
|
|
4886
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
|
|
4887
|
+
pp$1.regexp_classStringDisjunctionContents = function(state) {
|
|
4888
|
+
var result = this.regexp_classString(state);
|
|
4889
|
+
while (state.eat(0x7C /* | */)) {
|
|
4890
|
+
if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }
|
|
4891
|
+
}
|
|
4892
|
+
return result
|
|
4893
|
+
};
|
|
4894
|
+
|
|
4895
|
+
// https://tc39.es/ecma262/#prod-ClassString
|
|
4896
|
+
// https://tc39.es/ecma262/#prod-NonEmptyClassString
|
|
4897
|
+
pp$1.regexp_classString = function(state) {
|
|
4898
|
+
var count = 0;
|
|
4899
|
+
while (this.regexp_eatClassSetCharacter(state)) { count++; }
|
|
4900
|
+
return count === 1 ? CharSetOk : CharSetString
|
|
4901
|
+
};
|
|
4902
|
+
|
|
4903
|
+
// https://tc39.es/ecma262/#prod-ClassSetCharacter
|
|
4904
|
+
pp$1.regexp_eatClassSetCharacter = function(state) {
|
|
4905
|
+
var start = state.pos;
|
|
4906
|
+
if (state.eat(0x5C /* \ */)) {
|
|
4907
|
+
if (
|
|
4908
|
+
this.regexp_eatCharacterEscape(state) ||
|
|
4909
|
+
this.regexp_eatClassSetReservedPunctuator(state)
|
|
4910
|
+
) {
|
|
4911
|
+
return true
|
|
4912
|
+
}
|
|
4913
|
+
if (state.eat(0x62 /* b */)) {
|
|
4914
|
+
state.lastIntValue = 0x08; /* <BS> */
|
|
4915
|
+
return true
|
|
4916
|
+
}
|
|
4917
|
+
state.pos = start;
|
|
4918
|
+
return false
|
|
4919
|
+
}
|
|
4920
|
+
var ch = state.current();
|
|
4921
|
+
if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }
|
|
4922
|
+
if (isClassSetSyntaxCharacter(ch)) { return false }
|
|
4923
|
+
state.advance();
|
|
4924
|
+
state.lastIntValue = ch;
|
|
4925
|
+
return true
|
|
4926
|
+
};
|
|
4927
|
+
|
|
4928
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
|
|
4929
|
+
function isClassSetReservedDoublePunctuatorCharacter(ch) {
|
|
4930
|
+
return (
|
|
4931
|
+
ch === 0x21 /* ! */ ||
|
|
4932
|
+
ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||
|
|
4933
|
+
ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||
|
|
4934
|
+
ch === 0x2E /* . */ ||
|
|
4935
|
+
ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||
|
|
4936
|
+
ch === 0x5E /* ^ */ ||
|
|
4937
|
+
ch === 0x60 /* ` */ ||
|
|
4938
|
+
ch === 0x7E /* ~ */
|
|
4939
|
+
)
|
|
4940
|
+
}
|
|
4941
|
+
|
|
4942
|
+
// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
|
|
4943
|
+
function isClassSetSyntaxCharacter(ch) {
|
|
4944
|
+
return (
|
|
4945
|
+
ch === 0x28 /* ( */ ||
|
|
4946
|
+
ch === 0x29 /* ) */ ||
|
|
4947
|
+
ch === 0x2D /* - */ ||
|
|
4948
|
+
ch === 0x2F /* / */ ||
|
|
4949
|
+
ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||
|
|
4950
|
+
ch >= 0x7B /* { */ && ch <= 0x7D /* } */
|
|
4951
|
+
)
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
4955
|
+
pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
|
|
4956
|
+
var ch = state.current();
|
|
4957
|
+
if (isClassSetReservedPunctuator(ch)) {
|
|
4958
|
+
state.lastIntValue = ch;
|
|
4959
|
+
state.advance();
|
|
4960
|
+
return true
|
|
4961
|
+
}
|
|
4962
|
+
return false
|
|
4963
|
+
};
|
|
4964
|
+
|
|
4965
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
4966
|
+
function isClassSetReservedPunctuator(ch) {
|
|
4967
|
+
return (
|
|
4968
|
+
ch === 0x21 /* ! */ ||
|
|
4969
|
+
ch === 0x23 /* # */ ||
|
|
4970
|
+
ch === 0x25 /* % */ ||
|
|
4971
|
+
ch === 0x26 /* & */ ||
|
|
4972
|
+
ch === 0x2C /* , */ ||
|
|
4973
|
+
ch === 0x2D /* - */ ||
|
|
4974
|
+
ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||
|
|
4975
|
+
ch === 0x40 /* @ */ ||
|
|
4976
|
+
ch === 0x60 /* ` */ ||
|
|
4977
|
+
ch === 0x7E /* ~ */
|
|
4978
|
+
)
|
|
4979
|
+
}
|
|
4980
|
+
|
|
4614
4981
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
4615
4982
|
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
4616
4983
|
var ch = state.current();
|
|
@@ -5531,8 +5898,23 @@
|
|
|
5531
5898
|
};
|
|
5532
5899
|
|
|
5533
5900
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
5901
|
+
//
|
|
5902
|
+
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
|
|
5903
|
+
// various contributors and released under an MIT license.
|
|
5904
|
+
//
|
|
5905
|
+
// Git repositories for Acorn are available at
|
|
5906
|
+
//
|
|
5907
|
+
// http://marijnhaverbeke.nl/git/acorn
|
|
5908
|
+
// https://github.com/acornjs/acorn.git
|
|
5909
|
+
//
|
|
5910
|
+
// Please use the [github bug tracker][ghbt] to report issues.
|
|
5911
|
+
//
|
|
5912
|
+
// [ghbt]: https://github.com/acornjs/acorn/issues
|
|
5913
|
+
//
|
|
5914
|
+
// [walk]: util/walk.js
|
|
5915
|
+
|
|
5534
5916
|
|
|
5535
|
-
var version = "8.
|
|
5917
|
+
var version = "8.10.0";
|
|
5536
5918
|
|
|
5537
5919
|
Parser.acorn = {
|
|
5538
5920
|
Parser: Parser,
|