Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acorn-hammerhead

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acorn-hammerhead - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

LICENSE

205

lib/expression.js
"use strict";
var _tokentype = require("./tokentype");
var _tokentype = require("./tokentype.js");
var _state = require("./state");
var _state = require("./state.js");
var _parseutil = require("./parseutil");
var _parseutil = require("./parseutil.js");
var _whitespace = require("./whitespace");
var _whitespace = require("./whitespace.js");
var _scopeflags = require("./scopeflags");
var _scopeflags = require("./scopeflags.js");

@@ -56,5 +56,6 @@ const pp = _state.Parser.prototype;

if (propHash.proto) {
if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start;
// Backwards-compat kludge. Can be removed in version 6.0
else this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
if (refDestructuringErrors) {
if (refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start;
// Backwards-compat kludge. Can be removed in version 6.0
} else this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
}

@@ -126,9 +127,7 @@ propHash.proto = true;

oldParenAssign = -1,
oldTrailingComma = -1,
oldShorthandAssign = -1;
oldTrailingComma = -1;
if (refDestructuringErrors) {
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
oldTrailingComma = refDestructuringErrors.trailingComma;
oldShorthandAssign = refDestructuringErrors.shorthandAssign;
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.shorthandAssign = -1;
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
} else {

@@ -147,6 +146,9 @@ refDestructuringErrors = new _parseutil.DestructuringErrors();

node.operator = this.value;
node.left = this.type === _tokentype.types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left;
if (!ownDestructuringErrors) _parseutil.DestructuringErrors.call(refDestructuringErrors);
refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly
this.checkLVal(left);
if (this.type === _tokentype.types.eq) left = this.toAssignable(left, false, refDestructuringErrors);
if (!ownDestructuringErrors) {
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
}
if (refDestructuringErrors.shorthandAssign >= left.start) refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly
if (this.type === _tokentype.types.eq) this.checkLValPattern(left);else this.checkLValSimple(left);
node.left = left;
this.next();

@@ -160,3 +162,2 @@ node.right = this.parseMaybeAssign(noIn);

if (oldTrailingComma > -1) refDestructuringErrors.trailingComma = oldTrailingComma;
if (oldShorthandAssign > -1) refDestructuringErrors.shorthandAssign = oldShorthandAssign;
return left;

@@ -204,2 +205,8 @@ };

let logical = this.type === _tokentype.types.logicalOR || this.type === _tokentype.types.logicalAND;
let coalesce = this.type === _tokentype.types.coalesce;
if (coalesce) {
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
prec = _tokentype.types.logicalAND.binop;
}
let op = this.value;

@@ -210,3 +217,6 @@ this.next();

let right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
let node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical);
let node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
if (logical && this.type === _tokentype.types.coalesce || coalesce && (this.type === _tokentype.types.logicalOR || this.type === _tokentype.types.logicalAND)) {
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
}
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);

@@ -243,3 +253,3 @@ }

this.checkExpressionErrors(refDestructuringErrors, true);
if (update) this.checkLVal(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raiseRecoverable(node.start, "Deleting local variable in strict mode");else sawUnary = true;
if (update) this.checkLValSimple(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raiseRecoverable(node.start, "Deleting local variable in strict mode");else sawUnary = true;
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");

@@ -254,3 +264,3 @@ } else {

node.argument = expr;
this.checkLVal(expr);
this.checkLValSimple(expr);
this.next();

@@ -270,4 +280,3 @@ expr = this.finishNode(node, "UpdateExpression");

let expr = this.parseExprAtom(refDestructuringErrors);
let skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")";
if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr;
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return expr;
let result = this.parseSubscripts(expr, startPos, startLoc);

@@ -277,2 +286,3 @@ if (refDestructuringErrors && result.type === "MemberExpression") {

if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1;
if (refDestructuringErrors.trailingComma >= result.start) refDestructuringErrors.trailingComma = -1;
}

@@ -283,6 +293,18 @@ return result;

pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start;
let optionalChained = false;
while (true) {
let element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
if (element === base || element.type === "ArrowFunctionExpression") return element;
let element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained);
if (element.optional) optionalChained = true;
if (element === base || element.type === "ArrowFunctionExpression") {
if (optionalChained) {
const chainNode = this.startNodeAt(startPos, startLoc);
chainNode.expression = element;
element = this.finishNode(chainNode, "ChainExpression");
}
return element;
}
base = element;

@@ -292,10 +314,17 @@ }

pp.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow) {
pp.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained) {
let optionalSupported = this.options.ecmaVersion >= 11;
let optional = optionalSupported && this.eat(_tokentype.types.questionDot);
if (noCalls && optional) this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
let computed = this.eat(_tokentype.types.bracketL);
if (computed || this.eat(_tokentype.types.dot)) {
if (computed || optional && this.type !== _tokentype.types.parenL && this.type !== _tokentype.types.backQuote || this.eat(_tokentype.types.dot)) {
let node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = computed ? this.parseExpression() : this.parseIdent(true);
node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never");
node.computed = !!computed;
if (computed) this.expect(_tokentype.types.bracketR);
if (optionalSupported) {
node.optional = optional;
}
base = this.finishNode(node, "MemberExpression");

@@ -310,4 +339,4 @@ } else if (!noCalls && this.eat(_tokentype.types.parenL)) {

this.awaitIdentPos = 0;
let exprList = this.parseExprList(_tokentype.types.parenR, this.options.ecmaVersion >= 8 && base.type !== "Import", false, refDestructuringErrors);
if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(_tokentype.types.arrow)) {
let exprList = this.parseExprList(_tokentype.types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(_tokentype.types.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);

@@ -328,14 +357,10 @@ this.checkYieldAwaitInDefaultParams();

node.arguments = exprList;
if (node.callee.type === "Import") {
if (node.arguments.length !== 1) {
this.raise(node.start, "import() requires exactly one argument");
}
const importArg = node.arguments[0];
if (importArg && importArg.type === "SpreadElement") {
this.raise(importArg.start, "... is not allowed in import()");
}
if (optionalSupported) {
node.optional = optional;
}
base = this.finishNode(node, "CallExpression");
} else if (this.type === _tokentype.types.backQuote) {
if (optional || optionalChained) {
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
}
let node = this.startNodeAt(startPos, startLoc);

@@ -372,3 +397,3 @@ node.tag = base;

// SuperCall:
// super Arguments
// super ( Arguments )
if (this.type !== _tokentype.types.dot && this.type !== _tokentype.types.bracketL && this.type !== _tokentype.types.parenL) this.unexpected();

@@ -447,4 +472,4 @@ return this.finishNode(node, "Super");

case _tokentype.types._import:
if (this.options.ecmaVersion > 10) {
return this.parseDynamicImport();
if (this.options.ecmaVersion >= 11) {
return this.parseExprImport();
} else {

@@ -459,11 +484,53 @@ return this.unexpected();

pp.parseDynamicImport = function () {
pp.parseExprImport = function () {
const node = this.startNode();
this.next();
if (this.type !== _tokentype.types.parenL) {
this.unexpected();
// Consume `import` as an identifier for `import.meta`.
// Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword import");
const meta = this.parseIdent(true);
switch (this.type) {
case _tokentype.types.parenL:
return this.parseDynamicImport(node);
case _tokentype.types.dot:
node.meta = meta;
return this.parseImportMeta(node);
default:
this.unexpected();
}
return this.finishNode(node, "Import");
};
pp.parseDynamicImport = function (node) {
this.next(); // skip `(`
// Parse node.source.
node.source = this.parseMaybeAssign();
// Verify ending.
if (!this.eat(_tokentype.types.parenR)) {
const errorPos = this.start;
if (this.eat(_tokentype.types.comma) && this.eat(_tokentype.types.parenR)) {
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
} else {
this.unexpected(errorPos);
}
}
return this.finishNode(node, "ImportExpression");
};
pp.parseImportMeta = function (node) {
this.next(); // skip `.`
const containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
if (node.property.name !== "meta") this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
if (containsEsc) this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module");
return this.finishNode(node, "MetaProperty");
};
pp.parseLiteral = function (value) {

@@ -473,3 +540,3 @@ let node = this.startNode();

node.raw = this.input.slice(this.start, this.end);
if (node.raw.charCodeAt(node.raw.length - 1) === 110) node.bigint = node.raw.slice(0, -1);
if (node.raw.charCodeAt(node.raw.length - 1) === 110) node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
this.next();

@@ -575,2 +642,3 @@ return this.finishNode(node, "Literal");

pp.parseNew = function () {
if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword new");
let node = this.startNode();

@@ -582,13 +650,15 @@ let meta = this.parseIdent(true);

node.property = this.parseIdent(true);
if (node.property.name !== "target" || containsEsc) this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target");
if (!this.inNonArrowFunction()) this.raiseRecoverable(node.start, "new.target can only be used in functions");
if (node.property.name !== "target") this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
if (containsEsc) this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
if (!this.inNonArrowFunction) this.raiseRecoverable(node.start, "'new.target' can only be used in functions");
return this.finishNode(node, "MetaProperty");
}
let startPos = this.start,
startLoc = this.startLoc;
startLoc = this.startLoc,
isImport = this.type === _tokentype.types._import;
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
if (this.options.ecmaVersion > 10 && node.callee.type === "Import") {
this.raise(node.callee.start, "Cannot use new with import(...)");
if (isImport && node.callee.type === "ImportExpression") {
this.raise(startPos, "Cannot use new with import()");
}
if (this.eat(_tokentype.types.parenL)) node.arguments = this.parseExprList(_tokentype.types.parenR, this.options.ecmaVersion >= 8 && node.callee.type !== "Import", false);else node.arguments = empty;
if (this.eat(_tokentype.types.parenL)) node.arguments = this.parseExprList(_tokentype.types.parenR, this.options.ecmaVersion >= 8, false);else node.arguments = empty;
return this.finishNode(node, "NewExpression");

@@ -652,3 +722,3 @@ };

this.expect(_tokentype.types.comma);
if (this.afterTrailingComma(_tokentype.types.braceR)) break;
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(_tokentype.types.braceR)) break;
} else first = false;

@@ -728,3 +798,3 @@

prop.value = this.parseMethod(isGenerator, isAsync);
} else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && this.type !== _tokentype.types.comma && this.type !== _tokentype.types.braceR) {
} else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && this.type !== _tokentype.types.comma && this.type !== _tokentype.types.braceR && this.type !== _tokentype.types.eq) {
if (isGenerator || isAsync) this.unexpected();

@@ -747,8 +817,8 @@ prop.kind = prop.key.name;

if (isPattern) {
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
} else if (this.type === _tokentype.types.eq && refDestructuringErrors) {
if (refDestructuringErrors.shorthandAssign < 0) refDestructuringErrors.shorthandAssign = this.start;
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
} else {
prop.value = prop.key;
prop.value = this.copyNode(prop.key);
}

@@ -770,3 +840,3 @@ prop.shorthand = true;

}
return prop.key = this.type === _tokentype.types.num || this.type === _tokentype.types.string ? this.parseExprAtom() : this.parseIdent(true);
return prop.key = this.type === _tokentype.types.num || this.type === _tokentype.types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
};

@@ -863,3 +933,5 @@

this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
node.body = this.parseBlock(false);
// Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
if (this.strict && node.id) this.checkLValSimple(node.id, _scopeflags.BIND_OUTSIDE);
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
node.expression = false;

@@ -870,6 +942,2 @@ this.adaptDirectivePrologue(node.body.body);

this.exitScope();
// Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
if (this.strict && node.id) this.checkLVal(node.id, _scopeflags.BIND_OUTSIDE);
this.strict = oldStrict;
};

@@ -900,3 +968,3 @@

pp.checkParams = function (node, allowDuplicates) {
let nameHash = {};
let nameHash = Object.create(null);
for (var _iterator2 = node.params, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {

@@ -916,3 +984,3 @@ var _ref2;

this.checkLVal(param, _scopeflags.BIND_VAR, allowDuplicates ? null : nameHash);
this.checkLValInnerPattern(param, _scopeflags.BIND_VAR, allowDuplicates ? null : nameHash);
}

@@ -966,3 +1034,2 @@ };

let node = this.startNode();
if (liberal && this.options.allowReserved === "never") liberal = false;
if (this.type === _tokentype.types.name) {

@@ -983,3 +1050,3 @@ node.name = this.value;

}
this.next();
this.next(!!liberal);
this.finishNode(node, "Identifier");

@@ -986,0 +1053,0 @@ if (!liberal) {

@@ -21,2 +21,3 @@ "use strict";

5: ecma5AndLessKeywords,
"5module": ecma5AndLessKeywords + " export import",
6: ecma5AndLessKeywords + " const class extends export import super"

@@ -34,4 +35,4 @@ };

// Generated by `bin/generate-identifier-regex.js`.
let 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\u08a0-\u08b4\u08b6-\u08bd\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\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\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-\u170c\u170e-\u1711\u1720-\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-\u1b4b\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-\u2c2e\u2c30-\u2c5e\u2c60-\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-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\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-\uab67\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";
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
let 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\u08a0-\u08b4\u08b6-\u08c7\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\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\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-\u170c\u170e-\u1711\u1720-\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-\u1b4b\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-\u2c2e\u2c30-\u2c5e\u2c60-\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-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\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";
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";

@@ -50,6 +51,6 @@ const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");

// eslint-disable-next-line comma-spacing
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 477, 28, 11, 0, 9, 21, 155, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 12, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 0, 33, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 0, 161, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 270, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 754, 9486, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541];
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
// eslint-disable-next-line comma-spacing
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 525, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 232, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 792487, 239];
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];

@@ -56,0 +57,0 @@ // This has a complexity linear to the value of the code. The

"use strict";
exports.__esModule = true;
exports.version = exports.nonASCIIwhitespace = exports.lineBreakG = exports.lineBreak = exports.isNewLine = exports.Token = exports.isIdentifierStart = exports.isIdentifierChar = exports.tokContexts = exports.TokContext = exports.keywordTypes = exports.tokTypes = exports.TokenType = exports.Node = exports.getLineInfo = exports.SourceLocation = exports.Position = exports.defaultOptions = exports.Parser = undefined;
exports.nonASCIIwhitespace = exports.lineBreakG = exports.lineBreak = exports.isNewLine = exports.Token = exports.isIdentifierStart = exports.isIdentifierChar = exports.tokContexts = exports.TokContext = exports.keywordTypes = exports.tokTypes = exports.TokenType = exports.Node = exports.getLineInfo = exports.SourceLocation = exports.Position = exports.defaultOptions = exports.Parser = exports.version = undefined;
exports.parse = parse;
exports.parseExpressionAt = parseExpressionAt;
exports.tokenizer = tokenizer;
var _state = require("./state");
var _state = require("./state.js");
Object.defineProperty(exports, "Parser", {
enumerable: true,
get: function get() {
return _state.Parser;
}
});
require("./parseutil.js");
var _options = require("./options");
require("./statement.js");
Object.defineProperty(exports, "defaultOptions", {
enumerable: true,
get: function get() {
return _options.defaultOptions;
}
});
require("./lval.js");
var _locutil = require("./locutil");
require("./expression.js");
Object.defineProperty(exports, "Position", {
enumerable: true,
get: function get() {
return _locutil.Position;
}
});
Object.defineProperty(exports, "SourceLocation", {
enumerable: true,
get: function get() {
return _locutil.SourceLocation;
}
});
Object.defineProperty(exports, "getLineInfo", {
enumerable: true,
get: function get() {
return _locutil.getLineInfo;
}
});
require("./location.js");
var _node = require("./node");
require("./scope.js");
Object.defineProperty(exports, "Node", {
enumerable: true,
get: function get() {
return _node.Node;
}
});
var _options = require("./options.js");
var _tokentype = require("./tokentype");
var _locutil = require("./locutil.js");
Object.defineProperty(exports, "TokenType", {
enumerable: true,
get: function get() {
return _tokentype.TokenType;
}
});
Object.defineProperty(exports, "tokTypes", {
enumerable: true,
get: function get() {
return _tokentype.types;
}
});
Object.defineProperty(exports, "keywordTypes", {
enumerable: true,
get: function get() {
return _tokentype.keywords;
}
});
var _node = require("./node.js");
var _tokencontext = require("./tokencontext");
var _tokentype = require("./tokentype.js");
Object.defineProperty(exports, "TokContext", {
enumerable: true,
get: function get() {
return _tokencontext.TokContext;
}
});
Object.defineProperty(exports, "tokContexts", {
enumerable: true,
get: function get() {
return _tokencontext.types;
}
});
var _tokencontext = require("./tokencontext.js");
var _identifier = require("./identifier");
var _identifier = require("./identifier.js");
Object.defineProperty(exports, "isIdentifierChar", {
enumerable: true,
get: function get() {
return _identifier.isIdentifierChar;
}
});
Object.defineProperty(exports, "isIdentifierStart", {
enumerable: true,
get: function get() {
return _identifier.isIdentifierStart;
}
});
var _tokenize = require("./tokenize.js");
var _tokenize = require("./tokenize");
var _whitespace = require("./whitespace.js");
Object.defineProperty(exports, "Token", {
enumerable: true,
get: function get() {
return _tokenize.Token;
}
});
const version = exports.version = "8.1.0"; // Acorn is a tiny, fast JavaScript parser written in JavaScript.
//
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
// various contributors and released under an MIT license.
//
// Git repositories for Acorn are available at
//
// http://marijnhaverbeke.nl/git/acorn
// https://github.com/acornjs/acorn.git
//
// Please use the [github bug tracker][ghbt] to report issues.
//
// [ghbt]: https://github.com/acornjs/acorn/issues
//
// [walk]: util/walk.js
var _whitespace = require("./whitespace");
exports.Parser = _state.Parser;
exports.defaultOptions = _options.defaultOptions;
exports.Position = _locutil.Position;
exports.SourceLocation = _locutil.SourceLocation;
exports.getLineInfo = _locutil.getLineInfo;
exports.Node = _node.Node;
exports.TokenType = _tokentype.TokenType;
exports.tokTypes = _tokentype.types;
exports.keywordTypes = _tokentype.keywords;
exports.TokContext = _tokencontext.TokContext;
exports.tokContexts = _tokencontext.types;
exports.isIdentifierChar = _identifier.isIdentifierChar;
exports.isIdentifierStart = _identifier.isIdentifierStart;
exports.Token = _tokenize.Token;
exports.isNewLine = _whitespace.isNewLine;
exports.lineBreak = _whitespace.lineBreak;
exports.lineBreakG = _whitespace.lineBreakG;
exports.nonASCIIwhitespace = _whitespace.nonASCIIwhitespace;
Object.defineProperty(exports, "isNewLine", {
enumerable: true,
get: function get() {
return _whitespace.isNewLine;
}
});
Object.defineProperty(exports, "lineBreak", {
enumerable: true,
get: function get() {
return _whitespace.lineBreak;
}
});
Object.defineProperty(exports, "lineBreakG", {
enumerable: true,
get: function get() {
return _whitespace.lineBreakG;
}
});
Object.defineProperty(exports, "nonASCIIwhitespace", {
enumerable: true,
get: function get() {
return _whitespace.nonASCIIwhitespace;
}
});
exports.parse = parse;
exports.parseExpressionAt = parseExpressionAt;
exports.tokenizer = tokenizer;
require("./parseutil");
_state.Parser.acorn = {
Parser: _state.Parser,
version,
defaultOptions: _options.defaultOptions,
Position: _locutil.Position,
SourceLocation: _locutil.SourceLocation,
getLineInfo: _locutil.getLineInfo,
Node: _node.Node,
TokenType: _tokentype.TokenType,
tokTypes: _tokentype.types,
keywordTypes: _tokentype.keywords,
TokContext: _tokencontext.TokContext,
tokContexts: _tokencontext.types,
isIdentifierChar: _identifier.isIdentifierChar,
isIdentifierStart: _identifier.isIdentifierStart,
Token: _tokenize.Token,
isNewLine: _whitespace.isNewLine,
lineBreak: _whitespace.lineBreak,
lineBreakG: _whitespace.lineBreakG,
nonASCIIwhitespace: _whitespace.nonASCIIwhitespace
require("./statement");
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
// returns an abstract syntax tree as specified by [Mozilla parser
// API][api].
//
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
require("./lval");
require("./expression");
require("./location");
require("./scope");
const version = exports.version = "6.2.1";
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
// returns an abstract syntax tree as specified by [Mozilla parser
// API][api].
//
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
function parse(input, options) {
};function parse(input, options) {
return _state.Parser.parse(input, options);

@@ -167,0 +105,0 @@ }

"use strict";
var _state = require("./state");
var _state = require("./state.js");
var _locutil = require("./locutil");
var _locutil = require("./locutil.js");

@@ -7,0 +7,0 @@ const pp = _state.Parser.prototype;

@@ -7,3 +7,3 @@ "use strict";

var _whitespace = require("./whitespace");
var _whitespace = require("./whitespace.js");

@@ -10,0 +10,0 @@ // These are used when `options.locations` is on, for the

"use strict";
var _tokentype = require("./tokentype");
var _tokentype = require("./tokentype.js");
var _state = require("./state");
var _state = require("./state.js");
var _util = require("./util");
var _util = require("./util.js");
var _scopeflags = require("./scopeflags");
var _scopeflags = require("./scopeflags.js");

@@ -25,2 +25,3 @@ const pp = _state.Parser.prototype;

case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":

@@ -81,5 +82,2 @@ break;

this.toAssignable(node.left, isBinding);
// falls through to AssignmentPattern
case "AssignmentPattern":
break;

@@ -91,2 +89,6 @@

case "ChainExpression":
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":

@@ -196,25 +198,101 @@ if (!isBinding) break;

// Verify that a node is an lval — something that can be assigned
// to.
// bindingType can be either:
// 'var' indicating that the lval creates a 'var' binding
// 'let' indicating that the lval creates a lexical ('let' or 'const') binding
// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references
// The following three functions all verify that a node is an lvalue —
// something that can be bound, or assigned to. In order to do so, they perform
// a variety of checks:
//
// - Check that none of the bound/assigned-to identifiers are reserved words.
// - Record name declarations for bindings in the appropriate scope.
// - Check duplicate argument names, if checkClashes is set.
//
// If a complex binding pattern is encountered (e.g., object and array
// destructuring), the entire pattern is recursively checked.
//
// There are three versions of checkLVal*() appropriate for different
// circumstances:
//
// - checkLValSimple() shall be used if the syntactic construct supports
// nothing other than identifiers and member expressions. Parenthesized
// expressions are also correctly handled. This is generally appropriate for
// constructs for which the spec says
//
// > It is a Syntax Error if AssignmentTargetType of [the production] is not
// > simple.
//
// It is also appropriate for checking if an identifier is valid and not
// defined elsewhere, like import declarations or function/class identifiers.
//
// Examples where this is used include:
// a += …;
// import a from '…';
// where a is the node to be checked.
//
// - checkLValPattern() shall be used if the syntactic construct supports
// anything checkLValSimple() supports, as well as object and array
// destructuring patterns. This is generally appropriate for constructs for
// which the spec says
//
// > It is a Syntax Error if [the production] is neither an ObjectLiteral nor
// > an ArrayLiteral and AssignmentTargetType of [the production] is not
// > simple.
//
// Examples where this is used include:
// (a = …);
// const a = …;
// try { … } catch (a) { … }
// where a is the node to be checked.
//
// - checkLValInnerPattern() shall be used if the syntactic construct supports
// anything checkLValPattern() supports, as well as default assignment
// patterns, rest elements, and other constructs that may appear within an
// object or array destructuring pattern.
//
// As a special case, function parameters also use checkLValInnerPattern(),
// as they also support defaults and rest constructs.
//
// These functions deliberately support both assignment and binding constructs,
// as the logic for both is exceedingly similar. If the node is the target of
// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it
// should be set to the appropriate BIND_* constant, like BIND_VAR or
// BIND_LEXICAL.
//
// If the function is called with a non-BIND_NONE bindingType, then
// additionally a checkClashes object may be specified to allow checking for
// duplicate argument names. checkClashes is ignored if the provided construct
// is an assignment (i.e., bindingType is BIND_NONE).
pp.checkLVal = function (expr, bindingType = _scopeflags.BIND_NONE, checkClashes) {
pp.checkLValSimple = function (expr, bindingType = _scopeflags.BIND_NONE, checkClashes) {
const isBind = bindingType !== _scopeflags.BIND_NONE;
switch (expr.type) {
case "Identifier":
if (bindingType === _scopeflags.BIND_LEXICAL && expr.name === "let") this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name");
if (this.strict && this.reservedWordsStrictBind.test(expr.name)) this.raiseRecoverable(expr.start, (bindingType ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
if (checkClashes) {
if ((0, _util.has)(checkClashes, expr.name)) this.raiseRecoverable(expr.start, "Argument name clash");
checkClashes[expr.name] = true;
if (this.strict && this.reservedWordsStrictBind.test(expr.name)) this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
if (isBind) {
if (bindingType === _scopeflags.BIND_LEXICAL && expr.name === "let") this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name");
if (checkClashes) {
if ((0, _util.has)(checkClashes, expr.name)) this.raiseRecoverable(expr.start, "Argument name clash");
checkClashes[expr.name] = true;
}
if (bindingType !== _scopeflags.BIND_OUTSIDE) this.declareName(expr.name, bindingType, expr.start);
}
if (bindingType !== _scopeflags.BIND_NONE && bindingType !== _scopeflags.BIND_OUTSIDE) this.declareName(expr.name, bindingType, expr.start);
break;
case "ChainExpression":
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
if (bindingType) this.raiseRecoverable(expr.start, "Binding member expression");
if (isBind) this.raiseRecoverable(expr.start, "Binding member expression");
break;
case "ParenthesizedExpression":
if (isBind) this.raiseRecoverable(expr.start, "Binding parenthesized expression");
return this.checkLValSimple(expr.expression, bindingType, checkClashes);
default:
this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
}
};
pp.checkLValPattern = function (expr, bindingType = _scopeflags.BIND_NONE, checkClashes) {
switch (expr.type) {
case "ObjectPattern":

@@ -235,8 +313,4 @@ for (var _iterator2 = expr.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {

this.checkLVal(prop, bindingType, checkClashes);
}break;
case "Property":
// AssignmentProperty has type === "Property"
this.checkLVal(expr.value, bindingType, checkClashes);
this.checkLValInnerPattern(prop, bindingType, checkClashes);
}
break;

@@ -259,21 +333,29 @@

if (elem) this.checkLVal(elem, bindingType, checkClashes);
if (elem) this.checkLValInnerPattern(elem, bindingType, checkClashes);
}
break;
default:
this.checkLValSimple(expr, bindingType, checkClashes);
}
};
pp.checkLValInnerPattern = function (expr, bindingType = _scopeflags.BIND_NONE, checkClashes) {
switch (expr.type) {
case "Property":
// AssignmentProperty has type === "Property"
this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
break;
case "AssignmentPattern":
this.checkLVal(expr.left, bindingType, checkClashes);
this.checkLValPattern(expr.left, bindingType, checkClashes);
break;
case "RestElement":
this.checkLVal(expr.argument, bindingType, checkClashes);
this.checkLValPattern(expr.argument, bindingType, checkClashes);
break;
case "ParenthesizedExpression":
this.checkLVal(expr.expression, bindingType, checkClashes);
break;
default:
this.raise(expr.start, (bindingType ? "Binding" : "Assigning to") + " rvalue");
this.checkLValPattern(expr, bindingType, checkClashes);
}
};

@@ -6,5 +6,5 @@ "use strict";

var _state = require("./state");
var _state = require("./state.js");
var _locutil = require("./locutil");
var _locutil = require("./locutil.js");

@@ -52,2 +52,8 @@ class Node {

return finishNodeAt.call(this, node, type, pos, loc);
};
pp.copyNode = function (node) {
let newNode = new Node(this, node.start, this.startLoc);
for (let prop in node) newNode[prop] = node[prop];
return newNode;
};

@@ -7,16 +7,16 @@ "use strict";

var _util = require("./util");
var _util = require("./util.js");
var _locutil = require("./locutil");
var _locutil = require("./locutil.js");
// A second optional argument can be given to further configure
// the parser process. These options are recognized:
// A second argument must be given to configure the parser process.
// These options are recognized (only `ecmaVersion` is required):
const defaultOptions = exports.defaultOptions = {
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
// either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10
// (2019). This influences support for strict mode, the set of
// reserved words, and support for new syntax features. The default
// is 9.
ecmaVersion: 9,
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
// (2019), 11 (2020), 12 (2021), or `"latest"` (the latest version
// the library supports). This influences support for strict mode,
// the set of reserved words, and support for new syntax features.
ecmaVersion: null,
// `sourceType` indicates the mode the code should be parsed in.

@@ -44,3 +44,4 @@ // Can be either `"script"` or `"module"`. This influences global

// When enabled, import/export statements are not constrained to
// appearing at the top of the program.
// appearing at the top of the program, and an import.meta expression
// in a script isn't considered an error.
allowImportExportEverywhere: false,

@@ -102,3 +103,5 @@ // When enabled, await identifiers are allowed to appear at the top-level scope,

};function getOptions(opts) {
};let warnedAboutEcmaVersion = false;
function getOptions(opts) {
let options = {};

@@ -108,3 +111,13 @@

if (options.ecmaVersion >= 2015) options.ecmaVersion -= 2009;
if (options.ecmaVersion === "latest") {
options.ecmaVersion = 1e8;
} else if (options.ecmaVersion == null) {
if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
warnedAboutEcmaVersion = true;
console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
}
options.ecmaVersion = 11;
} else if (options.ecmaVersion >= 2015) {
options.ecmaVersion -= 2009;
}

@@ -111,0 +124,0 @@ if (options.allowReserved == null) options.allowReserved = options.ecmaVersion < 5;

@@ -6,7 +6,7 @@ "use strict";

var _tokentype = require("./tokentype");
var _tokentype = require("./tokentype.js");
var _state = require("./state");
var _state = require("./state.js");
var _whitespace = require("./whitespace");
var _whitespace = require("./whitespace.js");

@@ -17,3 +17,3 @@ const pp = _state.Parser.prototype;

const literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/;
const literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
pp.strictDirective = function (start) {

@@ -20,0 +20,0 @@ for (;;) {

@@ -24,3 +24,3 @@ "use strict";

this.validFlags = `gim${parser.options.ecmaVersion >= 6 ? "uy" : ""}${parser.options.ecmaVersion >= 9 ? "s" : ""}`;
this.unicodeProperties = _unicodePropertyData2.default[parser.options.ecmaVersion >= 11 ? 11 : parser.options.ecmaVersion];
this.unicodeProperties = _unicodePropertyData2.default[parser.options.ecmaVersion >= 12 ? 12 : parser.options.ecmaVersion];
this.source = "";

@@ -56,3 +56,3 @@ this.flags = "";

// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
at(i) {
at(i, forceU = false) {
const s = this.source;

@@ -64,9 +64,10 @@ const l = s.length;

const c = s.charCodeAt(i);
if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
return c;
}
return (c << 10) + s.charCodeAt(i + 1) - 0x35FDC00;
const next = s.charCodeAt(i + 1);
return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c;
}
nextIndex(i) {
nextIndex(i, forceU = false) {
const s = this.source;

@@ -77,4 +78,5 @@ const l = s.length;

}
const c = s.charCodeAt(i);
if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
let c = s.charCodeAt(i),
next;
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
return i + 1;

@@ -85,17 +87,17 @@ }

current() {
return this.at(this.pos);
current(forceU = false) {
return this.at(this.pos, forceU);
}
lookahead() {
return this.at(this.nextIndex(this.pos));
lookahead(forceU = false) {
return this.at(this.nextIndex(this.pos, forceU), forceU);
}
advance() {
this.pos = this.nextIndex(this.pos);
advance(forceU = false) {
this.pos = this.nextIndex(this.pos, forceU);
}
eat(ch) {
if (this.current() === ch) {
this.advance();
eat(ch, forceU = false) {
if (this.current(forceU) === ch) {
this.advance(forceU);
return true;

@@ -173,3 +175,3 @@ }

}
if (state.eat(0x5D /* [ */) || state.eat(0x7D /* } */)) {
if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
state.raise("Lone quantifier brackets");

@@ -417,5 +419,5 @@ }

// GroupSpecifier[U] ::
// GroupSpecifier ::
// [empty]
// `?` GroupName[?U]
// `?` GroupName
pp.regexp_groupSpecifier = function (state) {

@@ -434,4 +436,4 @@ if (state.eat(0x3F /* ? */)) {

// GroupName[U] ::
// `<` RegExpIdentifierName[?U] `>`
// GroupName ::
// `<` RegExpIdentifierName `>`
// Note: this updates `state.lastStringValue` property with the eaten name.

@@ -449,5 +451,5 @@ pp.regexp_eatGroupName = function (state) {

// RegExpIdentifierName[U] ::
// RegExpIdentifierStart[?U]
// RegExpIdentifierName[?U] RegExpIdentifierPart[?U]
// RegExpIdentifierName ::
// RegExpIdentifierStart
// RegExpIdentifierName RegExpIdentifierPart
// Note: this updates `state.lastStringValue` property with the eaten name.

@@ -466,13 +468,14 @@ pp.regexp_eatRegExpIdentifierName = function (state) {

// RegExpIdentifierStart[U] ::
// RegExpIdentifierStart ::
// UnicodeIDStart
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[?U]
// `\` RegExpUnicodeEscapeSequence[+U]
pp.regexp_eatRegExpIdentifierStart = function (state) {
const start = state.pos;
let ch = state.current();
state.advance();
const forceU = this.options.ecmaVersion >= 11;
let ch = state.current(forceU);
state.advance(forceU);
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
ch = state.lastIntValue;

@@ -492,7 +495,7 @@ }

// RegExpIdentifierPart[U] ::
// RegExpIdentifierPart ::
// UnicodeIDContinue
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[?U]
// `\` RegExpUnicodeEscapeSequence[+U]
// <ZWNJ>

@@ -502,6 +505,7 @@ // <ZWJ>

const start = state.pos;
let ch = state.current();
state.advance();
const forceU = this.options.ecmaVersion >= 11;
let ch = state.current(forceU);
state.advance(forceU);
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
ch = state.lastIntValue;

@@ -566,3 +570,3 @@ }

pp.regexp_eatCharacterEscape = function (state) {
return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state);
return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state);
};

@@ -634,4 +638,5 @@ pp.regexp_eatCControlLetter = function (state) {

// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
pp.regexp_eatRegExpUnicodeEscapeSequence = function (state) {
pp.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU = false) {
const start = state.pos;
const switchU = forceU || state.switchU;

@@ -641,3 +646,3 @@ if (state.eat(0x75 /* u */)) {

const lead = state.lastIntValue;
if (state.switchU && lead >= 0xD800 && lead <= 0xDBFF) {
if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
const leadSurrogateEnd = state.pos;

@@ -656,6 +661,6 @@ if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {

}
if (state.switchU && state.eat(0x7B /* { */) && this.regexp_eatHexDigits(state) && state.eat(0x7D /* } */) && isValidUnicode(state.lastIntValue)) {
if (switchU && state.eat(0x7B /* { */) && this.regexp_eatHexDigits(state) && state.eat(0x7D /* } */) && isValidUnicode(state.lastIntValue)) {
return true;
}
if (state.switchU) {
if (switchU) {
state.raise("Invalid unicode escape");

@@ -809,3 +814,3 @@ }

this.regexp_classRanges(state);
if (state.eat(0x5D /* [ */)) {
if (state.eat(0x5D /* ] */)) {
return true;

@@ -858,3 +863,3 @@ }

const ch = state.current();
if (ch !== 0x5D /* [ */) {
if (ch !== 0x5D /* ] */) {
state.lastIntValue = ch;

@@ -861,0 +866,0 @@ state.advance();

"use strict";
var _state = require("./state");
var _state = require("./state.js");
var _scopeflags = require("./scopeflags");
var _scopeflags = require("./scopeflags.js");

@@ -7,0 +7,0 @@ const pp = _state.Parser.prototype;

@@ -20,3 +20,3 @@ "use strict";

// Used in checkLVal and declareName to determine the type of a binding
// Used in checkLVal* and declareName to determine the type of a binding
const BIND_NONE = exports.BIND_NONE = 0,

@@ -23,0 +23,0 @@ // Not a binding

@@ -6,13 +6,13 @@ "use strict";

var _identifier = require("./identifier");
var _identifier = require("./identifier.js");
var _tokentype = require("./tokentype");
var _tokentype = require("./tokentype.js");
var _whitespace = require("./whitespace");
var _whitespace = require("./whitespace.js");
var _options = require("./options");
var _options = require("./options.js");
var _util = require("./util");
var _util = require("./util.js");
var _scopeflags = require("./scopeflags");
var _scopeflags = require("./scopeflags.js");

@@ -23,6 +23,6 @@ class Parser {

this.sourceFile = options.sourceFile;
this.keywords = (0, _util.wordsRegexp)(_identifier.keywords[options.ecmaVersion >= 6 ? 6 : 5]);
this.keywords = (0, _util.wordsRegexp)(_identifier.keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
let reserved = "";
if (options.allowReserved !== true) {
for (let v = options.ecmaVersion;; v--) if (reserved = _identifier.reservedWords[v]) break;
reserved = _identifier.reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
if (options.sourceType === "module") reserved += " await";

@@ -86,3 +86,3 @@ }

// Thus-far undefined exports.
this.undefinedExports = {};
this.undefinedExports = Object.create(null);

@@ -124,5 +124,3 @@ // If enabled, skip leading hashbang line.

}
// Switch to a getter for 7.0.0.
inNonArrowFunction() {
get inNonArrowFunction() {
return (this.currentThisScope().flags & _scopeflags.SCOPE_FUNCTION) > 0;

@@ -129,0 +127,0 @@ }

"use strict";
var _tokentype = require("./tokentype");
var _tokentype = require("./tokentype.js");
var _state = require("./state");
var _state = require("./state.js");
var _whitespace = require("./whitespace");
var _whitespace = require("./whitespace.js");
var _identifier = require("./identifier");
var _identifier = require("./identifier.js");
var _util = require("./util");
var _util = require("./util.js");
var _parseutil = require("./parseutil");
var _parseutil = require("./parseutil.js");
var _scopeflags = require("./scopeflags");
var _scopeflags = require("./scopeflags.js");

@@ -27,3 +27,3 @@ const pp = _state.Parser.prototype;

pp.parseTopLevel = function (node) {
let exports = {};
let exports = Object.create(null);
if (!node.body) node.body = [];

@@ -53,5 +53,3 @@ while (this.type !== _tokentype.types.eof) {

this.next();
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType;
}
node.sourceType = this.options.sourceType;
return this.finishNode(node, "Program");

@@ -166,3 +164,3 @@ };

nextCh = this.input.charCodeAt(next);
if (nextCh === 40) // '('
if (nextCh === 40 || nextCh === 46) // '(' or '.'
return this.parseExpressionStatement(node, this.parseExpression());

@@ -279,3 +277,3 @@ }

this.toAssignable(init, false, refDestructuringErrors);
this.checkLVal(init);
this.checkLValPattern(init);
return this.parseForIn(node, init);

@@ -380,3 +378,3 @@ } else {

this.enterScope(simple ? _scopeflags.SCOPE_SIMPLE_CATCH : 0);
this.checkLVal(clause.param, simple ? _scopeflags.BIND_SIMPLE_CATCH : _scopeflags.BIND_LEXICAL);
this.checkLValPattern(clause.param, simple ? _scopeflags.BIND_SIMPLE_CATCH : _scopeflags.BIND_LEXICAL);
this.expect(_tokentype.types.parenR);

@@ -468,10 +466,12 @@ } else {

pp.parseBlock = function (createNewLexicalScope = true, node = this.startNode()) {
pp.parseBlock = function (createNewLexicalScope = true, node = this.startNode(), exitStrict) {
node.body = [];
this.expect(_tokentype.types.braceL);
if (createNewLexicalScope) this.enterScope(0);
while (!this.eat(_tokentype.types.braceR)) {
while (this.type !== _tokentype.types.braceR) {
let stmt = this.parseStatement(null);
node.body.push(stmt);
}
if (exitStrict) this.strict = false;
this.next();
if (createNewLexicalScope) this.exitScope();

@@ -507,4 +507,2 @@ return this.finishNode(node, "BlockStatement");

this.raise(init.start, `${isForIn ? "for-in" : "for-of"} loop variable declaration may not have an initializer`);
} else if (init.type === "AssignmentPattern") {
this.raise(init.start, "Invalid left-hand side in for-loop");
}

@@ -545,3 +543,3 @@ node.left = init;

decl.id = this.parseBindingAtom();
this.checkLVal(decl.id, kind === "var" ? _scopeflags.BIND_VAR : _scopeflags.BIND_LEXICAL, false);
this.checkLValPattern(decl.id, kind === "var" ? _scopeflags.BIND_VAR : _scopeflags.BIND_LEXICAL, false);
};

@@ -572,3 +570,3 @@

// treatFunctionsAsVar).
this.checkLVal(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? _scopeflags.BIND_VAR : _scopeflags.BIND_LEXICAL : _scopeflags.BIND_FUNCTION);
this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? _scopeflags.BIND_VAR : _scopeflags.BIND_LEXICAL : _scopeflags.BIND_FUNCTION);
}

@@ -618,3 +616,3 @@

this.expect(_tokentype.types.braceL);
while (!this.eat(_tokentype.types.braceR)) {
while (this.type !== _tokentype.types.braceR) {
const element = this.parseClassElement(node.superClass !== null);

@@ -629,4 +627,5 @@ if (element) {

}
this.strict = oldStrict;
this.next();
node.body = this.finishNode(classBody, "ClassBody");
this.strict = oldStrict;
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");

@@ -694,3 +693,3 @@ };

node.id = this.parseIdent();
if (isStatement) this.checkLVal(node.id, _scopeflags.BIND_LEXICAL, false);
if (isStatement) this.checkLValSimple(node.id, _scopeflags.BIND_LEXICAL, false);
} else {

@@ -712,2 +711,10 @@ if (isStatement === true) this.unexpected();

if (this.eat(_tokentype.types.star)) {
if (this.options.ecmaVersion >= 11) {
if (this.eatContextual("as")) {
node.exported = this.parseIdent(true);
this.checkExport(exports, node.exported.name, this.lastTokStart);
} else {
node.exported = null;
}
}
this.expectContextual("from");

@@ -895,3 +902,3 @@ if (this.type !== _tokentype.types.string) this.unexpected();

node.local = this.parseIdent();
this.checkLVal(node.local, _scopeflags.BIND_LEXICAL);
this.checkLValSimple(node.local, _scopeflags.BIND_LEXICAL);
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));

@@ -905,3 +912,3 @@ if (!this.eat(_tokentype.types.comma)) return nodes;

node.local = this.parseIdent();
this.checkLVal(node.local, _scopeflags.BIND_LEXICAL);
this.checkLValSimple(node.local, _scopeflags.BIND_LEXICAL);
nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"));

@@ -925,3 +932,3 @@ return nodes;

}
this.checkLVal(node.local, _scopeflags.BIND_LEXICAL);
this.checkLValSimple(node.local, _scopeflags.BIND_LEXICAL);
nodes.push(this.finishNode(node, "ImportSpecifier"));

@@ -928,0 +935,0 @@ }

@@ -6,7 +6,7 @@ "use strict";

var _state = require("./state");
var _state = require("./state.js");
var _tokentype = require("./tokentype");
var _tokentype = require("./tokentype.js");
var _whitespace = require("./whitespace");
var _whitespace = require("./whitespace.js");

@@ -110,3 +110,3 @@ class TokContext {

_tokentype.types._function.updateContext = _tokentype.types._class.updateContext = function (prevType) {
if (prevType.beforeExpr && prevType !== _tokentype.types.semi && prevType !== _tokentype.types._else && !(prevType === _tokentype.types._return && _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === _tokentype.types.colon || prevType === _tokentype.types.braceL) && this.curContext() === types.b_stat)) this.context.push(types.f_expr);else this.context.push(types.f_stat);
if (prevType.beforeExpr && prevType !== _tokentype.types._else && !(prevType === _tokentype.types.semi && this.curContext() !== types.p_stat) && !(prevType === _tokentype.types._return && _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === _tokentype.types.colon || prevType === _tokentype.types.braceL) && this.curContext() === types.b_stat)) this.context.push(types.f_expr);else this.context.push(types.f_stat);
this.exprAllowed = false;

@@ -113,0 +113,0 @@ };

@@ -6,13 +6,13 @@ "use strict";

var _identifier = require("./identifier");
var _identifier = require("./identifier.js");
var _tokentype = require("./tokentype");
var _tokentype = require("./tokentype.js");
var _state = require("./state");
var _state = require("./state.js");
var _locutil = require("./locutil");
var _locutil = require("./locutil.js");
var _regexp = require("./regexp");
var _regexp = require("./regexp.js");
var _whitespace = require("./whitespace");
var _whitespace = require("./whitespace.js");

@@ -40,3 +40,4 @@ // Object type used to represent tokens. Note that normally, tokens

pp.next = function () {
pp.next = function (ignoreEscapeSequenceInKeyword) {
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword);
if (this.options.onToken) this.options.onToken(new Token(this));

@@ -246,3 +247,9 @@

let next = this.input.charCodeAt(this.pos + 1);
if (next === code) return this.finishOp(code === 124 ? _tokentype.types.logicalOR : _tokentype.types.logicalAND, 2);
if (next === code) {
if (this.options.ecmaVersion >= 12) {
let next2 = this.input.charCodeAt(this.pos + 2);
if (next2 === 61) return this.finishOp(_tokentype.types.assign, 3);
}
return this.finishOp(code === 124 ? _tokentype.types.logicalOR : _tokentype.types.logicalAND, 2);
}
if (next === 61) return this.finishOp(_tokentype.types.assign, 2);

@@ -306,2 +313,22 @@ return this.finishOp(code === 124 ? _tokentype.types.bitwiseOR : _tokentype.types.bitwiseAND, 1);

pp.readToken_question = function () {
// '?'
const ecmaVersion = this.options.ecmaVersion;
if (ecmaVersion >= 11) {
let next = this.input.charCodeAt(this.pos + 1);
if (next === 46) {
let next2 = this.input.charCodeAt(this.pos + 2);
if (next2 < 48 || next2 > 57) return this.finishOp(_tokentype.types.questionDot, 2);
}
if (next === 63) {
if (ecmaVersion >= 12) {
let next2 = this.input.charCodeAt(this.pos + 2);
if (next2 === 61) return this.finishOp(_tokentype.types.assign, 3);
}
return this.finishOp(_tokentype.types.coalesce, 2);
}
}
return this.finishOp(_tokentype.types.question, 1);
};
pp.getTokenFromCode = function (code) {

@@ -334,4 +361,2 @@ switch (code) {

++this.pos;return this.finishToken(_tokentype.types.colon);
case 63:
++this.pos;return this.finishToken(_tokentype.types.question);

@@ -397,2 +422,6 @@ case 96:

case 63:
// '?'
return this.readToken_question();
case 126:

@@ -454,8 +483,26 @@ // '~'

pp.readInt = function (radix, len) {
pp.readInt = function (radix, len, maybeLegacyOctalNumericLiteral) {
// `len` is used for character escape sequences. In that case, disallow separators.
const allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
// `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
// and isn't fraction part nor exponent part. In that case, if the first digit
// is zero then disallow separators.
const isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
let start = this.pos,
total = 0;
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
total = 0,
lastCode = 0;
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
let code = this.input.charCodeAt(this.pos),
val;
if (allowSeparators && code === 95) {
if (isLegacyOctalNumericLiteral) this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
if (lastCode === 95) this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore");
if (i === 0) this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
lastCode = code;
continue;
}
if (code >= 97) val = code - 97 + 10; // a

@@ -466,5 +513,7 @@ else if (code >= 65) val = code - 65 + 10; // A

if (val >= radix) break;
++this.pos;
lastCode = code;
total = total * radix + val;
}
if (allowSeparators && lastCode === 95) this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits");
if (this.pos === start || len != null && this.pos - start !== len) return null;

@@ -475,2 +524,20 @@

function stringToNumber(str, isLegacyOctalNumericLiteral) {
if (isLegacyOctalNumericLiteral) {
return parseInt(str, 8);
}
// `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
return parseFloat(str.replace(/_/g, ""));
}
function stringToBigInt(str) {
if (typeof BigInt !== "function") {
return null;
}
// `BigInt(value)` throws syntax error if the string contains numeric separators.
return BigInt(str.replace(/_/g, ""));
}
pp.readRadixNumber = function (radix) {

@@ -482,3 +549,3 @@ let start = this.pos;

if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
val = typeof BigInt !== "undefined" ? BigInt(this.input.slice(start, this.pos)) : null;
val = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;

@@ -493,10 +560,8 @@ } else if ((0, _identifier.isIdentifierStart)(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");

let start = this.pos;
if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");
if (!startsWithDot && this.readInt(10, undefined, true) === null) this.raise(start, "Invalid number");
let octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
if (octal && this.strict) this.raise(start, "Invalid number");
if (octal && /[89]/.test(this.input.slice(start, this.pos))) octal = false;
let next = this.input.charCodeAt(this.pos);
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
let str = this.input.slice(start, this.pos);
let val = typeof BigInt !== "undefined" ? BigInt(str) : null;
let val = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;

@@ -506,2 +571,3 @@ if ((0, _identifier.isIdentifierStart)(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");

}
if (octal && /[89]/.test(this.input.slice(start, this.pos))) octal = false;
if (next === 46 && !octal) {

@@ -521,4 +587,3 @@ // '.'

let str = this.input.slice(start, this.pos);
let val = octal ? parseInt(str, 8) : parseFloat(str);
let val = stringToNumber(this.input.slice(start, this.pos), octal);
return this.finishToken(_tokentype.types.num, val);

@@ -703,2 +768,14 @@ };

return "";
case 56:
case 57:
if (this.strict) {
this.invalidStringToken(this.pos - 1, "Invalid escape sequence");
}
if (inTemplate) {
const codePos = this.pos - 1;
this.invalidStringToken(codePos, "Invalid escape sequence in template string");
return null;
}
default:

@@ -780,3 +857,2 @@ if (ch >= 48 && ch <= 55) {

if (this.keywords.test(word)) {
if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword " + word);
type = _tokentype.keywords[word];

@@ -783,0 +859,0 @@ }

@@ -78,2 +78,3 @@ "use strict";

question: new TokenType("?", beforeExpr),
questionDot: new TokenType("?."),
arrow: new TokenType("=>", beforeExpr),

@@ -117,2 +118,3 @@ template: new TokenType("template"),

starstar: new TokenType("**", { beforeExpr: true }),
coalesce: binop("??", 1),

@@ -119,0 +121,0 @@ // Keyword token types.

@@ -15,6 +15,8 @@ "use strict";

const ecma11BinaryProperties = ecma10BinaryProperties;
const ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
const unicodeBinaryProperties = {
9: ecma9BinaryProperties,
10: ecma10BinaryProperties,
11: ecma11BinaryProperties
11: ecma11BinaryProperties,
12: ecma12BinaryProperties

@@ -28,6 +30,8 @@ // #table-unicode-general-category-values

const ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
const ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
const unicodeScriptValues = {
9: ecma9ScriptValues,
10: ecma10ScriptValues,
11: ecma11ScriptValues
11: ecma11ScriptValues,
12: ecma12ScriptValues
};

@@ -53,4 +57,5 @@

buildUnicodeData(11);
buildUnicodeData(12);
exports.default = data;
module.exports = exports['default'];
{
"name": "acorn-hammerhead",
"version": "0.3.0",
"version": "0.4.0",
"description": "",

@@ -11,3 +11,3 @@ "main": "lib/index.js",

"dependencies": {
"@types/estree": "^0.0.39"
"@types/estree": "0.0.46"
},

@@ -14,0 +14,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc