@m2c2kit/build-helpers 0.3.7 → 0.3.8
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/README.md +22 -0
- package/dist/index.js +513 -137
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @m2c2kit/build-helpers
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://github.com/m2c2-project/m2c2kit/actions/workflows/ci.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/@m2c2kit/build-helpers)
|
|
6
|
+
|
|
7
|
+
This package contains utility functions for building m2c2kit apps.
|
|
8
|
+
|
|
9
|
+
**m2c2kit** is a library for cross-platform cognitive assessments. Features:
|
|
10
|
+
|
|
11
|
+
- **Mobile first**. Optimized for touch and mobile devices while also usable on desktops.
|
|
12
|
+
- **Portable**. Use on browsers, compile within native apps using web views, or embed in products like Qualtrics. A shared assessment codebase reduces development time and promotes experiment standardization across devices and services.
|
|
13
|
+
- **Rapid iteration**. Quickly develop and test new assessments with the JavaScript-based library and deploy them in studies.
|
|
14
|
+
|
|
15
|
+
## Resources
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
- [Website](https://m2c2-project.github.io/m2c2kit/)
|
|
20
|
+
- [Live Examples](https://m2c2-project.github.io/m2c2kit/docs/category/examples)
|
|
21
|
+
- [Getting Started](https://m2c2-project.github.io/m2c2kit/docs/getting-started)
|
|
22
|
+
- [Interactive Tutorial](https://m2c2-project.github.io/m2c2kit/docs/tutorial-fundamentals/fundamentals)
|
package/dist/index.js
CHANGED
|
@@ -5269,6 +5269,9 @@ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
|
|
|
5269
5269
|
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";
|
|
5270
5270
|
|
|
5271
5271
|
// These are a run-length and offset encoded representation of the
|
|
5272
|
+
// >0xffff code points that are a valid part of identifiers. The
|
|
5273
|
+
// offset starts at 0x10000, and each pair of numbers represents an
|
|
5274
|
+
// offset to the next range, and then a size of the range.
|
|
5272
5275
|
|
|
5273
5276
|
// Reserved word lists for various dialects of the language
|
|
5274
5277
|
|
|
@@ -6387,6 +6390,16 @@ pp$8.parseThrowStatement = function(node) {
|
|
|
6387
6390
|
|
|
6388
6391
|
var empty$1 = [];
|
|
6389
6392
|
|
|
6393
|
+
pp$8.parseCatchClauseParam = function() {
|
|
6394
|
+
var param = this.parseBindingAtom();
|
|
6395
|
+
var simple = param.type === "Identifier";
|
|
6396
|
+
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
6397
|
+
this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
6398
|
+
this.expect(types$1.parenR);
|
|
6399
|
+
|
|
6400
|
+
return param
|
|
6401
|
+
};
|
|
6402
|
+
|
|
6390
6403
|
pp$8.parseTryStatement = function(node) {
|
|
6391
6404
|
this.next();
|
|
6392
6405
|
node.block = this.parseBlock();
|
|
@@ -6395,11 +6408,7 @@ pp$8.parseTryStatement = function(node) {
|
|
|
6395
6408
|
var clause = this.startNode();
|
|
6396
6409
|
this.next();
|
|
6397
6410
|
if (this.eat(types$1.parenL)) {
|
|
6398
|
-
clause.param = this.
|
|
6399
|
-
var simple = clause.param.type === "Identifier";
|
|
6400
|
-
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
6401
|
-
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
6402
|
-
this.expect(types$1.parenR);
|
|
6411
|
+
clause.param = this.parseCatchClauseParam();
|
|
6403
6412
|
} else {
|
|
6404
6413
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
6405
6414
|
clause.param = null;
|
|
@@ -6415,9 +6424,9 @@ pp$8.parseTryStatement = function(node) {
|
|
|
6415
6424
|
return this.finishNode(node, "TryStatement")
|
|
6416
6425
|
};
|
|
6417
6426
|
|
|
6418
|
-
pp$8.parseVarStatement = function(node, kind) {
|
|
6427
|
+
pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
|
|
6419
6428
|
this.next();
|
|
6420
|
-
this.parseVar(node, false, kind);
|
|
6429
|
+
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
6421
6430
|
this.semicolon();
|
|
6422
6431
|
return this.finishNode(node, "VariableDeclaration")
|
|
6423
6432
|
};
|
|
@@ -6546,7 +6555,7 @@ pp$8.parseForIn = function(node, init) {
|
|
|
6546
6555
|
|
|
6547
6556
|
// Parse a list of variable declarations.
|
|
6548
6557
|
|
|
6549
|
-
pp$8.parseVar = function(node, isFor, kind) {
|
|
6558
|
+
pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
6550
6559
|
node.declarations = [];
|
|
6551
6560
|
node.kind = kind;
|
|
6552
6561
|
for (;;) {
|
|
@@ -6554,9 +6563,9 @@ pp$8.parseVar = function(node, isFor, kind) {
|
|
|
6554
6563
|
this.parseVarId(decl, kind);
|
|
6555
6564
|
if (this.eat(types$1.eq)) {
|
|
6556
6565
|
decl.init = this.parseMaybeAssign(isFor);
|
|
6557
|
-
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
6566
|
+
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
6558
6567
|
this.unexpected();
|
|
6559
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
6568
|
+
} else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
6560
6569
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
6561
6570
|
} else {
|
|
6562
6571
|
decl.init = null;
|
|
@@ -6645,7 +6654,7 @@ pp$8.parseClass = function(node, isStatement) {
|
|
|
6645
6654
|
if (element) {
|
|
6646
6655
|
classBody.body.push(element);
|
|
6647
6656
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
6648
|
-
if (hadConstructor) { this.
|
|
6657
|
+
if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
|
|
6649
6658
|
hadConstructor = true;
|
|
6650
6659
|
} else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
6651
6660
|
this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
|
|
@@ -6894,44 +6903,36 @@ function checkKeyName(node, name) {
|
|
|
6894
6903
|
|
|
6895
6904
|
// Parses module export declaration.
|
|
6896
6905
|
|
|
6906
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
6907
|
+
if (this.options.ecmaVersion >= 11) {
|
|
6908
|
+
if (this.eatContextual("as")) {
|
|
6909
|
+
node.exported = this.parseModuleExportName();
|
|
6910
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
6911
|
+
} else {
|
|
6912
|
+
node.exported = null;
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
this.expectContextual("from");
|
|
6916
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
6917
|
+
node.source = this.parseExprAtom();
|
|
6918
|
+
this.semicolon();
|
|
6919
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
|
6920
|
+
};
|
|
6921
|
+
|
|
6897
6922
|
pp$8.parseExport = function(node, exports) {
|
|
6898
6923
|
this.next();
|
|
6899
6924
|
// export * from '...'
|
|
6900
6925
|
if (this.eat(types$1.star)) {
|
|
6901
|
-
|
|
6902
|
-
if (this.eatContextual("as")) {
|
|
6903
|
-
node.exported = this.parseModuleExportName();
|
|
6904
|
-
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
6905
|
-
} else {
|
|
6906
|
-
node.exported = null;
|
|
6907
|
-
}
|
|
6908
|
-
}
|
|
6909
|
-
this.expectContextual("from");
|
|
6910
|
-
if (this.type !== types$1.string) { this.unexpected(); }
|
|
6911
|
-
node.source = this.parseExprAtom();
|
|
6912
|
-
this.semicolon();
|
|
6913
|
-
return this.finishNode(node, "ExportAllDeclaration")
|
|
6926
|
+
return this.parseExportAllDeclaration(node, exports)
|
|
6914
6927
|
}
|
|
6915
6928
|
if (this.eat(types$1._default)) { // export default ...
|
|
6916
6929
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
6917
|
-
|
|
6918
|
-
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
6919
|
-
var fNode = this.startNode();
|
|
6920
|
-
this.next();
|
|
6921
|
-
if (isAsync) { this.next(); }
|
|
6922
|
-
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
6923
|
-
} else if (this.type === types$1._class) {
|
|
6924
|
-
var cNode = this.startNode();
|
|
6925
|
-
node.declaration = this.parseClass(cNode, "nullableID");
|
|
6926
|
-
} else {
|
|
6927
|
-
node.declaration = this.parseMaybeAssign();
|
|
6928
|
-
this.semicolon();
|
|
6929
|
-
}
|
|
6930
|
+
node.declaration = this.parseExportDefaultDeclaration();
|
|
6930
6931
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
6931
6932
|
}
|
|
6932
6933
|
// export var|const|let|function|class ...
|
|
6933
6934
|
if (this.shouldParseExportStatement()) {
|
|
6934
|
-
node.declaration = this.
|
|
6935
|
+
node.declaration = this.parseExportDeclaration(node);
|
|
6935
6936
|
if (node.declaration.type === "VariableDeclaration")
|
|
6936
6937
|
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
6937
6938
|
else
|
|
@@ -6965,6 +6966,27 @@ pp$8.parseExport = function(node, exports) {
|
|
|
6965
6966
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
6966
6967
|
};
|
|
6967
6968
|
|
|
6969
|
+
pp$8.parseExportDeclaration = function(node) {
|
|
6970
|
+
return this.parseStatement(null)
|
|
6971
|
+
};
|
|
6972
|
+
|
|
6973
|
+
pp$8.parseExportDefaultDeclaration = function() {
|
|
6974
|
+
var isAsync;
|
|
6975
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
6976
|
+
var fNode = this.startNode();
|
|
6977
|
+
this.next();
|
|
6978
|
+
if (isAsync) { this.next(); }
|
|
6979
|
+
return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync)
|
|
6980
|
+
} else if (this.type === types$1._class) {
|
|
6981
|
+
var cNode = this.startNode();
|
|
6982
|
+
return this.parseClass(cNode, "nullableID")
|
|
6983
|
+
} else {
|
|
6984
|
+
var declaration = this.parseMaybeAssign();
|
|
6985
|
+
this.semicolon();
|
|
6986
|
+
return declaration
|
|
6987
|
+
}
|
|
6988
|
+
};
|
|
6989
|
+
|
|
6968
6990
|
pp$8.checkExport = function(exports, name, pos) {
|
|
6969
6991
|
if (!exports) { return }
|
|
6970
6992
|
if (typeof name !== "string")
|
|
@@ -7022,6 +7044,20 @@ pp$8.shouldParseExportStatement = function() {
|
|
|
7022
7044
|
|
|
7023
7045
|
// Parses a comma-separated list of module exports.
|
|
7024
7046
|
|
|
7047
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
7048
|
+
var node = this.startNode();
|
|
7049
|
+
node.local = this.parseModuleExportName();
|
|
7050
|
+
|
|
7051
|
+
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
7052
|
+
this.checkExport(
|
|
7053
|
+
exports,
|
|
7054
|
+
node.exported,
|
|
7055
|
+
node.exported.start
|
|
7056
|
+
);
|
|
7057
|
+
|
|
7058
|
+
return this.finishNode(node, "ExportSpecifier")
|
|
7059
|
+
};
|
|
7060
|
+
|
|
7025
7061
|
pp$8.parseExportSpecifiers = function(exports) {
|
|
7026
7062
|
var nodes = [], first = true;
|
|
7027
7063
|
// export { x, y as z } [from '...']
|
|
@@ -7032,15 +7068,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
7032
7068
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
7033
7069
|
} else { first = false; }
|
|
7034
7070
|
|
|
7035
|
-
|
|
7036
|
-
node.local = this.parseModuleExportName();
|
|
7037
|
-
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
7038
|
-
this.checkExport(
|
|
7039
|
-
exports,
|
|
7040
|
-
node.exported,
|
|
7041
|
-
node.exported.start
|
|
7042
|
-
);
|
|
7043
|
-
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
|
7071
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
7044
7072
|
}
|
|
7045
7073
|
return nodes
|
|
7046
7074
|
};
|
|
@@ -7049,6 +7077,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
7049
7077
|
|
|
7050
7078
|
pp$8.parseImport = function(node) {
|
|
7051
7079
|
this.next();
|
|
7080
|
+
|
|
7052
7081
|
// import '...'
|
|
7053
7082
|
if (this.type === types$1.string) {
|
|
7054
7083
|
node.specifiers = empty$1;
|
|
@@ -7064,23 +7093,46 @@ pp$8.parseImport = function(node) {
|
|
|
7064
7093
|
|
|
7065
7094
|
// Parses a comma-separated list of module imports.
|
|
7066
7095
|
|
|
7096
|
+
pp$8.parseImportSpecifier = function() {
|
|
7097
|
+
var node = this.startNode();
|
|
7098
|
+
node.imported = this.parseModuleExportName();
|
|
7099
|
+
|
|
7100
|
+
if (this.eatContextual("as")) {
|
|
7101
|
+
node.local = this.parseIdent();
|
|
7102
|
+
} else {
|
|
7103
|
+
this.checkUnreserved(node.imported);
|
|
7104
|
+
node.local = node.imported;
|
|
7105
|
+
}
|
|
7106
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
7107
|
+
|
|
7108
|
+
return this.finishNode(node, "ImportSpecifier")
|
|
7109
|
+
};
|
|
7110
|
+
|
|
7111
|
+
pp$8.parseImportDefaultSpecifier = function() {
|
|
7112
|
+
// import defaultObj, { x, y as z } from '...'
|
|
7113
|
+
var node = this.startNode();
|
|
7114
|
+
node.local = this.parseIdent();
|
|
7115
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
7116
|
+
return this.finishNode(node, "ImportDefaultSpecifier")
|
|
7117
|
+
};
|
|
7118
|
+
|
|
7119
|
+
pp$8.parseImportNamespaceSpecifier = function() {
|
|
7120
|
+
var node = this.startNode();
|
|
7121
|
+
this.next();
|
|
7122
|
+
this.expectContextual("as");
|
|
7123
|
+
node.local = this.parseIdent();
|
|
7124
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
7125
|
+
return this.finishNode(node, "ImportNamespaceSpecifier")
|
|
7126
|
+
};
|
|
7127
|
+
|
|
7067
7128
|
pp$8.parseImportSpecifiers = function() {
|
|
7068
7129
|
var nodes = [], first = true;
|
|
7069
7130
|
if (this.type === types$1.name) {
|
|
7070
|
-
|
|
7071
|
-
var node = this.startNode();
|
|
7072
|
-
node.local = this.parseIdent();
|
|
7073
|
-
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
7074
|
-
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
7131
|
+
nodes.push(this.parseImportDefaultSpecifier());
|
|
7075
7132
|
if (!this.eat(types$1.comma)) { return nodes }
|
|
7076
7133
|
}
|
|
7077
7134
|
if (this.type === types$1.star) {
|
|
7078
|
-
|
|
7079
|
-
this.next();
|
|
7080
|
-
this.expectContextual("as");
|
|
7081
|
-
node$1.local = this.parseIdent();
|
|
7082
|
-
this.checkLValSimple(node$1.local, BIND_LEXICAL);
|
|
7083
|
-
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
7135
|
+
nodes.push(this.parseImportNamespaceSpecifier());
|
|
7084
7136
|
return nodes
|
|
7085
7137
|
}
|
|
7086
7138
|
this.expect(types$1.braceL);
|
|
@@ -7090,16 +7142,7 @@ pp$8.parseImportSpecifiers = function() {
|
|
|
7090
7142
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
7091
7143
|
} else { first = false; }
|
|
7092
7144
|
|
|
7093
|
-
|
|
7094
|
-
node$2.imported = this.parseModuleExportName();
|
|
7095
|
-
if (this.eatContextual("as")) {
|
|
7096
|
-
node$2.local = this.parseIdent();
|
|
7097
|
-
} else {
|
|
7098
|
-
this.checkUnreserved(node$2.imported);
|
|
7099
|
-
node$2.local = node$2.imported;
|
|
7100
|
-
}
|
|
7101
|
-
this.checkLValSimple(node$2.local, BIND_LEXICAL);
|
|
7102
|
-
nodes.push(this.finishNode(node$2, "ImportSpecifier"));
|
|
7145
|
+
nodes.push(this.parseImportSpecifier());
|
|
7103
7146
|
}
|
|
7104
7147
|
return nodes
|
|
7105
7148
|
};
|
|
@@ -7272,7 +7315,7 @@ pp$7.parseBindingAtom = function() {
|
|
|
7272
7315
|
return this.parseIdent()
|
|
7273
7316
|
};
|
|
7274
7317
|
|
|
7275
|
-
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
7318
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
|
|
7276
7319
|
var elts = [], first = true;
|
|
7277
7320
|
while (!this.eat(close)) {
|
|
7278
7321
|
if (first) { first = false; }
|
|
@@ -7285,18 +7328,22 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
7285
7328
|
var rest = this.parseRestBinding();
|
|
7286
7329
|
this.parseBindingListItem(rest);
|
|
7287
7330
|
elts.push(rest);
|
|
7288
|
-
if (this.type === types$1.comma) { this.
|
|
7331
|
+
if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
|
|
7289
7332
|
this.expect(close);
|
|
7290
7333
|
break
|
|
7291
7334
|
} else {
|
|
7292
|
-
|
|
7293
|
-
this.parseBindingListItem(elem);
|
|
7294
|
-
elts.push(elem);
|
|
7335
|
+
elts.push(this.parseAssignableListItem(allowModifiers));
|
|
7295
7336
|
}
|
|
7296
7337
|
}
|
|
7297
7338
|
return elts
|
|
7298
7339
|
};
|
|
7299
7340
|
|
|
7341
|
+
pp$7.parseAssignableListItem = function(allowModifiers) {
|
|
7342
|
+
var elem = this.parseMaybeDefault(this.start, this.startLoc);
|
|
7343
|
+
this.parseBindingListItem(elem);
|
|
7344
|
+
return elem
|
|
7345
|
+
};
|
|
7346
|
+
|
|
7300
7347
|
pp$7.parseBindingListItem = function(param) {
|
|
7301
7348
|
return param
|
|
7302
7349
|
};
|
|
@@ -7462,6 +7509,9 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
|
7462
7509
|
};
|
|
7463
7510
|
|
|
7464
7511
|
// The algorithm used to determine whether a regexp can appear at a
|
|
7512
|
+
// given point in the program is loosely based on sweet.js' approach.
|
|
7513
|
+
// See https://github.com/mozilla/sweet.js/wiki/design
|
|
7514
|
+
|
|
7465
7515
|
|
|
7466
7516
|
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
7467
7517
|
this.token = token;
|
|
@@ -7617,6 +7667,23 @@ types$1.name.updateContext = function(prevType) {
|
|
|
7617
7667
|
};
|
|
7618
7668
|
|
|
7619
7669
|
// A recursive descent parser operates by defining functions for all
|
|
7670
|
+
// syntactic elements, and recursively calling those, each function
|
|
7671
|
+
// advancing the input stream and returning an AST node. Precedence
|
|
7672
|
+
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
|
|
7673
|
+
// instead of `(!x)[1]` is handled by the fact that the parser
|
|
7674
|
+
// function that parses unary prefix operators is called first, and
|
|
7675
|
+
// in turn calls the function that parses `[]` subscripts — that
|
|
7676
|
+
// way, it'll receive the node for `x[1]` already parsed, and wraps
|
|
7677
|
+
// *that* in the unary operator node.
|
|
7678
|
+
//
|
|
7679
|
+
// Acorn uses an [operator precedence parser][opp] to handle binary
|
|
7680
|
+
// operator precedence, because it is much more compact than using
|
|
7681
|
+
// the technique outlined above, which uses different, nesting
|
|
7682
|
+
// functions to specify precedence, for all of the ten binary
|
|
7683
|
+
// precedence levels that JavaScript defines.
|
|
7684
|
+
//
|
|
7685
|
+
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
|
|
7686
|
+
|
|
7620
7687
|
|
|
7621
7688
|
var pp$5 = Parser.prototype;
|
|
7622
7689
|
|
|
@@ -7920,6 +7987,14 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
7920
7987
|
}
|
|
7921
7988
|
};
|
|
7922
7989
|
|
|
7990
|
+
pp$5.shouldParseAsyncArrow = function() {
|
|
7991
|
+
return !this.canInsertSemicolon() && this.eat(types$1.arrow)
|
|
7992
|
+
};
|
|
7993
|
+
|
|
7994
|
+
pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
|
|
7995
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
|
|
7996
|
+
};
|
|
7997
|
+
|
|
7923
7998
|
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
7924
7999
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
7925
8000
|
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
@@ -7948,7 +8023,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
7948
8023
|
this.awaitPos = 0;
|
|
7949
8024
|
this.awaitIdentPos = 0;
|
|
7950
8025
|
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
7951
|
-
if (maybeAsyncArrow && !optional &&
|
|
8026
|
+
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
|
|
7952
8027
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
7953
8028
|
this.checkYieldAwaitInDefaultParams();
|
|
7954
8029
|
if (this.awaitIdentPos > 0)
|
|
@@ -7956,7 +8031,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
7956
8031
|
this.yieldPos = oldYieldPos;
|
|
7957
8032
|
this.awaitPos = oldAwaitPos;
|
|
7958
8033
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
7959
|
-
return this.
|
|
8034
|
+
return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
|
|
7960
8035
|
}
|
|
7961
8036
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
7962
8037
|
this.yieldPos = oldYieldPos || this.yieldPos;
|
|
@@ -7986,7 +8061,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
7986
8061
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
7987
8062
|
// or `{}`.
|
|
7988
8063
|
|
|
7989
|
-
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
8064
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
7990
8065
|
// If a division operator appears in an expression position, the
|
|
7991
8066
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
7992
8067
|
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
@@ -8087,17 +8162,21 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
8087
8162
|
|
|
8088
8163
|
case types$1._import:
|
|
8089
8164
|
if (this.options.ecmaVersion >= 11) {
|
|
8090
|
-
return this.parseExprImport()
|
|
8165
|
+
return this.parseExprImport(forNew)
|
|
8091
8166
|
} else {
|
|
8092
8167
|
return this.unexpected()
|
|
8093
8168
|
}
|
|
8094
8169
|
|
|
8095
8170
|
default:
|
|
8096
|
-
this.
|
|
8171
|
+
return this.parseExprAtomDefault()
|
|
8097
8172
|
}
|
|
8098
8173
|
};
|
|
8099
8174
|
|
|
8100
|
-
pp$5.
|
|
8175
|
+
pp$5.parseExprAtomDefault = function() {
|
|
8176
|
+
this.unexpected();
|
|
8177
|
+
};
|
|
8178
|
+
|
|
8179
|
+
pp$5.parseExprImport = function(forNew) {
|
|
8101
8180
|
var node = this.startNode();
|
|
8102
8181
|
|
|
8103
8182
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -8105,13 +8184,12 @@ pp$5.parseExprImport = function() {
|
|
|
8105
8184
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
|
|
8106
8185
|
var meta = this.parseIdent(true);
|
|
8107
8186
|
|
|
8108
|
-
|
|
8109
|
-
case types$1.parenL:
|
|
8187
|
+
if (this.type === types$1.parenL && !forNew) {
|
|
8110
8188
|
return this.parseDynamicImport(node)
|
|
8111
|
-
|
|
8189
|
+
} else if (this.type === types$1.dot) {
|
|
8112
8190
|
node.meta = meta;
|
|
8113
8191
|
return this.parseImportMeta(node)
|
|
8114
|
-
|
|
8192
|
+
} else {
|
|
8115
8193
|
this.unexpected();
|
|
8116
8194
|
}
|
|
8117
8195
|
};
|
|
@@ -8167,6 +8245,10 @@ pp$5.parseParenExpression = function() {
|
|
|
8167
8245
|
return val
|
|
8168
8246
|
};
|
|
8169
8247
|
|
|
8248
|
+
pp$5.shouldParseArrow = function(exprList) {
|
|
8249
|
+
return !this.canInsertSemicolon()
|
|
8250
|
+
};
|
|
8251
|
+
|
|
8170
8252
|
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
8171
8253
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
8172
8254
|
if (this.options.ecmaVersion >= 6) {
|
|
@@ -8186,7 +8268,12 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
8186
8268
|
} else if (this.type === types$1.ellipsis) {
|
|
8187
8269
|
spreadStart = this.start;
|
|
8188
8270
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
8189
|
-
if (this.type === types$1.comma) {
|
|
8271
|
+
if (this.type === types$1.comma) {
|
|
8272
|
+
this.raiseRecoverable(
|
|
8273
|
+
this.start,
|
|
8274
|
+
"Comma is not permitted after the rest element"
|
|
8275
|
+
);
|
|
8276
|
+
}
|
|
8190
8277
|
break
|
|
8191
8278
|
} else {
|
|
8192
8279
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
@@ -8195,7 +8282,7 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
8195
8282
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
8196
8283
|
this.expect(types$1.parenR);
|
|
8197
8284
|
|
|
8198
|
-
if (canBeArrow &&
|
|
8285
|
+
if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
|
|
8199
8286
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
8200
8287
|
this.checkYieldAwaitInDefaultParams();
|
|
8201
8288
|
this.yieldPos = oldYieldPos;
|
|
@@ -8261,11 +8348,8 @@ pp$5.parseNew = function() {
|
|
|
8261
8348
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
8262
8349
|
return this.finishNode(node, "MetaProperty")
|
|
8263
8350
|
}
|
|
8264
|
-
var startPos = this.start, startLoc = this.startLoc
|
|
8265
|
-
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
8266
|
-
if (isImport && node.callee.type === "ImportExpression") {
|
|
8267
|
-
this.raise(startPos, "Cannot use new with import()");
|
|
8268
|
-
}
|
|
8351
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
8352
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
8269
8353
|
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
8270
8354
|
else { node.arguments = empty; }
|
|
8271
8355
|
return this.finishNode(node, "NewExpression")
|
|
@@ -8347,7 +8431,7 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
8347
8431
|
if (isPattern) {
|
|
8348
8432
|
prop.argument = this.parseIdent(false);
|
|
8349
8433
|
if (this.type === types$1.comma) {
|
|
8350
|
-
this.
|
|
8434
|
+
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
|
|
8351
8435
|
}
|
|
8352
8436
|
return this.finishNode(prop, "RestElement")
|
|
8353
8437
|
}
|
|
@@ -8383,6 +8467,23 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
8383
8467
|
return this.finishNode(prop, "Property")
|
|
8384
8468
|
};
|
|
8385
8469
|
|
|
8470
|
+
pp$5.parseGetterSetter = function(prop) {
|
|
8471
|
+
prop.kind = prop.key.name;
|
|
8472
|
+
this.parsePropertyName(prop);
|
|
8473
|
+
prop.value = this.parseMethod(false);
|
|
8474
|
+
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
8475
|
+
if (prop.value.params.length !== paramCount) {
|
|
8476
|
+
var start = prop.value.start;
|
|
8477
|
+
if (prop.kind === "get")
|
|
8478
|
+
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
8479
|
+
else
|
|
8480
|
+
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
8481
|
+
} else {
|
|
8482
|
+
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
8483
|
+
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
8484
|
+
}
|
|
8485
|
+
};
|
|
8486
|
+
|
|
8386
8487
|
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
8387
8488
|
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
8388
8489
|
{ this.unexpected(); }
|
|
@@ -8400,20 +8501,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
8400
8501
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
8401
8502
|
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
8402
8503
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
8403
|
-
|
|
8404
|
-
this.parsePropertyName(prop);
|
|
8405
|
-
prop.value = this.parseMethod(false);
|
|
8406
|
-
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
8407
|
-
if (prop.value.params.length !== paramCount) {
|
|
8408
|
-
var start = prop.value.start;
|
|
8409
|
-
if (prop.kind === "get")
|
|
8410
|
-
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
8411
|
-
else
|
|
8412
|
-
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
8413
|
-
} else {
|
|
8414
|
-
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
8415
|
-
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
8416
|
-
}
|
|
8504
|
+
this.parseGetterSetter(prop);
|
|
8417
8505
|
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
|
|
8418
8506
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
8419
8507
|
this.checkUnreserved(prop.key);
|
|
@@ -8625,6 +8713,18 @@ pp$5.checkUnreserved = function(ref) {
|
|
|
8625
8713
|
// identifiers.
|
|
8626
8714
|
|
|
8627
8715
|
pp$5.parseIdent = function(liberal) {
|
|
8716
|
+
var node = this.parseIdentNode();
|
|
8717
|
+
this.next(!!liberal);
|
|
8718
|
+
this.finishNode(node, "Identifier");
|
|
8719
|
+
if (!liberal) {
|
|
8720
|
+
this.checkUnreserved(node);
|
|
8721
|
+
if (node.name === "await" && !this.awaitIdentPos)
|
|
8722
|
+
{ this.awaitIdentPos = node.start; }
|
|
8723
|
+
}
|
|
8724
|
+
return node
|
|
8725
|
+
};
|
|
8726
|
+
|
|
8727
|
+
pp$5.parseIdentNode = function() {
|
|
8628
8728
|
var node = this.startNode();
|
|
8629
8729
|
if (this.type === types$1.name) {
|
|
8630
8730
|
node.name = this.value;
|
|
@@ -8636,19 +8736,12 @@ pp$5.parseIdent = function(liberal) {
|
|
|
8636
8736
|
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
|
8637
8737
|
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
|
8638
8738
|
if ((node.name === "class" || node.name === "function") &&
|
|
8639
|
-
|
|
8739
|
+
(this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
8640
8740
|
this.context.pop();
|
|
8641
8741
|
}
|
|
8642
8742
|
} else {
|
|
8643
8743
|
this.unexpected();
|
|
8644
8744
|
}
|
|
8645
|
-
this.next(!!liberal);
|
|
8646
|
-
this.finishNode(node, "Identifier");
|
|
8647
|
-
if (!liberal) {
|
|
8648
|
-
this.checkUnreserved(node);
|
|
8649
|
-
if (node.name === "await" && !this.awaitIdentPos)
|
|
8650
|
-
{ this.awaitIdentPos = node.start; }
|
|
8651
|
-
}
|
|
8652
8745
|
return node
|
|
8653
8746
|
};
|
|
8654
8747
|
|
|
@@ -8888,6 +8981,18 @@ var unicodeBinaryProperties = {
|
|
|
8888
8981
|
14: ecma14BinaryProperties
|
|
8889
8982
|
};
|
|
8890
8983
|
|
|
8984
|
+
// #table-binary-unicode-properties-of-strings
|
|
8985
|
+
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";
|
|
8986
|
+
|
|
8987
|
+
var unicodeBinaryPropertiesOfStrings = {
|
|
8988
|
+
9: "",
|
|
8989
|
+
10: "",
|
|
8990
|
+
11: "",
|
|
8991
|
+
12: "",
|
|
8992
|
+
13: "",
|
|
8993
|
+
14: ecma14BinaryPropertiesOfStrings
|
|
8994
|
+
};
|
|
8995
|
+
|
|
8891
8996
|
// #table-unicode-general-category-values
|
|
8892
8997
|
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";
|
|
8893
8998
|
|
|
@@ -8897,7 +9002,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
|
|
|
8897
9002
|
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
|
|
8898
9003
|
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
|
|
8899
9004
|
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
|
|
8900
|
-
var ecma14ScriptValues = ecma13ScriptValues + " Kawi Nag_Mundari Nagm";
|
|
9005
|
+
var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
|
|
8901
9006
|
|
|
8902
9007
|
var unicodeScriptValues = {
|
|
8903
9008
|
9: ecma9ScriptValues,
|
|
@@ -8912,6 +9017,7 @@ var data = {};
|
|
|
8912
9017
|
function buildUnicodeData(ecmaVersion) {
|
|
8913
9018
|
var d = data[ecmaVersion] = {
|
|
8914
9019
|
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
|
|
9020
|
+
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
|
|
8915
9021
|
nonBinary: {
|
|
8916
9022
|
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
|
|
8917
9023
|
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
|
|
@@ -8934,12 +9040,13 @@ var pp$1 = Parser.prototype;
|
|
|
8934
9040
|
|
|
8935
9041
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
8936
9042
|
this.parser = parser;
|
|
8937
|
-
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
|
|
9043
|
+
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
8938
9044
|
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
8939
9045
|
this.source = "";
|
|
8940
9046
|
this.flags = "";
|
|
8941
9047
|
this.start = 0;
|
|
8942
9048
|
this.switchU = false;
|
|
9049
|
+
this.switchV = false;
|
|
8943
9050
|
this.switchN = false;
|
|
8944
9051
|
this.pos = 0;
|
|
8945
9052
|
this.lastIntValue = 0;
|
|
@@ -8952,12 +9059,20 @@ var RegExpValidationState = function RegExpValidationState(parser) {
|
|
|
8952
9059
|
};
|
|
8953
9060
|
|
|
8954
9061
|
RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
|
|
9062
|
+
var unicodeSets = flags.indexOf("v") !== -1;
|
|
8955
9063
|
var unicode = flags.indexOf("u") !== -1;
|
|
8956
9064
|
this.start = start | 0;
|
|
8957
9065
|
this.source = pattern + "";
|
|
8958
9066
|
this.flags = flags;
|
|
8959
|
-
|
|
8960
|
-
|
|
9067
|
+
if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
|
|
9068
|
+
this.switchU = true;
|
|
9069
|
+
this.switchV = true;
|
|
9070
|
+
this.switchN = true;
|
|
9071
|
+
} else {
|
|
9072
|
+
this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
|
|
9073
|
+
this.switchV = false;
|
|
9074
|
+
this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
|
|
9075
|
+
}
|
|
8961
9076
|
};
|
|
8962
9077
|
|
|
8963
9078
|
RegExpValidationState.prototype.raise = function raise (message) {
|
|
@@ -9026,6 +9141,23 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
9026
9141
|
return false
|
|
9027
9142
|
};
|
|
9028
9143
|
|
|
9144
|
+
RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
|
|
9145
|
+
if ( forceU === void 0 ) forceU = false;
|
|
9146
|
+
|
|
9147
|
+
var pos = this.pos;
|
|
9148
|
+
for (var i = 0, list = chs; i < list.length; i += 1) {
|
|
9149
|
+
var ch = list[i];
|
|
9150
|
+
|
|
9151
|
+
var current = this.at(pos, forceU);
|
|
9152
|
+
if (current === -1 || current !== ch) {
|
|
9153
|
+
return false
|
|
9154
|
+
}
|
|
9155
|
+
pos = this.nextIndex(pos, forceU);
|
|
9156
|
+
}
|
|
9157
|
+
this.pos = pos;
|
|
9158
|
+
return true
|
|
9159
|
+
};
|
|
9160
|
+
|
|
9029
9161
|
/**
|
|
9030
9162
|
* Validate the flags part of a given RegExpLiteral.
|
|
9031
9163
|
*
|
|
@@ -9036,6 +9168,9 @@ pp$1.validateRegExpFlags = function(state) {
|
|
|
9036
9168
|
var validFlags = state.validFlags;
|
|
9037
9169
|
var flags = state.flags;
|
|
9038
9170
|
|
|
9171
|
+
var u = false;
|
|
9172
|
+
var v = false;
|
|
9173
|
+
|
|
9039
9174
|
for (var i = 0; i < flags.length; i++) {
|
|
9040
9175
|
var flag = flags.charAt(i);
|
|
9041
9176
|
if (validFlags.indexOf(flag) === -1) {
|
|
@@ -9044,6 +9179,11 @@ pp$1.validateRegExpFlags = function(state) {
|
|
|
9044
9179
|
if (flags.indexOf(flag, i + 1) > -1) {
|
|
9045
9180
|
this.raise(state.start, "Duplicate regular expression flag");
|
|
9046
9181
|
}
|
|
9182
|
+
if (flag === "u") { u = true; }
|
|
9183
|
+
if (flag === "v") { v = true; }
|
|
9184
|
+
}
|
|
9185
|
+
if (this.options.ecmaVersion >= 15 && u && v) {
|
|
9186
|
+
this.raise(state.start, "Invalid regular expression flag");
|
|
9047
9187
|
}
|
|
9048
9188
|
};
|
|
9049
9189
|
|
|
@@ -9662,6 +9802,12 @@ pp$1.regexp_eatDecimalEscape = function(state) {
|
|
|
9662
9802
|
return false
|
|
9663
9803
|
};
|
|
9664
9804
|
|
|
9805
|
+
// Return values used by character set parsing methods, needed to
|
|
9806
|
+
// forbid negation of sets that can match strings.
|
|
9807
|
+
var CharSetNone = 0; // Nothing parsed
|
|
9808
|
+
var CharSetOk = 1; // Construct parsed, cannot contain strings
|
|
9809
|
+
var CharSetString = 2; // Construct parsed, can contain strings
|
|
9810
|
+
|
|
9665
9811
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
9666
9812
|
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
9667
9813
|
var ch = state.current();
|
|
@@ -9669,28 +9815,32 @@ pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
|
9669
9815
|
if (isCharacterClassEscape(ch)) {
|
|
9670
9816
|
state.lastIntValue = -1;
|
|
9671
9817
|
state.advance();
|
|
9672
|
-
return
|
|
9818
|
+
return CharSetOk
|
|
9673
9819
|
}
|
|
9674
9820
|
|
|
9821
|
+
var negate = false;
|
|
9675
9822
|
if (
|
|
9676
9823
|
state.switchU &&
|
|
9677
9824
|
this.options.ecmaVersion >= 9 &&
|
|
9678
|
-
(ch === 0x50 /* P */ || ch === 0x70 /* p */)
|
|
9825
|
+
((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
|
|
9679
9826
|
) {
|
|
9680
9827
|
state.lastIntValue = -1;
|
|
9681
9828
|
state.advance();
|
|
9829
|
+
var result;
|
|
9682
9830
|
if (
|
|
9683
9831
|
state.eat(0x7B /* { */) &&
|
|
9684
|
-
this.regexp_eatUnicodePropertyValueExpression(state) &&
|
|
9832
|
+
(result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
|
|
9685
9833
|
state.eat(0x7D /* } */)
|
|
9686
9834
|
) {
|
|
9687
|
-
|
|
9835
|
+
if (negate && result === CharSetString) { state.raise("Invalid property name"); }
|
|
9836
|
+
return result
|
|
9688
9837
|
}
|
|
9689
9838
|
state.raise("Invalid property name");
|
|
9690
9839
|
}
|
|
9691
9840
|
|
|
9692
|
-
return
|
|
9841
|
+
return CharSetNone
|
|
9693
9842
|
};
|
|
9843
|
+
|
|
9694
9844
|
function isCharacterClassEscape(ch) {
|
|
9695
9845
|
return (
|
|
9696
9846
|
ch === 0x64 /* d */ ||
|
|
@@ -9714,7 +9864,7 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
9714
9864
|
if (this.regexp_eatUnicodePropertyValue(state)) {
|
|
9715
9865
|
var value = state.lastStringValue;
|
|
9716
9866
|
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
|
|
9717
|
-
return
|
|
9867
|
+
return CharSetOk
|
|
9718
9868
|
}
|
|
9719
9869
|
}
|
|
9720
9870
|
state.pos = start;
|
|
@@ -9722,20 +9872,22 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
9722
9872
|
// LoneUnicodePropertyNameOrValue
|
|
9723
9873
|
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
|
|
9724
9874
|
var nameOrValue = state.lastStringValue;
|
|
9725
|
-
this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
9726
|
-
return true
|
|
9875
|
+
return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
9727
9876
|
}
|
|
9728
|
-
return
|
|
9877
|
+
return CharSetNone
|
|
9729
9878
|
};
|
|
9879
|
+
|
|
9730
9880
|
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
9731
9881
|
if (!hasOwn(state.unicodeProperties.nonBinary, name))
|
|
9732
9882
|
{ state.raise("Invalid property name"); }
|
|
9733
9883
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
9734
9884
|
{ state.raise("Invalid property value"); }
|
|
9735
9885
|
};
|
|
9886
|
+
|
|
9736
9887
|
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
9737
|
-
if (
|
|
9738
|
-
|
|
9888
|
+
if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }
|
|
9889
|
+
if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }
|
|
9890
|
+
state.raise("Invalid property name");
|
|
9739
9891
|
};
|
|
9740
9892
|
|
|
9741
9893
|
// UnicodePropertyName ::
|
|
@@ -9749,6 +9901,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
|
9749
9901
|
}
|
|
9750
9902
|
return state.lastStringValue !== ""
|
|
9751
9903
|
};
|
|
9904
|
+
|
|
9752
9905
|
function isUnicodePropertyNameCharacter(ch) {
|
|
9753
9906
|
return isControlLetter(ch) || ch === 0x5F /* _ */
|
|
9754
9907
|
}
|
|
@@ -9777,21 +9930,29 @@ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
|
9777
9930
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
9778
9931
|
pp$1.regexp_eatCharacterClass = function(state) {
|
|
9779
9932
|
if (state.eat(0x5B /* [ */)) {
|
|
9780
|
-
state.eat(0x5E /* ^ */);
|
|
9781
|
-
this.
|
|
9782
|
-
if (state.eat(0x5D /* ] */))
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9933
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
9934
|
+
var result = this.regexp_classContents(state);
|
|
9935
|
+
if (!state.eat(0x5D /* ] */))
|
|
9936
|
+
{ state.raise("Unterminated character class"); }
|
|
9937
|
+
if (negate && result === CharSetString)
|
|
9938
|
+
{ state.raise("Negated character class may contain strings"); }
|
|
9939
|
+
return true
|
|
9787
9940
|
}
|
|
9788
9941
|
return false
|
|
9789
9942
|
};
|
|
9790
9943
|
|
|
9944
|
+
// https://tc39.es/ecma262/#prod-ClassContents
|
|
9791
9945
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
9946
|
+
pp$1.regexp_classContents = function(state) {
|
|
9947
|
+
if (state.current() === 0x5D /* ] */) { return CharSetOk }
|
|
9948
|
+
if (state.switchV) { return this.regexp_classSetExpression(state) }
|
|
9949
|
+
this.regexp_nonEmptyClassRanges(state);
|
|
9950
|
+
return CharSetOk
|
|
9951
|
+
};
|
|
9952
|
+
|
|
9792
9953
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
9793
9954
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
9794
|
-
pp$1.
|
|
9955
|
+
pp$1.regexp_nonEmptyClassRanges = function(state) {
|
|
9795
9956
|
while (this.regexp_eatClassAtom(state)) {
|
|
9796
9957
|
var left = state.lastIntValue;
|
|
9797
9958
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -9863,6 +10024,205 @@ pp$1.regexp_eatClassEscape = function(state) {
|
|
|
9863
10024
|
)
|
|
9864
10025
|
};
|
|
9865
10026
|
|
|
10027
|
+
// https://tc39.es/ecma262/#prod-ClassSetExpression
|
|
10028
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
10029
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
10030
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
10031
|
+
pp$1.regexp_classSetExpression = function(state) {
|
|
10032
|
+
var result = CharSetOk, subResult;
|
|
10033
|
+
if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
|
|
10034
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
10035
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
10036
|
+
var start = state.pos;
|
|
10037
|
+
while (state.eatChars([0x26, 0x26] /* && */)) {
|
|
10038
|
+
if (
|
|
10039
|
+
state.current() !== 0x26 /* & */ &&
|
|
10040
|
+
(subResult = this.regexp_eatClassSetOperand(state))
|
|
10041
|
+
) {
|
|
10042
|
+
if (subResult !== CharSetString) { result = CharSetOk; }
|
|
10043
|
+
continue
|
|
10044
|
+
}
|
|
10045
|
+
state.raise("Invalid character in character class");
|
|
10046
|
+
}
|
|
10047
|
+
if (start !== state.pos) { return result }
|
|
10048
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
10049
|
+
while (state.eatChars([0x2D, 0x2D] /* -- */)) {
|
|
10050
|
+
if (this.regexp_eatClassSetOperand(state)) { continue }
|
|
10051
|
+
state.raise("Invalid character in character class");
|
|
10052
|
+
}
|
|
10053
|
+
if (start !== state.pos) { return result }
|
|
10054
|
+
} else {
|
|
10055
|
+
state.raise("Invalid character in character class");
|
|
10056
|
+
}
|
|
10057
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
10058
|
+
for (;;) {
|
|
10059
|
+
if (this.regexp_eatClassSetRange(state)) { continue }
|
|
10060
|
+
subResult = this.regexp_eatClassSetOperand(state);
|
|
10061
|
+
if (!subResult) { return result }
|
|
10062
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
10063
|
+
}
|
|
10064
|
+
};
|
|
10065
|
+
|
|
10066
|
+
// https://tc39.es/ecma262/#prod-ClassSetRange
|
|
10067
|
+
pp$1.regexp_eatClassSetRange = function(state) {
|
|
10068
|
+
var start = state.pos;
|
|
10069
|
+
if (this.regexp_eatClassSetCharacter(state)) {
|
|
10070
|
+
var left = state.lastIntValue;
|
|
10071
|
+
if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
|
|
10072
|
+
var right = state.lastIntValue;
|
|
10073
|
+
if (left !== -1 && right !== -1 && left > right) {
|
|
10074
|
+
state.raise("Range out of order in character class");
|
|
10075
|
+
}
|
|
10076
|
+
return true
|
|
10077
|
+
}
|
|
10078
|
+
state.pos = start;
|
|
10079
|
+
}
|
|
10080
|
+
return false
|
|
10081
|
+
};
|
|
10082
|
+
|
|
10083
|
+
// https://tc39.es/ecma262/#prod-ClassSetOperand
|
|
10084
|
+
pp$1.regexp_eatClassSetOperand = function(state) {
|
|
10085
|
+
if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }
|
|
10086
|
+
return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)
|
|
10087
|
+
};
|
|
10088
|
+
|
|
10089
|
+
// https://tc39.es/ecma262/#prod-NestedClass
|
|
10090
|
+
pp$1.regexp_eatNestedClass = function(state) {
|
|
10091
|
+
var start = state.pos;
|
|
10092
|
+
if (state.eat(0x5B /* [ */)) {
|
|
10093
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
10094
|
+
var result = this.regexp_classContents(state);
|
|
10095
|
+
if (state.eat(0x5D /* ] */)) {
|
|
10096
|
+
if (negate && result === CharSetString) {
|
|
10097
|
+
state.raise("Negated character class may contain strings");
|
|
10098
|
+
}
|
|
10099
|
+
return result
|
|
10100
|
+
}
|
|
10101
|
+
state.pos = start;
|
|
10102
|
+
}
|
|
10103
|
+
if (state.eat(0x5C /* \ */)) {
|
|
10104
|
+
var result$1 = this.regexp_eatCharacterClassEscape(state);
|
|
10105
|
+
if (result$1) {
|
|
10106
|
+
return result$1
|
|
10107
|
+
}
|
|
10108
|
+
state.pos = start;
|
|
10109
|
+
}
|
|
10110
|
+
return null
|
|
10111
|
+
};
|
|
10112
|
+
|
|
10113
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunction
|
|
10114
|
+
pp$1.regexp_eatClassStringDisjunction = function(state) {
|
|
10115
|
+
var start = state.pos;
|
|
10116
|
+
if (state.eatChars([0x5C, 0x71] /* \q */)) {
|
|
10117
|
+
if (state.eat(0x7B /* { */)) {
|
|
10118
|
+
var result = this.regexp_classStringDisjunctionContents(state);
|
|
10119
|
+
if (state.eat(0x7D /* } */)) {
|
|
10120
|
+
return result
|
|
10121
|
+
}
|
|
10122
|
+
} else {
|
|
10123
|
+
// Make the same message as V8.
|
|
10124
|
+
state.raise("Invalid escape");
|
|
10125
|
+
}
|
|
10126
|
+
state.pos = start;
|
|
10127
|
+
}
|
|
10128
|
+
return null
|
|
10129
|
+
};
|
|
10130
|
+
|
|
10131
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
|
|
10132
|
+
pp$1.regexp_classStringDisjunctionContents = function(state) {
|
|
10133
|
+
var result = this.regexp_classString(state);
|
|
10134
|
+
while (state.eat(0x7C /* | */)) {
|
|
10135
|
+
if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }
|
|
10136
|
+
}
|
|
10137
|
+
return result
|
|
10138
|
+
};
|
|
10139
|
+
|
|
10140
|
+
// https://tc39.es/ecma262/#prod-ClassString
|
|
10141
|
+
// https://tc39.es/ecma262/#prod-NonEmptyClassString
|
|
10142
|
+
pp$1.regexp_classString = function(state) {
|
|
10143
|
+
var count = 0;
|
|
10144
|
+
while (this.regexp_eatClassSetCharacter(state)) { count++; }
|
|
10145
|
+
return count === 1 ? CharSetOk : CharSetString
|
|
10146
|
+
};
|
|
10147
|
+
|
|
10148
|
+
// https://tc39.es/ecma262/#prod-ClassSetCharacter
|
|
10149
|
+
pp$1.regexp_eatClassSetCharacter = function(state) {
|
|
10150
|
+
var start = state.pos;
|
|
10151
|
+
if (state.eat(0x5C /* \ */)) {
|
|
10152
|
+
if (
|
|
10153
|
+
this.regexp_eatCharacterEscape(state) ||
|
|
10154
|
+
this.regexp_eatClassSetReservedPunctuator(state)
|
|
10155
|
+
) {
|
|
10156
|
+
return true
|
|
10157
|
+
}
|
|
10158
|
+
if (state.eat(0x62 /* b */)) {
|
|
10159
|
+
state.lastIntValue = 0x08; /* <BS> */
|
|
10160
|
+
return true
|
|
10161
|
+
}
|
|
10162
|
+
state.pos = start;
|
|
10163
|
+
return false
|
|
10164
|
+
}
|
|
10165
|
+
var ch = state.current();
|
|
10166
|
+
if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }
|
|
10167
|
+
if (isClassSetSyntaxCharacter(ch)) { return false }
|
|
10168
|
+
state.advance();
|
|
10169
|
+
state.lastIntValue = ch;
|
|
10170
|
+
return true
|
|
10171
|
+
};
|
|
10172
|
+
|
|
10173
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
|
|
10174
|
+
function isClassSetReservedDoublePunctuatorCharacter(ch) {
|
|
10175
|
+
return (
|
|
10176
|
+
ch === 0x21 /* ! */ ||
|
|
10177
|
+
ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||
|
|
10178
|
+
ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||
|
|
10179
|
+
ch === 0x2E /* . */ ||
|
|
10180
|
+
ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||
|
|
10181
|
+
ch === 0x5E /* ^ */ ||
|
|
10182
|
+
ch === 0x60 /* ` */ ||
|
|
10183
|
+
ch === 0x7E /* ~ */
|
|
10184
|
+
)
|
|
10185
|
+
}
|
|
10186
|
+
|
|
10187
|
+
// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
|
|
10188
|
+
function isClassSetSyntaxCharacter(ch) {
|
|
10189
|
+
return (
|
|
10190
|
+
ch === 0x28 /* ( */ ||
|
|
10191
|
+
ch === 0x29 /* ) */ ||
|
|
10192
|
+
ch === 0x2D /* - */ ||
|
|
10193
|
+
ch === 0x2F /* / */ ||
|
|
10194
|
+
ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||
|
|
10195
|
+
ch >= 0x7B /* { */ && ch <= 0x7D /* } */
|
|
10196
|
+
)
|
|
10197
|
+
}
|
|
10198
|
+
|
|
10199
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
10200
|
+
pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
|
|
10201
|
+
var ch = state.current();
|
|
10202
|
+
if (isClassSetReservedPunctuator(ch)) {
|
|
10203
|
+
state.lastIntValue = ch;
|
|
10204
|
+
state.advance();
|
|
10205
|
+
return true
|
|
10206
|
+
}
|
|
10207
|
+
return false
|
|
10208
|
+
};
|
|
10209
|
+
|
|
10210
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
10211
|
+
function isClassSetReservedPunctuator(ch) {
|
|
10212
|
+
return (
|
|
10213
|
+
ch === 0x21 /* ! */ ||
|
|
10214
|
+
ch === 0x23 /* # */ ||
|
|
10215
|
+
ch === 0x25 /* % */ ||
|
|
10216
|
+
ch === 0x26 /* & */ ||
|
|
10217
|
+
ch === 0x2C /* , */ ||
|
|
10218
|
+
ch === 0x2D /* - */ ||
|
|
10219
|
+
ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||
|
|
10220
|
+
ch === 0x40 /* @ */ ||
|
|
10221
|
+
ch === 0x60 /* ` */ ||
|
|
10222
|
+
ch === 0x7E /* ~ */
|
|
10223
|
+
)
|
|
10224
|
+
}
|
|
10225
|
+
|
|
9866
10226
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
9867
10227
|
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
9868
10228
|
var ch = state.current();
|
|
@@ -10783,8 +11143,23 @@ pp.readWord = function() {
|
|
|
10783
11143
|
};
|
|
10784
11144
|
|
|
10785
11145
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
11146
|
+
//
|
|
11147
|
+
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
|
|
11148
|
+
// various contributors and released under an MIT license.
|
|
11149
|
+
//
|
|
11150
|
+
// Git repositories for Acorn are available at
|
|
11151
|
+
//
|
|
11152
|
+
// http://marijnhaverbeke.nl/git/acorn
|
|
11153
|
+
// https://github.com/acornjs/acorn.git
|
|
11154
|
+
//
|
|
11155
|
+
// Please use the [github bug tracker][ghbt] to report issues.
|
|
11156
|
+
//
|
|
11157
|
+
// [ghbt]: https://github.com/acornjs/acorn/issues
|
|
11158
|
+
//
|
|
11159
|
+
// [walk]: util/walk.js
|
|
11160
|
+
|
|
10786
11161
|
|
|
10787
|
-
var version = "8.
|
|
11162
|
+
var version = "8.9.0";
|
|
10788
11163
|
|
|
10789
11164
|
Parser.acorn = {
|
|
10790
11165
|
Parser: Parser,
|
|
@@ -10821,6 +11196,7 @@ function parse(input, options) {
|
|
|
10821
11196
|
|
|
10822
11197
|
// AST walker module for Mozilla Parser API compatible trees
|
|
10823
11198
|
|
|
11199
|
+
|
|
10824
11200
|
// An ancestor walk keeps an array of ancestor nodes (including the
|
|
10825
11201
|
// current node) and passes them to the callback as third parameter
|
|
10826
11202
|
// (and also as state parameter when no other state is present).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2c2kit/build-helpers",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dist/index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@rollup/plugin-commonjs": "25.0.
|
|
13
|
+
"@rollup/plugin-commonjs": "25.0.2",
|
|
14
14
|
"@rollup/plugin-node-resolve": "15.1.0",
|
|
15
15
|
"@types/estree": "1.0.1",
|
|
16
16
|
"@types/findup-sync": "4.0.2",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"cpy-cli": "4.2.0",
|
|
19
19
|
"findup-sync": "5.0.0",
|
|
20
20
|
"rimraf": "5.0.1",
|
|
21
|
-
"rollup": "3.
|
|
21
|
+
"rollup": "3.25.1",
|
|
22
22
|
"rollup-plugin-copy": "^3.4.0",
|
|
23
23
|
"rollup-plugin-dts": "5.3.0",
|
|
24
24
|
"rollup-plugin-esbuild": "5.0.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"acorn": "8.
|
|
34
|
+
"acorn": "8.9.0",
|
|
35
35
|
"acorn-walk": "8.2.0",
|
|
36
36
|
"astring": "1.8.6",
|
|
37
37
|
"css-select": "5.1.0",
|