Socket
Socket
Sign inDemoInstall

acorn

Package Overview
Dependencies
0
Maintainers
2
Versions
131
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.0 to 3.3.0

dist/acorn_loose.es.js

12

bin/generate-identifier-regex.js

@@ -0,9 +1,11 @@

'use strict';
// Which Unicode version should be used?
var version = '8.0.0';
var version = '9.0.0';
var start = require('unicode-' + version + '/properties/ID_Start/code-points')
.filter(function(ch) { return ch > 127; });
var start = require('unicode-' + version + '/Binary_Property/ID_Start/code-points.js')
.filter(function(ch) { return ch > 0x7f; });
var last = -1;
var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/properties/ID_Continue/code-points')
.filter(function(ch) { return ch > 127 && search(start, ch, last + 1) == -1; }));
var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/Binary_Property/ID_Continue/code-points.js')
.filter(function(ch) { return ch > 0x7f && search(start, ch, last + 1) == -1; }));

@@ -10,0 +12,0 @@ function search(arr, ch, starting) {

@@ -0,4 +1,17 @@

## 3.3.0 (2016-07-25)
### Bug fixes
Fix bug in tokenizing of regexp operator after a function declaration.
Fix parser crash when parsing an array pattern with a hole.
### New features
Implement check against complex argument lists in functions that
enable strict mode in ES7.
## 3.2.0 (2016-06-07)
## Bug fixes
### Bug fixes

@@ -5,0 +18,0 @@ Improve handling of lack of unicode regexp support in host

@@ -1,1322 +0,1273 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).loose = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./acorn.js')) :
typeof define === 'function' && define.amd ? define(['exports', './acorn.js'], factory) :
(factory((global.acorn = global.acorn || {}, global.acorn.loose = global.acorn.loose || {}),global.acorn));
}(this, function (exports,acorn) { 'use strict';
module.exports = typeof acorn != 'undefined' ? acorn : require("./acorn");
var acorn__default = 'default' in acorn ? acorn['default'] : acorn;
},{}],2:[function(_dereq_,module,exports){
"use strict";
// Registered plugins
var pluginsLoose = {}
var _state = _dereq_("./state");
var LooseParser = function LooseParser(input, options) {
if ( options === void 0 ) options = {};
var _parseutil = _dereq_("./parseutil");
this.toks = acorn.tokenizer(input, options)
this.options = this.toks.options
this.input = this.toks.input
this.tok = this.last = {type: acorn.tokTypes.eof, start: 0, end: 0}
if (this.options.locations) {
var here = this.toks.curPosition()
this.tok.loc = new acorn.SourceLocation(this.toks, here, here)
}
this.ahead = [] // Tokens ahead
this.context = [] // Indentation contexted
this.curIndent = 0
this.curLineStart = 0
this.nextLineStart = this.lineEnd(this.curLineStart) + 1
// Load plugins
this.options.pluginsLoose = options.pluginsLoose || {}
this.loadPlugins(this.options.pluginsLoose)
};
var _ = _dereq_("..");
LooseParser.prototype.startNode = function startNode () {
return new acorn.Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null)
};
var lp = _state.LooseParser.prototype;
LooseParser.prototype.storeCurrentPos = function storeCurrentPos () {
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
};
lp.checkLVal = function (expr) {
if (!expr) return expr;
switch (expr.type) {
case "Identifier":
case "MemberExpression":
return expr;
LooseParser.prototype.startNodeAt = function startNodeAt (pos) {
if (this.options.locations) {
return new acorn.Node(this.toks, pos[0], pos[1])
} else {
return new acorn.Node(this.toks, pos)
}
};
case "ParenthesizedExpression":
expr.expression = this.checkLVal(expr.expression);
return expr;
LooseParser.prototype.finishNode = function finishNode (node, type) {
node.type = type
node.end = this.last.end
if (this.options.locations)
node.loc.end = this.last.loc.end
if (this.options.ranges)
node.range[1] = this.last.end
return node
};
default:
return this.dummyIdent();
}
};
LooseParser.prototype.dummyNode = function dummyNode (type) {
var dummy = this.startNode()
dummy.type = type
dummy.end = dummy.start
if (this.options.locations)
dummy.loc.end = dummy.loc.start
if (this.options.ranges)
dummy.range[1] = dummy.start
this.last = {type: acorn.tokTypes.name, start: dummy.start, end: dummy.start, loc: dummy.loc}
return dummy
};
lp.parseExpression = function (noIn) {
var start = this.storeCurrentPos();
var expr = this.parseMaybeAssign(noIn);
if (this.tok.type === _.tokTypes.comma) {
var node = this.startNodeAt(start);
node.expressions = [expr];
while (this.eat(_.tokTypes.comma)) node.expressions.push(this.parseMaybeAssign(noIn));
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
LooseParser.prototype.dummyIdent = function dummyIdent () {
var dummy = this.dummyNode("Identifier")
dummy.name = "✖"
return dummy
};
lp.parseParenExpression = function () {
this.pushCx();
this.expect(_.tokTypes.parenL);
var val = this.parseExpression();
this.popCx();
this.expect(_.tokTypes.parenR);
return val;
};
LooseParser.prototype.dummyString = function dummyString () {
var dummy = this.dummyNode("Literal")
dummy.value = dummy.raw = "✖"
return dummy
};
lp.parseMaybeAssign = function (noIn) {
if (this.toks.isContextual("yield")) {
var node = this.startNode();
this.next();
if (this.semicolon() || this.canInsertSemicolon() || this.tok.type != _.tokTypes.star && !this.tok.type.startsExpr) {
node.delegate = false;
node.argument = null;
LooseParser.prototype.eat = function eat (type) {
if (this.tok.type === type) {
this.next()
return true
} else {
node.delegate = this.eat(_.tokTypes.star);
node.argument = this.parseMaybeAssign();
return false
}
return this.finishNode(node, "YieldExpression");
}
};
var start = this.storeCurrentPos();
var left = this.parseMaybeConditional(noIn);
if (this.tok.type.isAssign) {
var node = this.startNodeAt(start);
node.operator = this.tok.value;
node.left = this.tok.type === _.tokTypes.eq ? this.toAssignable(left) : this.checkLVal(left);
this.next();
node.right = this.parseMaybeAssign(noIn);
return this.finishNode(node, "AssignmentExpression");
}
return left;
};
LooseParser.prototype.isContextual = function isContextual (name) {
return this.tok.type === acorn.tokTypes.name && this.tok.value === name
};
lp.parseMaybeConditional = function (noIn) {
var start = this.storeCurrentPos();
var expr = this.parseExprOps(noIn);
if (this.eat(_.tokTypes.question)) {
var node = this.startNodeAt(start);
node.test = expr;
node.consequent = this.parseMaybeAssign();
node.alternate = this.expect(_.tokTypes.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent();
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
LooseParser.prototype.eatContextual = function eatContextual (name) {
return this.tok.value === name && this.eat(acorn.tokTypes.name)
};
lp.parseExprOps = function (noIn) {
var start = this.storeCurrentPos();
var indent = this.curIndent,
line = this.curLineStart;
return this.parseExprOp(this.parseMaybeUnary(false), start, -1, noIn, indent, line);
};
LooseParser.prototype.canInsertSemicolon = function canInsertSemicolon () {
return this.tok.type === acorn.tokTypes.eof || this.tok.type === acorn.tokTypes.braceR ||
acorn.lineBreak.test(this.input.slice(this.last.end, this.tok.start))
};
lp.parseExprOp = function (left, start, minPrec, noIn, indent, line) {
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) return left;
var prec = this.tok.type.binop;
if (prec != null && (!noIn || this.tok.type !== _.tokTypes._in)) {
if (prec > minPrec) {
var node = this.startNodeAt(start);
node.left = left;
node.operator = this.tok.value;
this.next();
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) {
node.right = this.dummyIdent();
} else {
var rightStart = this.storeCurrentPos();
node.right = this.parseExprOp(this.parseMaybeUnary(false), rightStart, prec, noIn, indent, line);
LooseParser.prototype.semicolon = function semicolon () {
return this.eat(acorn.tokTypes.semi)
};
LooseParser.prototype.expect = function expect (type) {
var this$1 = this;
if (this.eat(type)) return true
for (var i = 1; i <= 2; i++) {
if (this$1.lookAhead(i).type == type) {
for (var j = 0; j < i; j++) this$1.next()
return true
}
this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression");
return this.parseExprOp(node, start, minPrec, noIn, indent, line);
}
}
return left;
};
};
lp.parseMaybeUnary = function (sawUnary) {
var start = this.storeCurrentPos(),
expr = undefined;
if (this.tok.type.prefix) {
var node = this.startNode(),
update = this.tok.type === _.tokTypes.incDec;
if (!update) sawUnary = true;
node.operator = this.tok.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary(true);
if (update) node.argument = this.checkLVal(node.argument);
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
} else if (this.tok.type === _.tokTypes.ellipsis) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeUnary(sawUnary);
expr = this.finishNode(node, "SpreadElement");
} else {
expr = this.parseExprSubscripts();
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
var node = this.startNodeAt(start);
node.operator = this.tok.value;
node.prefix = false;
node.argument = this.checkLVal(expr);
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
}
LooseParser.prototype.pushCx = function pushCx () {
this.context.push(this.curIndent)
};
if (!sawUnary && this.eat(_.tokTypes.starstar)) {
var node = this.startNodeAt(start);
node.operator = "**";
node.left = expr;
node.right = this.parseMaybeUnary(false);
return this.finishNode(node, "BinaryExpression");
}
LooseParser.prototype.popCx = function popCx () {
this.curIndent = this.context.pop()
};
return expr;
};
LooseParser.prototype.lineEnd = function lineEnd (pos) {
while (pos < this.input.length && !acorn.isNewLine(this.input.charCodeAt(pos))) ++pos
return pos
};
lp.parseExprSubscripts = function () {
var start = this.storeCurrentPos();
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart);
};
LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
var this$1 = this;
lp.parseSubscripts = function (base, start, noCalls, startIndent, line) {
for (;;) {
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) {
if (this.tok.type == _.tokTypes.dot && this.curIndent == startIndent) --startIndent;else return base;
for (var count = 0;; ++pos) {
var ch = this$1.input.charCodeAt(pos)
if (ch === 32) ++count
else if (ch === 9) count += this$1.options.tabSize
else return count
}
};
if (this.eat(_.tokTypes.dot)) {
var node = this.startNodeAt(start);
node.object = base;
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) node.property = this.dummyIdent();else node.property = this.parsePropertyAccessor() || this.dummyIdent();
node.computed = false;
base = this.finishNode(node, "MemberExpression");
} else if (this.tok.type == _.tokTypes.bracketL) {
this.pushCx();
this.next();
var node = this.startNodeAt(start);
node.object = base;
node.property = this.parseExpression();
node.computed = true;
this.popCx();
this.expect(_.tokTypes.bracketR);
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.tok.type == _.tokTypes.parenL) {
var node = this.startNodeAt(start);
node.callee = base;
node.arguments = this.parseExprList(_.tokTypes.parenR);
base = this.finishNode(node, "CallExpression");
} else if (this.tok.type == _.tokTypes.backQuote) {
var node = this.startNodeAt(start);
node.tag = base;
node.quasi = this.parseTemplate();
base = this.finishNode(node, "TaggedTemplateExpression");
} else {
return base;
}
}
};
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
if (this.tok.type === closeTok || this.tok.type === acorn.tokTypes.eof) return true
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
(!blockHeuristic || this.nextLineStart >= this.input.length ||
this.indentationAfter(this.nextLineStart) < indent)
};
lp.parseExprAtom = function () {
var node = undefined;
switch (this.tok.type) {
case _.tokTypes._this:
case _.tokTypes._super:
var type = this.tok.type === _.tokTypes._this ? "ThisExpression" : "Super";
node = this.startNode();
this.next();
return this.finishNode(node, type);
LooseParser.prototype.tokenStartsLine = function tokenStartsLine () {
var this$1 = this;
case _.tokTypes.name:
var start = this.storeCurrentPos();
var id = this.parseIdent();
return this.eat(_.tokTypes.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id]) : id;
for (var p = this.tok.start - 1; p >= this.curLineStart; --p) {
var ch = this$1.input.charCodeAt(p)
if (ch !== 9 && ch !== 32) return false
}
return true
};
case _.tokTypes.regexp:
node = this.startNode();
var val = this.tok.value;
node.regex = { pattern: val.pattern, flags: val.flags };
node.value = val.value;
node.raw = this.input.slice(this.tok.start, this.tok.end);
this.next();
return this.finishNode(node, "Literal");
LooseParser.prototype.extend = function extend (name, f) {
this[name] = f(this[name])
};
case _.tokTypes.num:case _.tokTypes.string:
node = this.startNode();
node.value = this.tok.value;
node.raw = this.input.slice(this.tok.start, this.tok.end);
this.next();
return this.finishNode(node, "Literal");
LooseParser.prototype.loadPlugins = function loadPlugins (pluginConfigs) {
var this$1 = this;
case _.tokTypes._null:case _.tokTypes._true:case _.tokTypes._false:
node = this.startNode();
node.value = this.tok.type === _.tokTypes._null ? null : this.tok.type === _.tokTypes._true;
node.raw = this.tok.type.keyword;
this.next();
return this.finishNode(node, "Literal");
for (var name in pluginConfigs) {
var plugin = pluginsLoose[name]
if (!plugin) throw new Error("Plugin '" + name + "' not found")
plugin(this$1, pluginConfigs[name])
}
};
case _.tokTypes.parenL:
var parenStart = this.storeCurrentPos();
this.next();
var inner = this.parseExpression();
this.expect(_.tokTypes.parenR);
if (this.eat(_.tokTypes.arrow)) {
return this.parseArrowExpression(this.startNodeAt(parenStart), inner.expressions || (_parseutil.isDummy(inner) ? [] : [inner]));
}
if (this.options.preserveParens) {
var par = this.startNodeAt(parenStart);
par.expression = inner;
inner = this.finishNode(par, "ParenthesizedExpression");
}
return inner;
var lp = LooseParser.prototype
case _.tokTypes.bracketL:
node = this.startNode();
node.elements = this.parseExprList(_.tokTypes.bracketR, true);
return this.finishNode(node, "ArrayExpression");
function isSpace(ch) {
return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || acorn.isNewLine(ch)
}
case _.tokTypes.braceL:
return this.parseObj();
lp.next = function() {
var this$1 = this;
case _.tokTypes._class:
return this.parseClass();
this.last = this.tok
if (this.ahead.length)
this.tok = this.ahead.shift()
else
this.tok = this.readToken()
case _.tokTypes._function:
node = this.startNode();
this.next();
return this.parseFunction(node, false);
case _.tokTypes._new:
return this.parseNew();
case _.tokTypes.backQuote:
return this.parseTemplate();
default:
return this.dummyIdent();
if (this.tok.start >= this.nextLineStart) {
while (this.tok.start >= this.nextLineStart) {
this$1.curLineStart = this$1.nextLineStart
this$1.nextLineStart = this$1.lineEnd(this$1.curLineStart) + 1
}
this.curIndent = this.indentationAfter(this.curLineStart)
}
}
};
lp.parseNew = function () {
var node = this.startNode(),
startIndent = this.curIndent,
line = this.curLineStart;
var meta = this.parseIdent(true);
if (this.options.ecmaVersion >= 6 && this.eat(_.tokTypes.dot)) {
node.meta = meta;
node.property = this.parseIdent(true);
return this.finishNode(node, "MetaProperty");
}
var start = this.storeCurrentPos();
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
if (this.tok.type == _.tokTypes.parenL) {
node.arguments = this.parseExprList(_.tokTypes.parenR);
} else {
node.arguments = [];
}
return this.finishNode(node, "NewExpression");
};
lp.readToken = function() {
var this$1 = this;
lp.parseTemplateElement = function () {
var elem = this.startNode();
elem.value = {
raw: this.input.slice(this.tok.start, this.tok.end).replace(/\r\n?/g, '\n'),
cooked: this.tok.value
};
this.next();
elem.tail = this.tok.type === _.tokTypes.backQuote;
return this.finishNode(elem, "TemplateElement");
};
for (;;) {
try {
this$1.toks.next()
if (this$1.toks.type === acorn.tokTypes.dot &&
this$1.input.substr(this$1.toks.end, 1) === "." &&
this$1.options.ecmaVersion >= 6) {
this$1.toks.end++
this$1.toks.type = acorn.tokTypes.ellipsis
}
return new acorn.Token(this$1.toks)
} catch(e) {
if (!(e instanceof SyntaxError)) throw e
lp.parseTemplate = function () {
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement();
node.quasis = [curElt];
while (!curElt.tail) {
this.next();
node.expressions.push(this.parseExpression());
if (this.expect(_.tokTypes.braceR)) {
curElt = this.parseTemplateElement();
} else {
curElt = this.startNode();
curElt.value = { cooked: '', raw: '' };
curElt.tail = true;
this.finishNode(curElt, "TemplateElement");
}
node.quasis.push(curElt);
}
this.expect(_.tokTypes.backQuote);
return this.finishNode(node, "TemplateLiteral");
};
lp.parseObj = function () {
var node = this.startNode();
node.properties = [];
this.pushCx();
var indent = this.curIndent + 1,
line = this.curLineStart;
this.eat(_.tokTypes.braceL);
if (this.curIndent + 1 < indent) {
indent = this.curIndent;line = this.curLineStart;
}
while (!this.closes(_.tokTypes.braceR, indent, line)) {
var prop = this.startNode(),
isGenerator = undefined,
start = undefined;
if (this.options.ecmaVersion >= 6) {
start = this.storeCurrentPos();
prop.method = false;
prop.shorthand = false;
isGenerator = this.eat(_.tokTypes.star);
}
this.parsePropertyName(prop);
if (_parseutil.isDummy(prop.key)) {
if (_parseutil.isDummy(this.parseMaybeAssign())) this.next();this.eat(_.tokTypes.comma);continue;
}
if (this.eat(_.tokTypes.colon)) {
prop.kind = "init";
prop.value = this.parseMaybeAssign();
} else if (this.options.ecmaVersion >= 6 && (this.tok.type === _.tokTypes.parenL || this.tok.type === _.tokTypes.braceL)) {
prop.kind = "init";
prop.method = true;
prop.value = this.parseMethod(isGenerator);
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" && !prop.computed && (prop.key.name === "get" || prop.key.name === "set") && this.tok.type != _.tokTypes.comma && this.tok.type != _.tokTypes.braceR) {
prop.kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
} else {
prop.kind = "init";
if (this.options.ecmaVersion >= 6) {
if (this.eat(_.tokTypes.eq)) {
var assign = this.startNodeAt(start);
assign.operator = "=";
assign.left = prop.key;
assign.right = this.parseMaybeAssign();
prop.value = this.finishNode(assign, "AssignmentExpression");
// Try to skip some text, based on the error message, and then continue
var msg = e.message, pos = e.raisedAt, replace = true
if (/unterminated/i.test(msg)) {
pos = this$1.lineEnd(e.pos + 1)
if (/string/.test(msg)) {
replace = {start: e.pos, end: pos, type: acorn.tokTypes.string, value: this$1.input.slice(e.pos + 1, pos)}
} else if (/regular expr/i.test(msg)) {
var re = this$1.input.slice(e.pos, pos)
try { re = new RegExp(re) } catch(e) {}
replace = {start: e.pos, end: pos, type: acorn.tokTypes.regexp, value: re}
} else if (/template/.test(msg)) {
replace = {start: e.pos, end: pos,
type: acorn.tokTypes.template,
value: this$1.input.slice(e.pos, pos)}
} else {
replace = false
}
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos
} else if (/character escape|expected hexadecimal/i.test(msg)) {
while (pos < this.input.length) {
var ch = this$1.input.charCodeAt(pos++)
if (ch === 34 || ch === 39 || acorn.isNewLine(ch)) break
}
} else if (/unexpected character/i.test(msg)) {
pos++
replace = false
} else if (/regular expression/i.test(msg)) {
replace = true
} else {
prop.value = prop.key;
throw e
}
} else {
prop.value = this.dummyIdent();
this$1.resetTo(pos)
if (replace === true) replace = {start: pos, end: pos, type: acorn.tokTypes.name, value: "✖"}
if (replace) {
if (this$1.options.locations)
replace.loc = new acorn.SourceLocation(
this$1.toks,
acorn.getLineInfo(this$1.input, replace.start),
acorn.getLineInfo(this$1.input, replace.end))
return replace
}
}
prop.shorthand = true;
}
node.properties.push(this.finishNode(prop, "Property"));
this.eat(_.tokTypes.comma);
}
this.popCx();
if (!this.eat(_.tokTypes.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start;
if (this.options.locations) this.last.loc.end = this.tok.loc.start;
}
return this.finishNode(node, "ObjectExpression");
};
lp.parsePropertyName = function (prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(_.tokTypes.bracketL)) {
prop.computed = true;
prop.key = this.parseExpression();
this.expect(_.tokTypes.bracketR);
return;
} else {
prop.computed = false;
lp.resetTo = function(pos) {
var this$1 = this;
this.toks.pos = pos
var ch = this.input.charAt(pos - 1)
this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) ||
/[enwfd]/.test(ch) &&
/\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos))
if (this.options.locations) {
this.toks.curLine = 1
this.toks.lineStart = acorn.lineBreakG.lastIndex = 0
var match
while ((match = acorn.lineBreakG.exec(this.input)) && match.index < pos) {
++this$1.toks.curLine
this$1.toks.lineStart = match.index + match[0].length
}
}
}
var key = this.tok.type === _.tokTypes.num || this.tok.type === _.tokTypes.string ? this.parseExprAtom() : this.parseIdent();
prop.key = key || this.dummyIdent();
};
lp.parsePropertyAccessor = function () {
if (this.tok.type === _.tokTypes.name || this.tok.type.keyword) return this.parseIdent();
};
lp.lookAhead = function(n) {
var this$1 = this;
lp.parseIdent = function () {
var name = this.tok.type === _.tokTypes.name ? this.tok.value : this.tok.type.keyword;
if (!name) return this.dummyIdent();
var node = this.startNode();
this.next();
node.name = name;
return this.finishNode(node, "Identifier");
};
lp.initFunction = function (node) {
node.id = null;
node.params = [];
if (this.options.ecmaVersion >= 6) {
node.generator = false;
node.expression = false;
while (n > this.ahead.length)
this$1.ahead.push(this$1.readToken())
return this.ahead[n - 1]
}
};
// Convert existing expression atom to assignable pattern
// if possible.
function isDummy(node) { return node.name == "✖" }
lp.toAssignable = function (node, binding) {
if (!node || node.type == "Identifier" || node.type == "MemberExpression" && !binding) {
// Okay
} else if (node.type == "ParenthesizedExpression") {
node.expression = this.toAssignable(node.expression, binding);
} else if (this.options.ecmaVersion < 6) {
return this.dummyIdent();
} else if (node.type == "ObjectExpression") {
node.type = "ObjectPattern";
var props = node.properties;
for (var i = 0; i < props.length; i++) {
props[i].value = this.toAssignable(props[i].value, binding);
}
} else if (node.type == "ArrayExpression") {
node.type = "ArrayPattern";
this.toAssignableList(node.elements, binding);
} else if (node.type == "SpreadElement") {
node.type = "RestElement";
node.argument = this.toAssignable(node.argument, binding);
} else if (node.type == "AssignmentExpression") {
node.type = "AssignmentPattern";
delete node.operator;
} else {
return this.dummyIdent();
}
return node;
};
var lp$1 = LooseParser.prototype
lp.toAssignableList = function (exprList, binding) {
for (var i = 0; i < exprList.length; i++) {
exprList[i] = this.toAssignable(exprList[i], binding);
}return exprList;
};
lp$1.parseTopLevel = function() {
var this$1 = this;
lp.parseFunctionParams = function (params) {
params = this.parseExprList(_.tokTypes.parenR);
return this.toAssignableList(params, true);
};
var node = this.startNodeAt(this.options.locations ? [0, acorn.getLineInfo(this.input, 0)] : 0)
node.body = []
while (this.tok.type !== acorn.tokTypes.eof) node.body.push(this$1.parseStatement())
this.last = this.tok
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType
}
return this.finishNode(node, "Program")
}
lp.parseMethod = function (isGenerator) {
var node = this.startNode();
this.initFunction(node);
node.params = this.parseFunctionParams();
node.generator = isGenerator || false;
node.expression = this.options.ecmaVersion >= 6 && this.tok.type !== _.tokTypes.braceL;
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
return this.finishNode(node, "FunctionExpression");
};
lp$1.parseStatement = function() {
var this$1 = this;
lp.parseArrowExpression = function (node, params) {
this.initFunction(node);
node.params = this.toAssignableList(params, true);
node.expression = this.tok.type !== _.tokTypes.braceL;
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
return this.finishNode(node, "ArrowFunctionExpression");
};
var starttype = this.tok.type, node = this.startNode(), kind
lp.parseExprList = function (close, allowEmpty) {
this.pushCx();
var indent = this.curIndent,
line = this.curLineStart,
elts = [];
this.next(); // Opening bracket
while (!this.closes(close, indent + 1, line)) {
if (this.eat(_.tokTypes.comma)) {
elts.push(allowEmpty ? null : this.dummyIdent());
continue;
if (this.toks.isLet()) {
starttype = acorn.tokTypes._var
kind = "let"
}
var elt = this.parseMaybeAssign();
if (_parseutil.isDummy(elt)) {
if (this.closes(close, indent, line)) break;
this.next();
} else {
elts.push(elt);
}
this.eat(_.tokTypes.comma);
}
this.popCx();
if (!this.eat(close)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start;
if (this.options.locations) this.last.loc.end = this.tok.loc.start;
}
return elts;
};
},{"..":1,"./parseutil":4,"./state":5}],3:[function(_dereq_,module,exports){
// Acorn: Loose parser
//
// This module provides an alternative parser (`parse_dammit`) that
// exposes that same interface as `parse`, but will try to parse
// anything as JavaScript, repairing syntax error the best it can.
// There are circumstances in which it will raise an error and give
// up, but they are very rare. The resulting AST will be a mostly
// valid JavaScript AST (as per the [Mozilla parser API][api], except
// that:
//
// - Return outside functions is allowed
//
// - Label consistency (no conflicts, break only to existing labels)
// is not enforced.
//
// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever
// the parser got too confused to return anything meaningful.
//
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
//
// The expected use for this is to *first* try `acorn.parse`, and only
// if that fails switch to `parse_dammit`. The loose parser might
// parse badly indented code incorrectly, so **don't** use it as
// your default parser.
//
// Quite a lot of acorn.js is duplicated here. The alternative was to
// add a *lot* of extra cruft to that file, making it less readable
// and slower. Copying and editing the code allowed me to make
// invasive changes and simplifications without creating a complicated
// tangle.
switch (starttype) {
case acorn.tokTypes._break: case acorn.tokTypes._continue:
this.next()
var isBreak = starttype === acorn.tokTypes._break
if (this.semicolon() || this.canInsertSemicolon()) {
node.label = null
} else {
node.label = this.tok.type === acorn.tokTypes.name ? this.parseIdent() : null
this.semicolon()
}
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
"use strict";
case acorn.tokTypes._debugger:
this.next()
this.semicolon()
return this.finishNode(node, "DebuggerStatement")
exports.__esModule = true;
exports.parse_dammit = parse_dammit;
case acorn.tokTypes._do:
this.next()
node.body = this.parseStatement()
node.test = this.eat(acorn.tokTypes._while) ? this.parseParenExpression() : this.dummyIdent()
this.semicolon()
return this.finishNode(node, "DoWhileStatement")
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
case acorn.tokTypes._for:
this.next()
this.pushCx()
this.expect(acorn.tokTypes.parenL)
if (this.tok.type === acorn.tokTypes.semi) return this.parseFor(node, null)
var isLet = this.toks.isLet()
if (isLet || this.tok.type === acorn.tokTypes._var || this.tok.type === acorn.tokTypes._const) {
var init$1 = this.parseVar(true, isLet ? "let" : this.tok.value)
if (init$1.declarations.length === 1 && (this.tok.type === acorn.tokTypes._in || this.isContextual("of"))) {
return this.parseForIn(node, init$1)
}
return this.parseFor(node, init$1)
}
var init = this.parseExpression(true)
if (this.tok.type === acorn.tokTypes._in || this.isContextual("of"))
return this.parseForIn(node, this.toAssignable(init))
return this.parseFor(node, init)
var _ = _dereq_("..");
case acorn.tokTypes._function:
this.next()
return this.parseFunction(node, true)
var acorn = _interopRequireWildcard(_);
case acorn.tokTypes._if:
this.next()
node.test = this.parseParenExpression()
node.consequent = this.parseStatement()
node.alternate = this.eat(acorn.tokTypes._else) ? this.parseStatement() : null
return this.finishNode(node, "IfStatement")
var _state = _dereq_("./state");
case acorn.tokTypes._return:
this.next()
if (this.eat(acorn.tokTypes.semi) || this.canInsertSemicolon()) node.argument = null
else { node.argument = this.parseExpression(); this.semicolon() }
return this.finishNode(node, "ReturnStatement")
_dereq_("./tokenize");
case acorn.tokTypes._switch:
var blockIndent = this.curIndent, line = this.curLineStart
this.next()
node.discriminant = this.parseParenExpression()
node.cases = []
this.pushCx()
this.expect(acorn.tokTypes.braceL)
_dereq_("./statement");
var cur
while (!this.closes(acorn.tokTypes.braceR, blockIndent, line, true)) {
if (this$1.tok.type === acorn.tokTypes._case || this$1.tok.type === acorn.tokTypes._default) {
var isCase = this$1.tok.type === acorn.tokTypes._case
if (cur) this$1.finishNode(cur, "SwitchCase")
node.cases.push(cur = this$1.startNode())
cur.consequent = []
this$1.next()
if (isCase) cur.test = this$1.parseExpression()
else cur.test = null
this$1.expect(acorn.tokTypes.colon)
} else {
if (!cur) {
node.cases.push(cur = this$1.startNode())
cur.consequent = []
cur.test = null
}
cur.consequent.push(this$1.parseStatement())
}
}
if (cur) this.finishNode(cur, "SwitchCase")
this.popCx()
this.eat(acorn.tokTypes.braceR)
return this.finishNode(node, "SwitchStatement")
_dereq_("./expression");
case acorn.tokTypes._throw:
this.next()
node.argument = this.parseExpression()
this.semicolon()
return this.finishNode(node, "ThrowStatement")
exports.LooseParser = _state.LooseParser;
exports.pluginsLoose = _state.pluginsLoose;
case acorn.tokTypes._try:
this.next()
node.block = this.parseBlock()
node.handler = null
if (this.tok.type === acorn.tokTypes._catch) {
var clause = this.startNode()
this.next()
this.expect(acorn.tokTypes.parenL)
clause.param = this.toAssignable(this.parseExprAtom(), true)
this.expect(acorn.tokTypes.parenR)
clause.body = this.parseBlock()
node.handler = this.finishNode(clause, "CatchClause")
}
node.finalizer = this.eat(acorn.tokTypes._finally) ? this.parseBlock() : null
if (!node.handler && !node.finalizer) return node.block
return this.finishNode(node, "TryStatement")
acorn.defaultOptions.tabSize = 4;
case acorn.tokTypes._var:
case acorn.tokTypes._const:
return this.parseVar(false, kind || this.tok.value)
function parse_dammit(input, options) {
var p = new _state.LooseParser(input, options);
p.next();
return p.parseTopLevel();
}
case acorn.tokTypes._while:
this.next()
node.test = this.parseParenExpression()
node.body = this.parseStatement()
return this.finishNode(node, "WhileStatement")
acorn.parse_dammit = parse_dammit;
acorn.LooseParser = _state.LooseParser;
acorn.pluginsLoose = _state.pluginsLoose;
case acorn.tokTypes._with:
this.next()
node.object = this.parseParenExpression()
node.body = this.parseStatement()
return this.finishNode(node, "WithStatement")
},{"..":1,"./expression":2,"./state":5,"./statement":6,"./tokenize":7}],4:[function(_dereq_,module,exports){
"use strict";
case acorn.tokTypes.braceL:
return this.parseBlock()
exports.__esModule = true;
exports.isDummy = isDummy;
case acorn.tokTypes.semi:
this.next()
return this.finishNode(node, "EmptyStatement")
function isDummy(node) {
return node.name == "✖";
}
case acorn.tokTypes._class:
return this.parseClass(true)
},{}],5:[function(_dereq_,module,exports){
"use strict";
case acorn.tokTypes._import:
return this.parseImport()
exports.__esModule = true;
case acorn.tokTypes._export:
return this.parseExport()
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
default:
var expr = this.parseExpression()
if (isDummy(expr)) {
this.next()
if (this.tok.type === acorn.tokTypes.eof) return this.finishNode(node, "EmptyStatement")
return this.parseStatement()
} else if (starttype === acorn.tokTypes.name && expr.type === "Identifier" && this.eat(acorn.tokTypes.colon)) {
node.body = this.parseStatement()
node.label = expr
return this.finishNode(node, "LabeledStatement")
} else {
node.expression = expr
this.semicolon()
return this.finishNode(node, "ExpressionStatement")
}
}
}
var _ = _dereq_("..");
lp$1.parseBlock = function() {
var this$1 = this;
// Registered plugins
var pluginsLoose = {};
var node = this.startNode()
this.pushCx()
this.expect(acorn.tokTypes.braceL)
var blockIndent = this.curIndent, line = this.curLineStart
node.body = []
while (!this.closes(acorn.tokTypes.braceR, blockIndent, line, true))
node.body.push(this$1.parseStatement())
this.popCx()
this.eat(acorn.tokTypes.braceR)
return this.finishNode(node, "BlockStatement")
}
exports.pluginsLoose = pluginsLoose;
lp$1.parseFor = function(node, init) {
node.init = init
node.test = node.update = null
if (this.eat(acorn.tokTypes.semi) && this.tok.type !== acorn.tokTypes.semi) node.test = this.parseExpression()
if (this.eat(acorn.tokTypes.semi) && this.tok.type !== acorn.tokTypes.parenR) node.update = this.parseExpression()
this.popCx()
this.expect(acorn.tokTypes.parenR)
node.body = this.parseStatement()
return this.finishNode(node, "ForStatement")
}
var LooseParser = (function () {
function LooseParser(input) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
lp$1.parseForIn = function(node, init) {
var type = this.tok.type === acorn.tokTypes._in ? "ForInStatement" : "ForOfStatement"
this.next()
node.left = init
node.right = this.parseExpression()
this.popCx()
this.expect(acorn.tokTypes.parenR)
node.body = this.parseStatement()
return this.finishNode(node, type)
}
_classCallCheck(this, LooseParser);
lp$1.parseVar = function(noIn, kind) {
var this$1 = this;
this.toks = _.tokenizer(input, options);
this.options = this.toks.options;
this.input = this.toks.input;
this.tok = this.last = { type: _.tokTypes.eof, start: 0, end: 0 };
if (this.options.locations) {
var here = this.toks.curPosition();
this.tok.loc = new _.SourceLocation(this.toks, here, here);
var node = this.startNode()
node.kind = kind
this.next()
node.declarations = []
do {
var decl = this$1.startNode()
decl.id = this$1.options.ecmaVersion >= 6 ? this$1.toAssignable(this$1.parseExprAtom(), true) : this$1.parseIdent()
decl.init = this$1.eat(acorn.tokTypes.eq) ? this$1.parseMaybeAssign(noIn) : null
node.declarations.push(this$1.finishNode(decl, "VariableDeclarator"))
} while (this.eat(acorn.tokTypes.comma))
if (!node.declarations.length) {
var decl$1 = this.startNode()
decl$1.id = this.dummyIdent()
node.declarations.push(this.finishNode(decl$1, "VariableDeclarator"))
}
this.ahead = []; // Tokens ahead
this.context = []; // Indentation contexted
this.curIndent = 0;
this.curLineStart = 0;
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
// Load plugins
this.options.pluginsLoose = options.pluginsLoose || {};
this.loadPlugins(this.options.pluginsLoose);
if (!noIn) this.semicolon()
return this.finishNode(node, "VariableDeclaration")
}
LooseParser.prototype.startNode = function startNode() {
return new _.Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null);
};
lp$1.parseClass = function(isStatement) {
var this$1 = this;
LooseParser.prototype.storeCurrentPos = function storeCurrentPos() {
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start;
};
var node = this.startNode()
this.next()
if (this.tok.type === acorn.tokTypes.name) node.id = this.parseIdent()
else if (isStatement) node.id = this.dummyIdent()
else node.id = null
node.superClass = this.eat(acorn.tokTypes._extends) ? this.parseExpression() : null
node.body = this.startNode()
node.body.body = []
this.pushCx()
var indent = this.curIndent + 1, line = this.curLineStart
this.eat(acorn.tokTypes.braceL)
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart }
while (!this.closes(acorn.tokTypes.braceR, indent, line)) {
if (this$1.semicolon()) continue
var method = this$1.startNode(), isGenerator
if (this$1.options.ecmaVersion >= 6) {
method.static = false
isGenerator = this$1.eat(acorn.tokTypes.star)
}
this$1.parsePropertyName(method)
if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) this$1.next(); this$1.eat(acorn.tokTypes.comma); continue }
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
(this$1.tok.type != acorn.tokTypes.parenL && this$1.tok.type != acorn.tokTypes.braceL)) {
method.static = true
isGenerator = this$1.eat(acorn.tokTypes.star)
this$1.parsePropertyName(method)
} else {
method.static = false
}
if (this$1.options.ecmaVersion >= 5 && method.key.type === "Identifier" &&
!method.computed && (method.key.name === "get" || method.key.name === "set") &&
this$1.tok.type !== acorn.tokTypes.parenL && this$1.tok.type !== acorn.tokTypes.braceL) {
method.kind = method.key.name
this$1.parsePropertyName(method)
method.value = this$1.parseMethod(false)
} else {
if (!method.computed && !method.static && !isGenerator && (
method.key.type === "Identifier" && method.key.name === "constructor" ||
method.key.type === "Literal" && method.key.value === "constructor")) {
method.kind = "constructor"
} else {
method.kind = "method"
}
method.value = this$1.parseMethod(isGenerator)
}
node.body.body.push(this$1.finishNode(method, "MethodDefinition"))
}
this.popCx()
if (!this.eat(acorn.tokTypes.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start
if (this.options.locations) this.last.loc.end = this.tok.loc.start
}
this.semicolon()
this.finishNode(node.body, "ClassBody")
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
}
LooseParser.prototype.startNodeAt = function startNodeAt(pos) {
if (this.options.locations) {
return new _.Node(this.toks, pos[0], pos[1]);
lp$1.parseFunction = function(node, isStatement) {
this.initFunction(node)
if (this.options.ecmaVersion >= 6) {
node.generator = this.eat(acorn.tokTypes.star)
}
if (this.tok.type === acorn.tokTypes.name) node.id = this.parseIdent()
else if (isStatement) node.id = this.dummyIdent()
node.params = this.parseFunctionParams()
node.body = this.parseBlock()
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
}
lp$1.parseExport = function() {
var node = this.startNode()
this.next()
if (this.eat(acorn.tokTypes.star)) {
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString()
return this.finishNode(node, "ExportAllDeclaration")
}
if (this.eat(acorn.tokTypes._default)) {
var expr = this.parseMaybeAssign()
if (expr.id) {
switch (expr.type) {
case "FunctionExpression": expr.type = "FunctionDeclaration"; break
case "ClassExpression": expr.type = "ClassDeclaration"; break
}
}
node.declaration = expr
this.semicolon()
return this.finishNode(node, "ExportDefaultDeclaration")
}
if (this.tok.type.keyword || this.toks.isLet()) {
node.declaration = this.parseStatement()
node.specifiers = []
node.source = null
} else {
return new _.Node(this.toks, pos);
node.declaration = null
node.specifiers = this.parseExportSpecifierList()
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
this.semicolon()
}
};
return this.finishNode(node, "ExportNamedDeclaration")
}
LooseParser.prototype.finishNode = function finishNode(node, type) {
node.type = type;
node.end = this.last.end;
if (this.options.locations) node.loc.end = this.last.loc.end;
if (this.options.ranges) node.range[1] = this.last.end;
return node;
};
lp$1.parseImport = function() {
var node = this.startNode()
this.next()
if (this.tok.type === acorn.tokTypes.string) {
node.specifiers = []
node.source = this.parseExprAtom()
node.kind = ''
} else {
var elt
if (this.tok.type === acorn.tokTypes.name && this.tok.value !== "from") {
elt = this.startNode()
elt.local = this.parseIdent()
this.finishNode(elt, "ImportDefaultSpecifier")
this.eat(acorn.tokTypes.comma)
}
node.specifiers = this.parseImportSpecifierList()
node.source = this.eatContextual("from") && this.tok.type == acorn.tokTypes.string ? this.parseExprAtom() : this.dummyString()
if (elt) node.specifiers.unshift(elt)
}
this.semicolon()
return this.finishNode(node, "ImportDeclaration")
}
LooseParser.prototype.dummyNode = function dummyNode(type) {
var dummy = this.startNode();
dummy.type = type;
dummy.end = dummy.start;
if (this.options.locations) dummy.loc.end = dummy.loc.start;
if (this.options.ranges) dummy.range[1] = dummy.start;
this.last = { type: _.tokTypes.name, start: dummy.start, end: dummy.start, loc: dummy.loc };
return dummy;
};
lp$1.parseImportSpecifierList = function() {
var this$1 = this;
LooseParser.prototype.dummyIdent = function dummyIdent() {
var dummy = this.dummyNode("Identifier");
dummy.name = "✖";
return dummy;
};
LooseParser.prototype.dummyString = function dummyString() {
var dummy = this.dummyNode("Literal");
dummy.value = dummy.raw = "✖";
return dummy;
};
LooseParser.prototype.eat = function eat(type) {
if (this.tok.type === type) {
this.next();
return true;
var elts = []
if (this.tok.type === acorn.tokTypes.star) {
var elt = this.startNode()
this.next()
elt.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent()
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"))
} else {
return false;
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart
this.pushCx()
this.eat(acorn.tokTypes.braceL)
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart
while (!this.closes(acorn.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
var elt$1 = this$1.startNode()
if (this$1.eat(acorn.tokTypes.star)) {
elt$1.local = this$1.eatContextual("as") ? this$1.parseIdent() : this$1.dummyIdent()
this$1.finishNode(elt$1, "ImportNamespaceSpecifier")
} else {
if (this$1.isContextual("from")) break
elt$1.imported = this$1.parseIdent()
if (isDummy(elt$1.imported)) break
elt$1.local = this$1.eatContextual("as") ? this$1.parseIdent() : elt$1.imported
this$1.finishNode(elt$1, "ImportSpecifier")
}
elts.push(elt$1)
this$1.eat(acorn.tokTypes.comma)
}
this.eat(acorn.tokTypes.braceR)
this.popCx()
}
};
return elts
}
LooseParser.prototype.isContextual = function isContextual(name) {
return this.tok.type === _.tokTypes.name && this.tok.value === name;
};
lp$1.parseExportSpecifierList = function() {
var this$1 = this;
LooseParser.prototype.eatContextual = function eatContextual(name) {
return this.tok.value === name && this.eat(_.tokTypes.name);
};
LooseParser.prototype.canInsertSemicolon = function canInsertSemicolon() {
return this.tok.type === _.tokTypes.eof || this.tok.type === _.tokTypes.braceR || _.lineBreak.test(this.input.slice(this.last.end, this.tok.start));
};
LooseParser.prototype.semicolon = function semicolon() {
return this.eat(_.tokTypes.semi);
};
LooseParser.prototype.expect = function expect(type) {
if (this.eat(type)) return true;
for (var i = 1; i <= 2; i++) {
if (this.lookAhead(i).type == type) {
for (var j = 0; j < i; j++) {
this.next();
}return true;
}
var elts = []
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart
this.pushCx()
this.eat(acorn.tokTypes.braceL)
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart
while (!this.closes(acorn.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
if (this$1.isContextual("from")) break
var elt = this$1.startNode()
elt.local = this$1.parseIdent()
if (isDummy(elt.local)) break
elt.exported = this$1.eatContextual("as") ? this$1.parseIdent() : elt.local
this$1.finishNode(elt, "ExportSpecifier")
elts.push(elt)
this$1.eat(acorn.tokTypes.comma)
}
};
this.eat(acorn.tokTypes.braceR)
this.popCx()
return elts
}
LooseParser.prototype.pushCx = function pushCx() {
this.context.push(this.curIndent);
};
var lp$2 = LooseParser.prototype
LooseParser.prototype.popCx = function popCx() {
this.curIndent = this.context.pop();
};
lp$2.checkLVal = function(expr) {
if (!expr) return expr
switch (expr.type) {
case "Identifier":
case "MemberExpression":
return expr
LooseParser.prototype.lineEnd = function lineEnd(pos) {
while (pos < this.input.length && !_.isNewLine(this.input.charCodeAt(pos))) ++pos;
return pos;
};
case "ParenthesizedExpression":
expr.expression = this.checkLVal(expr.expression)
return expr
LooseParser.prototype.indentationAfter = function indentationAfter(pos) {
for (var count = 0;; ++pos) {
var ch = this.input.charCodeAt(pos);
if (ch === 32) ++count;else if (ch === 9) count += this.options.tabSize;else return count;
default:
return this.dummyIdent()
}
};
}
LooseParser.prototype.closes = function closes(closeTok, indent, line, blockHeuristic) {
if (this.tok.type === closeTok || this.tok.type === _.tokTypes.eof) return true;
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() && (!blockHeuristic || this.nextLineStart >= this.input.length || this.indentationAfter(this.nextLineStart) < indent);
};
lp$2.parseExpression = function(noIn) {
var this$1 = this;
LooseParser.prototype.tokenStartsLine = function tokenStartsLine() {
for (var p = this.tok.start - 1; p >= this.curLineStart; --p) {
var ch = this.input.charCodeAt(p);
if (ch !== 9 && ch !== 32) return false;
var start = this.storeCurrentPos()
var expr = this.parseMaybeAssign(noIn)
if (this.tok.type === acorn.tokTypes.comma) {
var node = this.startNodeAt(start)
node.expressions = [expr]
while (this.eat(acorn.tokTypes.comma)) node.expressions.push(this$1.parseMaybeAssign(noIn))
return this.finishNode(node, "SequenceExpression")
}
return true;
};
return expr
}
LooseParser.prototype.extend = function extend(name, f) {
this[name] = f(this[name]);
};
lp$2.parseParenExpression = function() {
this.pushCx()
this.expect(acorn.tokTypes.parenL)
var val = this.parseExpression()
this.popCx()
this.expect(acorn.tokTypes.parenR)
return val
}
LooseParser.prototype.loadPlugins = function loadPlugins(pluginConfigs) {
for (var _name in pluginConfigs) {
var plugin = pluginsLoose[_name];
if (!plugin) throw new Error("Plugin '" + _name + "' not found");
plugin(this, pluginConfigs[_name]);
lp$2.parseMaybeAssign = function(noIn) {
if (this.toks.isContextual("yield")) {
var node = this.startNode()
this.next()
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type != acorn.tokTypes.star && !this.tok.type.startsExpr)) {
node.delegate = false
node.argument = null
} else {
node.delegate = this.eat(acorn.tokTypes.star)
node.argument = this.parseMaybeAssign()
}
return this.finishNode(node, "YieldExpression")
}
};
return LooseParser;
})();
var start = this.storeCurrentPos()
var left = this.parseMaybeConditional(noIn)
if (this.tok.type.isAssign) {
var node$1 = this.startNodeAt(start)
node$1.operator = this.tok.value
node$1.left = this.tok.type === acorn.tokTypes.eq ? this.toAssignable(left) : this.checkLVal(left)
this.next()
node$1.right = this.parseMaybeAssign(noIn)
return this.finishNode(node$1, "AssignmentExpression")
}
return left
}
exports.LooseParser = LooseParser;
lp$2.parseMaybeConditional = function(noIn) {
var start = this.storeCurrentPos()
var expr = this.parseExprOps(noIn)
if (this.eat(acorn.tokTypes.question)) {
var node = this.startNodeAt(start)
node.test = expr
node.consequent = this.parseMaybeAssign()
node.alternate = this.expect(acorn.tokTypes.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent()
return this.finishNode(node, "ConditionalExpression")
}
return expr
}
},{"..":1}],6:[function(_dereq_,module,exports){
"use strict";
lp$2.parseExprOps = function(noIn) {
var start = this.storeCurrentPos()
var indent = this.curIndent, line = this.curLineStart
return this.parseExprOp(this.parseMaybeUnary(false), start, -1, noIn, indent, line)
}
var _state = _dereq_("./state");
lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) return left
var prec = this.tok.type.binop
if (prec != null && (!noIn || this.tok.type !== acorn.tokTypes._in)) {
if (prec > minPrec) {
var node = this.startNodeAt(start)
node.left = left
node.operator = this.tok.value
this.next()
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) {
node.right = this.dummyIdent()
} else {
var rightStart = this.storeCurrentPos()
node.right = this.parseExprOp(this.parseMaybeUnary(false), rightStart, prec, noIn, indent, line)
}
this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression")
return this.parseExprOp(node, start, minPrec, noIn, indent, line)
}
}
return left
}
var _parseutil = _dereq_("./parseutil");
lp$2.parseMaybeUnary = function(sawUnary) {
var this$1 = this;
var _ = _dereq_("..");
var start = this.storeCurrentPos(), expr
if (this.tok.type.prefix) {
var node = this.startNode(), update = this.tok.type === acorn.tokTypes.incDec
if (!update) sawUnary = true
node.operator = this.tok.value
node.prefix = true
this.next()
node.argument = this.parseMaybeUnary(true)
if (update) node.argument = this.checkLVal(node.argument)
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
} else if (this.tok.type === acorn.tokTypes.ellipsis) {
var node$1 = this.startNode()
this.next()
node$1.argument = this.parseMaybeUnary(sawUnary)
expr = this.finishNode(node$1, "SpreadElement")
} else {
expr = this.parseExprSubscripts()
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
var node$2 = this$1.startNodeAt(start)
node$2.operator = this$1.tok.value
node$2.prefix = false
node$2.argument = this$1.checkLVal(expr)
this$1.next()
expr = this$1.finishNode(node$2, "UpdateExpression")
}
}
var lp = _state.LooseParser.prototype;
if (!sawUnary && this.eat(acorn.tokTypes.starstar)) {
var node$3 = this.startNodeAt(start)
node$3.operator = "**"
node$3.left = expr
node$3.right = this.parseMaybeUnary(false)
return this.finishNode(node$3, "BinaryExpression")
}
lp.parseTopLevel = function () {
var node = this.startNodeAt(this.options.locations ? [0, _.getLineInfo(this.input, 0)] : 0);
node.body = [];
while (this.tok.type !== _.tokTypes.eof) node.body.push(this.parseStatement());
this.last = this.tok;
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType;
return expr
}
return this.finishNode(node, "Program");
};
lp.parseStatement = function () {
var starttype = this.tok.type,
node = this.startNode(),
kind = undefined;
if (this.toks.isLet()) {
starttype = _.tokTypes._var;
kind = "let";
lp$2.parseExprSubscripts = function() {
var start = this.storeCurrentPos()
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart)
}
switch (starttype) {
case _.tokTypes._break:case _.tokTypes._continue:
this.next();
var isBreak = starttype === _.tokTypes._break;
if (this.semicolon() || this.canInsertSemicolon()) {
node.label = null;
lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
var this$1 = this;
for (;;) {
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) {
if (this$1.tok.type == acorn.tokTypes.dot && this$1.curIndent == startIndent)
--startIndent
else
return base
}
if (this$1.eat(acorn.tokTypes.dot)) {
var node = this$1.startNodeAt(start)
node.object = base
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine())
node.property = this$1.dummyIdent()
else
node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent()
node.computed = false
base = this$1.finishNode(node, "MemberExpression")
} else if (this$1.tok.type == acorn.tokTypes.bracketL) {
this$1.pushCx()
this$1.next()
var node$1 = this$1.startNodeAt(start)
node$1.object = base
node$1.property = this$1.parseExpression()
node$1.computed = true
this$1.popCx()
this$1.expect(acorn.tokTypes.bracketR)
base = this$1.finishNode(node$1, "MemberExpression")
} else if (!noCalls && this$1.tok.type == acorn.tokTypes.parenL) {
var node$2 = this$1.startNodeAt(start)
node$2.callee = base
node$2.arguments = this$1.parseExprList(acorn.tokTypes.parenR)
base = this$1.finishNode(node$2, "CallExpression")
} else if (this$1.tok.type == acorn.tokTypes.backQuote) {
var node$3 = this$1.startNodeAt(start)
node$3.tag = base
node$3.quasi = this$1.parseTemplate()
base = this$1.finishNode(node$3, "TaggedTemplateExpression")
} else {
node.label = this.tok.type === _.tokTypes.name ? this.parseIdent() : null;
this.semicolon();
return base
}
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
}
}
case _.tokTypes._debugger:
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
lp$2.parseExprAtom = function() {
var node
switch (this.tok.type) {
case acorn.tokTypes._this:
case acorn.tokTypes._super:
var type = this.tok.type === acorn.tokTypes._this ? "ThisExpression" : "Super"
node = this.startNode()
this.next()
return this.finishNode(node, type)
case _.tokTypes._do:
this.next();
node.body = this.parseStatement();
node.test = this.eat(_.tokTypes._while) ? this.parseParenExpression() : this.dummyIdent();
this.semicolon();
return this.finishNode(node, "DoWhileStatement");
case acorn.tokTypes.name:
var start = this.storeCurrentPos()
var id = this.parseIdent()
return this.eat(acorn.tokTypes.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id]) : id
case _.tokTypes._for:
this.next();
this.pushCx();
this.expect(_.tokTypes.parenL);
if (this.tok.type === _.tokTypes.semi) return this.parseFor(node, null);
var isLet = this.toks.isLet();
if (isLet || this.tok.type === _.tokTypes._var || this.tok.type === _.tokTypes._const) {
var _init = this.parseVar(true, isLet ? "let" : this.tok.value);
if (_init.declarations.length === 1 && (this.tok.type === _.tokTypes._in || this.isContextual("of"))) {
return this.parseForIn(node, _init);
}
return this.parseFor(node, _init);
}
var init = this.parseExpression(true);
if (this.tok.type === _.tokTypes._in || this.isContextual("of")) return this.parseForIn(node, this.toAssignable(init));
return this.parseFor(node, init);
case acorn.tokTypes.regexp:
node = this.startNode()
var val = this.tok.value
node.regex = {pattern: val.pattern, flags: val.flags}
node.value = val.value
node.raw = this.input.slice(this.tok.start, this.tok.end)
this.next()
return this.finishNode(node, "Literal")
case _.tokTypes._function:
this.next();
return this.parseFunction(node, true);
case acorn.tokTypes.num: case acorn.tokTypes.string:
node = this.startNode()
node.value = this.tok.value
node.raw = this.input.slice(this.tok.start, this.tok.end)
this.next()
return this.finishNode(node, "Literal")
case _.tokTypes._if:
this.next();
node.test = this.parseParenExpression();
node.consequent = this.parseStatement();
node.alternate = this.eat(_.tokTypes._else) ? this.parseStatement() : null;
return this.finishNode(node, "IfStatement");
case acorn.tokTypes._null: case acorn.tokTypes._true: case acorn.tokTypes._false:
node = this.startNode()
node.value = this.tok.type === acorn.tokTypes._null ? null : this.tok.type === acorn.tokTypes._true
node.raw = this.tok.type.keyword
this.next()
return this.finishNode(node, "Literal")
case _.tokTypes._return:
this.next();
if (this.eat(_.tokTypes.semi) || this.canInsertSemicolon()) node.argument = null;else {
node.argument = this.parseExpression();this.semicolon();
case acorn.tokTypes.parenL:
var parenStart = this.storeCurrentPos()
this.next()
var inner = this.parseExpression()
this.expect(acorn.tokTypes.parenR)
if (this.eat(acorn.tokTypes.arrow)) {
return this.parseArrowExpression(this.startNodeAt(parenStart), inner.expressions || (isDummy(inner) ? [] : [inner]))
}
return this.finishNode(node, "ReturnStatement");
case _.tokTypes._switch:
var blockIndent = this.curIndent,
line = this.curLineStart;
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
this.pushCx();
this.expect(_.tokTypes.braceL);
var cur = undefined;
while (!this.closes(_.tokTypes.braceR, blockIndent, line, true)) {
if (this.tok.type === _.tokTypes._case || this.tok.type === _.tokTypes._default) {
var isCase = this.tok.type === _.tokTypes._case;
if (cur) this.finishNode(cur, "SwitchCase");
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) cur.test = this.parseExpression();else cur.test = null;
this.expect(_.tokTypes.colon);
} else {
if (!cur) {
node.cases.push(cur = this.startNode());
cur.consequent = [];
cur.test = null;
}
cur.consequent.push(this.parseStatement());
}
if (this.options.preserveParens) {
var par = this.startNodeAt(parenStart)
par.expression = inner
inner = this.finishNode(par, "ParenthesizedExpression")
}
if (cur) this.finishNode(cur, "SwitchCase");
this.popCx();
this.eat(_.tokTypes.braceR);
return this.finishNode(node, "SwitchStatement");
return inner
case _.tokTypes._throw:
this.next();
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
case acorn.tokTypes.bracketL:
node = this.startNode()
node.elements = this.parseExprList(acorn.tokTypes.bracketR, true)
return this.finishNode(node, "ArrayExpression")
case _.tokTypes._try:
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.tok.type === _.tokTypes._catch) {
var clause = this.startNode();
this.next();
this.expect(_.tokTypes.parenL);
clause.param = this.toAssignable(this.parseExprAtom(), true);
this.expect(_.tokTypes.parenR);
clause.body = this.parseBlock();
node.handler = this.finishNode(clause, "CatchClause");
}
node.finalizer = this.eat(_.tokTypes._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) return node.block;
return this.finishNode(node, "TryStatement");
case acorn.tokTypes.braceL:
return this.parseObj()
case _.tokTypes._var:
case _.tokTypes._const:
return this.parseVar(false, kind || this.tok.value);
case acorn.tokTypes._class:
return this.parseClass()
case _.tokTypes._while:
this.next();
node.test = this.parseParenExpression();
node.body = this.parseStatement();
return this.finishNode(node, "WhileStatement");
case acorn.tokTypes._function:
node = this.startNode()
this.next()
return this.parseFunction(node, false)
case _.tokTypes._with:
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement();
return this.finishNode(node, "WithStatement");
case acorn.tokTypes._new:
return this.parseNew()
case _.tokTypes.braceL:
return this.parseBlock();
case acorn.tokTypes.backQuote:
return this.parseTemplate()
case _.tokTypes.semi:
this.next();
return this.finishNode(node, "EmptyStatement");
default:
return this.dummyIdent()
}
}
case _.tokTypes._class:
return this.parseClass(true);
lp$2.parseNew = function() {
var node = this.startNode(), startIndent = this.curIndent, line = this.curLineStart
var meta = this.parseIdent(true)
if (this.options.ecmaVersion >= 6 && this.eat(acorn.tokTypes.dot)) {
node.meta = meta
node.property = this.parseIdent(true)
return this.finishNode(node, "MetaProperty")
}
var start = this.storeCurrentPos()
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line)
if (this.tok.type == acorn.tokTypes.parenL) {
node.arguments = this.parseExprList(acorn.tokTypes.parenR)
} else {
node.arguments = []
}
return this.finishNode(node, "NewExpression")
}
case _.tokTypes._import:
return this.parseImport();
lp$2.parseTemplateElement = function() {
var elem = this.startNode()
elem.value = {
raw: this.input.slice(this.tok.start, this.tok.end).replace(/\r\n?/g, '\n'),
cooked: this.tok.value
}
this.next()
elem.tail = this.tok.type === acorn.tokTypes.backQuote
return this.finishNode(elem, "TemplateElement")
}
case _.tokTypes._export:
return this.parseExport();
lp$2.parseTemplate = function() {
var this$1 = this;
default:
var expr = this.parseExpression();
if (_parseutil.isDummy(expr)) {
this.next();
if (this.tok.type === _.tokTypes.eof) return this.finishNode(node, "EmptyStatement");
return this.parseStatement();
} else if (starttype === _.tokTypes.name && expr.type === "Identifier" && this.eat(_.tokTypes.colon)) {
node.body = this.parseStatement();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
var node = this.startNode()
this.next()
node.expressions = []
var curElt = this.parseTemplateElement()
node.quasis = [curElt]
while (!curElt.tail) {
this$1.next()
node.expressions.push(this$1.parseExpression())
if (this$1.expect(acorn.tokTypes.braceR)) {
curElt = this$1.parseTemplateElement()
} else {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
curElt = this$1.startNode()
curElt.value = {cooked: '', raw: ''}
curElt.tail = true
this$1.finishNode(curElt, "TemplateElement")
}
node.quasis.push(curElt)
}
this.expect(acorn.tokTypes.backQuote)
return this.finishNode(node, "TemplateLiteral")
}
};
lp.parseBlock = function () {
var node = this.startNode();
this.pushCx();
this.expect(_.tokTypes.braceL);
var blockIndent = this.curIndent,
line = this.curLineStart;
node.body = [];
while (!this.closes(_.tokTypes.braceR, blockIndent, line, true)) node.body.push(this.parseStatement());
this.popCx();
this.eat(_.tokTypes.braceR);
return this.finishNode(node, "BlockStatement");
};
lp$2.parseObj = function() {
var this$1 = this;
lp.parseFor = function (node, init) {
node.init = init;
node.test = node.update = null;
if (this.eat(_.tokTypes.semi) && this.tok.type !== _.tokTypes.semi) node.test = this.parseExpression();
if (this.eat(_.tokTypes.semi) && this.tok.type !== _.tokTypes.parenR) node.update = this.parseExpression();
this.popCx();
this.expect(_.tokTypes.parenR);
node.body = this.parseStatement();
return this.finishNode(node, "ForStatement");
};
lp.parseForIn = function (node, init) {
var type = this.tok.type === _.tokTypes._in ? "ForInStatement" : "ForOfStatement";
this.next();
node.left = init;
node.right = this.parseExpression();
this.popCx();
this.expect(_.tokTypes.parenR);
node.body = this.parseStatement();
return this.finishNode(node, type);
};
lp.parseVar = function (noIn, kind) {
var node = this.startNode();
node.kind = kind;
this.next();
node.declarations = [];
do {
var decl = this.startNode();
decl.id = this.options.ecmaVersion >= 6 ? this.toAssignable(this.parseExprAtom(), true) : this.parseIdent();
decl.init = this.eat(_.tokTypes.eq) ? this.parseMaybeAssign(noIn) : null;
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
} while (this.eat(_.tokTypes.comma));
if (!node.declarations.length) {
var decl = this.startNode();
decl.id = this.dummyIdent();
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
var node = this.startNode()
node.properties = []
this.pushCx()
var indent = this.curIndent + 1, line = this.curLineStart
this.eat(acorn.tokTypes.braceL)
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart }
while (!this.closes(acorn.tokTypes.braceR, indent, line)) {
var prop = this$1.startNode(), isGenerator, start
if (this$1.options.ecmaVersion >= 6) {
start = this$1.storeCurrentPos()
prop.method = false
prop.shorthand = false
isGenerator = this$1.eat(acorn.tokTypes.star)
}
this$1.parsePropertyName(prop)
if (isDummy(prop.key)) { if (isDummy(this$1.parseMaybeAssign())) this$1.next(); this$1.eat(acorn.tokTypes.comma); continue }
if (this$1.eat(acorn.tokTypes.colon)) {
prop.kind = "init"
prop.value = this$1.parseMaybeAssign()
} else if (this$1.options.ecmaVersion >= 6 && (this$1.tok.type === acorn.tokTypes.parenL || this$1.tok.type === acorn.tokTypes.braceL)) {
prop.kind = "init"
prop.method = true
prop.value = this$1.parseMethod(isGenerator)
} else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
(this$1.tok.type != acorn.tokTypes.comma && this$1.tok.type != acorn.tokTypes.braceR)) {
prop.kind = prop.key.name
this$1.parsePropertyName(prop)
prop.value = this$1.parseMethod(false)
} else {
prop.kind = "init"
if (this$1.options.ecmaVersion >= 6) {
if (this$1.eat(acorn.tokTypes.eq)) {
var assign = this$1.startNodeAt(start)
assign.operator = "="
assign.left = prop.key
assign.right = this$1.parseMaybeAssign()
prop.value = this$1.finishNode(assign, "AssignmentExpression")
} else {
prop.value = prop.key
}
} else {
prop.value = this$1.dummyIdent()
}
prop.shorthand = true
}
node.properties.push(this$1.finishNode(prop, "Property"))
this$1.eat(acorn.tokTypes.comma)
}
this.popCx()
if (!this.eat(acorn.tokTypes.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start
if (this.options.locations) this.last.loc.end = this.tok.loc.start
}
return this.finishNode(node, "ObjectExpression")
}
if (!noIn) this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
lp.parseClass = function (isStatement) {
var node = this.startNode();
this.next();
if (this.tok.type === _.tokTypes.name) node.id = this.parseIdent();else if (isStatement) node.id = this.dummyIdent();else node.id = null;
node.superClass = this.eat(_.tokTypes._extends) ? this.parseExpression() : null;
node.body = this.startNode();
node.body.body = [];
this.pushCx();
var indent = this.curIndent + 1,
line = this.curLineStart;
this.eat(_.tokTypes.braceL);
if (this.curIndent + 1 < indent) {
indent = this.curIndent;line = this.curLineStart;
}
while (!this.closes(_.tokTypes.braceR, indent, line)) {
if (this.semicolon()) continue;
var method = this.startNode(),
isGenerator = undefined;
lp$2.parsePropertyName = function(prop) {
if (this.options.ecmaVersion >= 6) {
method["static"] = false;
isGenerator = this.eat(_.tokTypes.star);
}
this.parsePropertyName(method);
if (_parseutil.isDummy(method.key)) {
if (_parseutil.isDummy(this.parseMaybeAssign())) this.next();this.eat(_.tokTypes.comma);continue;
}
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" && this.tok.type != _.tokTypes.parenL && this.tok.type != _.tokTypes.braceL) {
method["static"] = true;
isGenerator = this.eat(_.tokTypes.star);
this.parsePropertyName(method);
} else {
method["static"] = false;
}
if (this.options.ecmaVersion >= 5 && method.key.type === "Identifier" && !method.computed && (method.key.name === "get" || method.key.name === "set") && this.tok.type !== _.tokTypes.parenL && this.tok.type !== _.tokTypes.braceL) {
method.kind = method.key.name;
this.parsePropertyName(method);
method.value = this.parseMethod(false);
} else {
if (!method.computed && !method["static"] && !isGenerator && (method.key.type === "Identifier" && method.key.name === "constructor" || method.key.type === "Literal" && method.key.value === "constructor")) {
method.kind = "constructor";
if (this.eat(acorn.tokTypes.bracketL)) {
prop.computed = true
prop.key = this.parseExpression()
this.expect(acorn.tokTypes.bracketR)
return
} else {
method.kind = "method";
prop.computed = false
}
method.value = this.parseMethod(isGenerator);
}
node.body.body.push(this.finishNode(method, "MethodDefinition"));
var key = (this.tok.type === acorn.tokTypes.num || this.tok.type === acorn.tokTypes.string) ? this.parseExprAtom() : this.parseIdent()
prop.key = key || this.dummyIdent()
}
this.popCx();
if (!this.eat(_.tokTypes.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start;
if (this.options.locations) this.last.loc.end = this.tok.loc.start;
lp$2.parsePropertyAccessor = function() {
if (this.tok.type === acorn.tokTypes.name || this.tok.type.keyword) return this.parseIdent()
}
this.semicolon();
this.finishNode(node.body, "ClassBody");
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
lp.parseFunction = function (node, isStatement) {
this.initFunction(node);
if (this.options.ecmaVersion >= 6) {
node.generator = this.eat(_.tokTypes.star);
lp$2.parseIdent = function() {
var name = this.tok.type === acorn.tokTypes.name ? this.tok.value : this.tok.type.keyword
if (!name) return this.dummyIdent()
var node = this.startNode()
this.next()
node.name = name
return this.finishNode(node, "Identifier")
}
if (this.tok.type === _.tokTypes.name) node.id = this.parseIdent();else if (isStatement) node.id = this.dummyIdent();
node.params = this.parseFunctionParams();
node.body = this.parseBlock();
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
};
lp.parseExport = function () {
var node = this.startNode();
this.next();
if (this.eat(_.tokTypes.star)) {
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString();
return this.finishNode(node, "ExportAllDeclaration");
}
if (this.eat(_.tokTypes._default)) {
var expr = this.parseMaybeAssign();
if (expr.id) {
switch (expr.type) {
case "FunctionExpression":
expr.type = "FunctionDeclaration";break;
case "ClassExpression":
expr.type = "ClassDeclaration";break;
}
lp$2.initFunction = function(node) {
node.id = null
node.params = []
if (this.options.ecmaVersion >= 6) {
node.generator = false
node.expression = false
}
node.declaration = expr;
this.semicolon();
return this.finishNode(node, "ExportDefaultDeclaration");
}
if (this.tok.type.keyword || this.toks.isLet()) {
node.declaration = this.parseStatement();
node.specifiers = [];
node.source = null;
} else {
node.declaration = null;
node.specifiers = this.parseExportSpecifierList();
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
this.semicolon();
}
return this.finishNode(node, "ExportNamedDeclaration");
};
lp.parseImport = function () {
var node = this.startNode();
this.next();
if (this.tok.type === _.tokTypes.string) {
node.specifiers = [];
node.source = this.parseExprAtom();
node.kind = '';
} else {
var elt = undefined;
if (this.tok.type === _.tokTypes.name && this.tok.value !== "from") {
elt = this.startNode();
elt.local = this.parseIdent();
this.finishNode(elt, "ImportDefaultSpecifier");
this.eat(_.tokTypes.comma);
// Convert existing expression atom to assignable pattern
// if possible.
lp$2.toAssignable = function(node, binding) {
var this$1 = this;
if (!node || node.type == "Identifier" || (node.type == "MemberExpression" && !binding)) {
// Okay
} else if (node.type == "ParenthesizedExpression") {
node.expression = this.toAssignable(node.expression, binding)
} else if (this.options.ecmaVersion < 6) {
return this.dummyIdent()
} else if (node.type == "ObjectExpression") {
node.type = "ObjectPattern"
var props = node.properties
for (var i = 0; i < props.length; i++)
props[i].value = this$1.toAssignable(props[i].value, binding)
} else if (node.type == "ArrayExpression") {
node.type = "ArrayPattern"
this.toAssignableList(node.elements, binding)
} else if (node.type == "SpreadElement") {
node.type = "RestElement"
node.argument = this.toAssignable(node.argument, binding)
} else if (node.type == "AssignmentExpression") {
node.type = "AssignmentPattern"
delete node.operator
} else {
return this.dummyIdent()
}
node.specifiers = this.parseImportSpecifierList();
node.source = this.eatContextual("from") && this.tok.type == _.tokTypes.string ? this.parseExprAtom() : this.dummyString();
if (elt) node.specifiers.unshift(elt);
return node
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
lp.parseImportSpecifierList = function () {
var elts = [];
if (this.tok.type === _.tokTypes.star) {
var elt = this.startNode();
this.next();
elt.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent();
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"));
} else {
var indent = this.curIndent,
line = this.curLineStart,
continuedLine = this.nextLineStart;
this.pushCx();
this.eat(_.tokTypes.braceL);
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart;
while (!this.closes(_.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
var elt = this.startNode();
if (this.eat(_.tokTypes.star)) {
elt.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent();
this.finishNode(elt, "ImportNamespaceSpecifier");
} else {
if (this.isContextual("from")) break;
elt.imported = this.parseIdent();
if (_parseutil.isDummy(elt.imported)) break;
elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported;
this.finishNode(elt, "ImportSpecifier");
}
elts.push(elt);
this.eat(_.tokTypes.comma);
}
this.eat(_.tokTypes.braceR);
this.popCx();
lp$2.toAssignableList = function(exprList, binding) {
var this$1 = this;
for (var i = 0; i < exprList.length; i++)
exprList[i] = this$1.toAssignable(exprList[i], binding)
return exprList
}
return elts;
};
lp.parseExportSpecifierList = function () {
var elts = [];
var indent = this.curIndent,
line = this.curLineStart,
continuedLine = this.nextLineStart;
this.pushCx();
this.eat(_.tokTypes.braceL);
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart;
while (!this.closes(_.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
if (this.isContextual("from")) break;
var elt = this.startNode();
elt.local = this.parseIdent();
if (_parseutil.isDummy(elt.local)) break;
elt.exported = this.eatContextual("as") ? this.parseIdent() : elt.local;
this.finishNode(elt, "ExportSpecifier");
elts.push(elt);
this.eat(_.tokTypes.comma);
lp$2.parseFunctionParams = function(params) {
params = this.parseExprList(acorn.tokTypes.parenR)
return this.toAssignableList(params, true)
}
this.eat(_.tokTypes.braceR);
this.popCx();
return elts;
};
},{"..":1,"./parseutil":4,"./state":5}],7:[function(_dereq_,module,exports){
"use strict";
lp$2.parseMethod = function(isGenerator) {
var node = this.startNode()
this.initFunction(node)
node.params = this.parseFunctionParams()
node.generator = isGenerator || false
node.expression = this.options.ecmaVersion >= 6 && this.tok.type !== acorn.tokTypes.braceL
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock()
return this.finishNode(node, "FunctionExpression")
}
var _ = _dereq_("..");
lp$2.parseArrowExpression = function(node, params) {
this.initFunction(node)
node.params = this.toAssignableList(params, true)
node.expression = this.tok.type !== acorn.tokTypes.braceL
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock()
return this.finishNode(node, "ArrowFunctionExpression")
}
var _state = _dereq_("./state");
lp$2.parseExprList = function(close, allowEmpty) {
var this$1 = this;
var lp = _state.LooseParser.prototype;
function isSpace(ch) {
return ch < 14 && ch > 8 || ch === 32 || ch === 160 || _.isNewLine(ch);
}
lp.next = function () {
this.last = this.tok;
if (this.ahead.length) this.tok = this.ahead.shift();else this.tok = this.readToken();
if (this.tok.start >= this.nextLineStart) {
while (this.tok.start >= this.nextLineStart) {
this.curLineStart = this.nextLineStart;
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
}
this.curIndent = this.indentationAfter(this.curLineStart);
}
};
lp.readToken = function () {
for (;;) {
try {
this.toks.next();
if (this.toks.type === _.tokTypes.dot && this.input.substr(this.toks.end, 1) === "." && this.options.ecmaVersion >= 6) {
this.toks.end++;
this.toks.type = _.tokTypes.ellipsis;
this.pushCx()
var indent = this.curIndent, line = this.curLineStart, elts = []
this.next() // Opening bracket
while (!this.closes(close, indent + 1, line)) {
if (this$1.eat(acorn.tokTypes.comma)) {
elts.push(allowEmpty ? null : this$1.dummyIdent())
continue
}
return new _.Token(this.toks);
} catch (e) {
if (!(e instanceof SyntaxError)) throw e;
// Try to skip some text, based on the error message, and then continue
var msg = e.message,
pos = e.raisedAt,
replace = true;
if (/unterminated/i.test(msg)) {
pos = this.lineEnd(e.pos + 1);
if (/string/.test(msg)) {
replace = { start: e.pos, end: pos, type: _.tokTypes.string, value: this.input.slice(e.pos + 1, pos) };
} else if (/regular expr/i.test(msg)) {
var re = this.input.slice(e.pos, pos);
try {
re = new RegExp(re);
} catch (e) {}
replace = { start: e.pos, end: pos, type: _.tokTypes.regexp, value: re };
} else if (/template/.test(msg)) {
replace = { start: e.pos, end: pos,
type: _.tokTypes.template,
value: this.input.slice(e.pos, pos) };
} else {
replace = false;
}
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos;
} else if (/character escape|expected hexadecimal/i.test(msg)) {
while (pos < this.input.length) {
var ch = this.input.charCodeAt(pos++);
if (ch === 34 || ch === 39 || _.isNewLine(ch)) break;
}
} else if (/unexpected character/i.test(msg)) {
pos++;
replace = false;
} else if (/regular expression/i.test(msg)) {
replace = true;
var elt = this$1.parseMaybeAssign()
if (isDummy(elt)) {
if (this$1.closes(close, indent, line)) break
this$1.next()
} else {
throw e;
elts.push(elt)
}
this.resetTo(pos);
if (replace === true) replace = { start: pos, end: pos, type: _.tokTypes.name, value: "✖" };
if (replace) {
if (this.options.locations) replace.loc = new _.SourceLocation(this.toks, _.getLineInfo(this.input, replace.start), _.getLineInfo(this.input, replace.end));
return replace;
}
this$1.eat(acorn.tokTypes.comma)
}
this.popCx()
if (!this.eat(close)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start
if (this.options.locations) this.last.loc.end = this.tok.loc.start
}
return elts
}
};
lp.resetTo = function (pos) {
this.toks.pos = pos;
var ch = this.input.charAt(pos - 1);
this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) || /[enwfd]/.test(ch) && /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos));
acorn__default.defaultOptions.tabSize = 4
if (this.options.locations) {
this.toks.curLine = 1;
this.toks.lineStart = _.lineBreakG.lastIndex = 0;
var match = undefined;
while ((match = _.lineBreakG.exec(this.input)) && match.index < pos) {
++this.toks.curLine;
this.toks.lineStart = match.index + match[0].length;
}
function parse_dammit(input, options) {
var p = new LooseParser(input, options)
p.next()
return p.parseTopLevel()
}
};
lp.lookAhead = function (n) {
while (n > this.ahead.length) this.ahead.push(this.readToken());
return this.ahead[n - 1];
};
acorn__default.parse_dammit = parse_dammit
acorn__default.LooseParser = LooseParser
acorn__default.pluginsLoose = pluginsLoose
},{"..":1,"./state":5}]},{},[3])(3)
});
exports.parse_dammit = parse_dammit;
exports.LooseParser = LooseParser;
exports.pluginsLoose = pluginsLoose;
Object.defineProperty(exports, '__esModule', { value: true });
}));

@@ -1,379 +0,360 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).walk = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
// AST walker module for Mozilla Parser API compatible trees
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.acorn = global.acorn || {}, global.acorn.walk = global.acorn.walk || {})));
}(this, function (exports) { 'use strict';
// A simple walk is one where you simply specify callbacks to be
// called on specific nodes. The last two arguments are optional. A
// simple use would be
//
// walk.simple(myTree, {
// Expression: function(node) { ... }
// });
//
// to do something with all expressions. All Parser API node types
// can be used to identify node types, as well as Expression,
// Statement, and ScopeBody, which denote categories of nodes.
//
// The base argument can be used to pass a custom (recursive)
// walker, and state can be used to give this walked an initial
// state.
// AST walker module for Mozilla Parser API compatible trees
"use strict";
// A simple walk is one where you simply specify callbacks to be
// called on specific nodes. The last two arguments are optional. A
// simple use would be
//
// walk.simple(myTree, {
// Expression: function(node) { ... }
// });
//
// to do something with all expressions. All Parser API node types
// can be used to identify node types, as well as Expression,
// Statement, and ScopeBody, which denote categories of nodes.
//
// The base argument can be used to pass a custom (recursive)
// walker, and state can be used to give this walked an initial
// state.
exports.__esModule = true;
exports.simple = simple;
exports.ancestor = ancestor;
exports.recursive = recursive;
exports.findNodeAt = findNodeAt;
exports.findNodeAround = findNodeAround;
exports.findNodeAfter = findNodeAfter;
exports.findNodeBefore = findNodeBefore;
exports.make = make;
function simple(node, visitors, base, state, override) {
if (!base) base = exports.base
;(function c(node, st, override) {
var type = override || node.type, found = visitors[type]
base[type](node, st, c)
if (found) found(node, st)
})(node, state, override)
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// An ancestor walk keeps an array of ancestor nodes (including the
// current node) and passes them to the callback as third parameter
// (and also as state parameter when no other state is present).
function ancestor(node, visitors, base, state) {
if (!base) base = exports.base
var ancestors = []
;(function c(node, st, override) {
var type = override || node.type, found = visitors[type]
var isNew = node != ancestors[ancestors.length - 1]
if (isNew) ancestors.push(node)
base[type](node, st, c)
if (found) found(node, st || ancestors, ancestors)
if (isNew) ancestors.pop()
})(node, state)
}
function simple(node, visitors, base, state, override) {
if (!base) base = exports.base;(function c(node, st, override) {
var type = override || node.type,
found = visitors[type];
base[type](node, st, c);
if (found) found(node, st);
})(node, state, override);
}
// A recursive walk is one where your functions override the default
// walkers. They can modify and replace the state parameter that's
// threaded through the walk, and can opt how and whether to walk
// their child nodes (by calling their third argument on these
// nodes).
function recursive(node, state, funcs, base, override) {
var visitor = funcs ? exports.make(funcs, base) : base
;(function c(node, st, override) {
visitor[override || node.type](node, st, c)
})(node, state, override)
}
// An ancestor walk keeps an array of ancestor nodes (including the
// current node) and passes them to the callback as third parameter
// (and also as state parameter when no other state is present).
function makeTest(test) {
if (typeof test == "string")
return function (type) { return type == test; }
else if (!test)
return function () { return true; }
else
return test
}
function ancestor(node, visitors, base, state) {
if (!base) base = exports.base;
var ancestors = [];(function c(node, st, override) {
var type = override || node.type,
found = visitors[type];
var isNew = node != ancestors[ancestors.length - 1];
if (isNew) ancestors.push(node);
base[type](node, st, c);
if (found) found(node, st || ancestors, ancestors);
if (isNew) ancestors.pop();
})(node, state);
}
var Found = function Found(node, state) { this.node = node; this.state = state };
// A recursive walk is one where your functions override the default
// walkers. They can modify and replace the state parameter that's
// threaded through the walk, and can opt how and whether to walk
// their child nodes (by calling their third argument on these
// nodes).
// Find a node with a given start, end, and type (all are optional,
// null can be used as wildcard). Returns a {node, state} object, or
// undefined when it doesn't find a matching node.
function findNodeAt(node, start, end, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
try {
;(function c(node, st, override) {
var type = override || node.type
if ((start == null || node.start <= start) &&
(end == null || node.end >= end))
base[type](node, st, c)
if ((start == null || node.start == start) &&
(end == null || node.end == end) &&
test(type, node))
throw new Found(node, st)
})(node, state)
} catch (e) {
if (e instanceof Found) return e
throw e
}
}
function recursive(node, state, funcs, base, override) {
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {
visitor[override || node.type](node, st, c);
})(node, state, override);
}
// Find the innermost node of a given type that contains the given
// position. Interface similar to findNodeAt.
function findNodeAround(node, pos, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
try {
;(function c(node, st, override) {
var type = override || node.type
if (node.start > pos || node.end < pos) return
base[type](node, st, c)
if (test(type, node)) throw new Found(node, st)
})(node, state)
} catch (e) {
if (e instanceof Found) return e
throw e
}
}
function makeTest(test) {
if (typeof test == "string") return function (type) {
return type == test;
};else if (!test) return function () {
return true;
};else return test;
}
// Find the outermost matching node after a given position.
function findNodeAfter(node, pos, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
try {
;(function c(node, st, override) {
if (node.end < pos) return
var type = override || node.type
if (node.start >= pos && test(type, node)) throw new Found(node, st)
base[type](node, st, c)
})(node, state)
} catch (e) {
if (e instanceof Found) return e
throw e
}
}
var Found = function Found(node, state) {
_classCallCheck(this, Found);
this.node = node;this.state = state;
}
// Find a node with a given start, end, and type (all are optional,
// null can be used as wildcard). Returns a {node, state} object, or
// undefined when it doesn't find a matching node.
;
function findNodeAt(node, start, end, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
try {
// Find the outermost matching node before a given position.
function findNodeBefore(node, pos, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
var max
;(function c(node, st, override) {
var type = override || node.type;
if ((start == null || node.start <= start) && (end == null || node.end >= end)) base[type](node, st, c);
if ((start == null || node.start == start) && (end == null || node.end == end) && test(type, node)) throw new Found(node, st);
})(node, state);
} catch (e) {
if (e instanceof Found) return e;
throw e;
if (node.start > pos) return
var type = override || node.type
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
max = new Found(node, st)
base[type](node, st, c)
})(node, state)
return max
}
}
// Find the innermost node of a given type that contains the given
// position. Interface similar to findNodeAt.
function findNodeAround(node, pos, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
try {
;(function c(node, st, override) {
var type = override || node.type;
if (node.start > pos || node.end < pos) return;
base[type](node, st, c);
if (test(type, node)) throw new Found(node, st);
})(node, state);
} catch (e) {
if (e instanceof Found) return e;
throw e;
// Fallback to an Object.create polyfill for older environments.
var create = Object.create || function(proto) {
function Ctor() {}
Ctor.prototype = proto
return new Ctor
}
}
// Find the outermost matching node after a given position.
function findNodeAfter(node, pos, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
try {
;(function c(node, st, override) {
if (node.end < pos) return;
var type = override || node.type;
if (node.start >= pos && test(type, node)) throw new Found(node, st);
base[type](node, st, c);
})(node, state);
} catch (e) {
if (e instanceof Found) return e;
throw e;
// Used to create a custom walker. Will fill in all missing node
// type properties with the defaults.
function make(funcs, base) {
if (!base) base = exports.base
var visitor = create(base)
for (var type in funcs) visitor[type] = funcs[type]
return visitor
}
}
// Find the outermost matching node before a given position.
function skipThrough(node, st, c) { c(node, st) }
function ignore(_node, _st, _c) {}
function findNodeBefore(node, pos, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
var max = undefined;(function c(node, st, override) {
if (node.start > pos) return;
var type = override || node.type;
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) max = new Found(node, st);
base[type](node, st, c);
})(node, state);
return max;
}
// Node walkers.
// Fallback to an Object.create polyfill for older environments.
var create = Object.create || function (proto) {
function Ctor() {}
Ctor.prototype = proto;
return new Ctor();
};
var base = {}
// Used to create a custom walker. Will fill in all missing node
// type properties with the defaults.
function make(funcs, base) {
if (!base) base = exports.base;
var visitor = create(base);
for (var type in funcs) visitor[type] = funcs[type];
return visitor;
}
function skipThrough(node, st, c) {
c(node, st);
}
function ignore(_node, _st, _c) {}
// Node walkers.
var base = {};
exports.base = base;
base.Program = base.BlockStatement = function (node, st, c) {
for (var i = 0; i < node.body.length; ++i) {
c(node.body[i], st, "Statement");
base.Program = base.BlockStatement = function (node, st, c) {
for (var i = 0; i < node.body.length; ++i)
c(node.body[i], st, "Statement")
}
};
base.Statement = skipThrough;
base.EmptyStatement = ignore;
base.ExpressionStatement = base.ParenthesizedExpression = function (node, st, c) {
return c(node.expression, st, "Expression");
};
base.IfStatement = function (node, st, c) {
c(node.test, st, "Expression");
c(node.consequent, st, "Statement");
if (node.alternate) c(node.alternate, st, "Statement");
};
base.LabeledStatement = function (node, st, c) {
return c(node.body, st, "Statement");
};
base.BreakStatement = base.ContinueStatement = ignore;
base.WithStatement = function (node, st, c) {
c(node.object, st, "Expression");
c(node.body, st, "Statement");
};
base.SwitchStatement = function (node, st, c) {
c(node.discriminant, st, "Expression");
for (var i = 0; i < node.cases.length; ++i) {
var cs = node.cases[i];
if (cs.test) c(cs.test, st, "Expression");
for (var j = 0; j < cs.consequent.length; ++j) {
c(cs.consequent[j], st, "Statement");
base.Statement = skipThrough
base.EmptyStatement = ignore
base.ExpressionStatement = base.ParenthesizedExpression =
function (node, st, c) { return c(node.expression, st, "Expression"); }
base.IfStatement = function (node, st, c) {
c(node.test, st, "Expression")
c(node.consequent, st, "Statement")
if (node.alternate) c(node.alternate, st, "Statement")
}
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); }
base.BreakStatement = base.ContinueStatement = ignore
base.WithStatement = function (node, st, c) {
c(node.object, st, "Expression")
c(node.body, st, "Statement")
}
base.SwitchStatement = function (node, st, c) {
c(node.discriminant, st, "Expression")
for (var i = 0; i < node.cases.length; ++i) {
var cs = node.cases[i]
if (cs.test) c(cs.test, st, "Expression")
for (var j = 0; j < cs.consequent.length; ++j)
c(cs.consequent[j], st, "Statement")
}
}
};
base.ReturnStatement = base.YieldExpression = function (node, st, c) {
if (node.argument) c(node.argument, st, "Expression");
};
base.ThrowStatement = base.SpreadElement = function (node, st, c) {
return c(node.argument, st, "Expression");
};
base.TryStatement = function (node, st, c) {
c(node.block, st, "Statement");
if (node.handler) c(node.handler, st);
if (node.finalizer) c(node.finalizer, st, "Statement");
};
base.CatchClause = function (node, st, c) {
c(node.param, st, "Pattern");
c(node.body, st, "ScopeBody");
};
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
c(node.test, st, "Expression");
c(node.body, st, "Statement");
};
base.ForStatement = function (node, st, c) {
if (node.init) c(node.init, st, "ForInit");
if (node.test) c(node.test, st, "Expression");
if (node.update) c(node.update, st, "Expression");
c(node.body, st, "Statement");
};
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
c(node.left, st, "ForInit");
c(node.right, st, "Expression");
c(node.body, st, "Statement");
};
base.ForInit = function (node, st, c) {
if (node.type == "VariableDeclaration") c(node, st);else c(node, st, "Expression");
};
base.DebuggerStatement = ignore;
base.ReturnStatement = base.YieldExpression = function (node, st, c) {
if (node.argument) c(node.argument, st, "Expression")
}
base.ThrowStatement = base.SpreadElement =
function (node, st, c) { return c(node.argument, st, "Expression"); }
base.TryStatement = function (node, st, c) {
c(node.block, st, "Statement")
if (node.handler) c(node.handler, st)
if (node.finalizer) c(node.finalizer, st, "Statement")
}
base.CatchClause = function (node, st, c) {
c(node.param, st, "Pattern")
c(node.body, st, "ScopeBody")
}
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
c(node.test, st, "Expression")
c(node.body, st, "Statement")
}
base.ForStatement = function (node, st, c) {
if (node.init) c(node.init, st, "ForInit")
if (node.test) c(node.test, st, "Expression")
if (node.update) c(node.update, st, "Expression")
c(node.body, st, "Statement")
}
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
c(node.left, st, "ForInit")
c(node.right, st, "Expression")
c(node.body, st, "Statement")
}
base.ForInit = function (node, st, c) {
if (node.type == "VariableDeclaration") c(node, st)
else c(node, st, "Expression")
}
base.DebuggerStatement = ignore
base.FunctionDeclaration = function (node, st, c) {
return c(node, st, "Function");
};
base.VariableDeclaration = function (node, st, c) {
for (var i = 0; i < node.declarations.length; ++i) {
c(node.declarations[i], st);
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); }
base.VariableDeclaration = function (node, st, c) {
for (var i = 0; i < node.declarations.length; ++i)
c(node.declarations[i], st)
}
};
base.VariableDeclarator = function (node, st, c) {
c(node.id, st, "Pattern");
if (node.init) c(node.init, st, "Expression");
};
base.VariableDeclarator = function (node, st, c) {
c(node.id, st, "Pattern")
if (node.init) c(node.init, st, "Expression")
}
base.Function = function (node, st, c) {
if (node.id) c(node.id, st, "Pattern");
for (var i = 0; i < node.params.length; i++) {
c(node.params[i], st, "Pattern");
}c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody");
};
// FIXME drop these node types in next major version
// (They are awkward, and in ES6 every block can be a scope.)
base.ScopeBody = function (node, st, c) {
return c(node, st, "Statement");
};
base.ScopeExpression = function (node, st, c) {
return c(node, st, "Expression");
};
base.Function = function (node, st, c) {
if (node.id) c(node.id, st, "Pattern")
for (var i = 0; i < node.params.length; i++)
c(node.params[i], st, "Pattern")
c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody")
}
// FIXME drop these node types in next major version
// (They are awkward, and in ES6 every block can be a scope.)
base.ScopeBody = function (node, st, c) { return c(node, st, "Statement"); }
base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); }
base.Pattern = function (node, st, c) {
if (node.type == "Identifier") c(node, st, "VariablePattern");else if (node.type == "MemberExpression") c(node, st, "MemberPattern");else c(node, st);
};
base.VariablePattern = ignore;
base.MemberPattern = skipThrough;
base.RestElement = function (node, st, c) {
return c(node.argument, st, "Pattern");
};
base.ArrayPattern = function (node, st, c) {
for (var i = 0; i < node.elements.length; ++i) {
var elt = node.elements[i];
if (elt) c(elt, st, "Pattern");
base.Pattern = function (node, st, c) {
if (node.type == "Identifier")
c(node, st, "VariablePattern")
else if (node.type == "MemberExpression")
c(node, st, "MemberPattern")
else
c(node, st)
}
};
base.ObjectPattern = function (node, st, c) {
for (var i = 0; i < node.properties.length; ++i) {
c(node.properties[i].value, st, "Pattern");
base.VariablePattern = ignore
base.MemberPattern = skipThrough
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); }
base.ArrayPattern = function (node, st, c) {
for (var i = 0; i < node.elements.length; ++i) {
var elt = node.elements[i]
if (elt) c(elt, st, "Pattern")
}
}
};
base.ObjectPattern = function (node, st, c) {
for (var i = 0; i < node.properties.length; ++i)
c(node.properties[i].value, st, "Pattern")
}
base.Expression = skipThrough;
base.ThisExpression = base.Super = base.MetaProperty = ignore;
base.ArrayExpression = function (node, st, c) {
for (var i = 0; i < node.elements.length; ++i) {
var elt = node.elements[i];
if (elt) c(elt, st, "Expression");
base.Expression = skipThrough
base.ThisExpression = base.Super = base.MetaProperty = ignore
base.ArrayExpression = function (node, st, c) {
for (var i = 0; i < node.elements.length; ++i) {
var elt = node.elements[i]
if (elt) c(elt, st, "Expression")
}
}
};
base.ObjectExpression = function (node, st, c) {
for (var i = 0; i < node.properties.length; ++i) {
c(node.properties[i], st);
base.ObjectExpression = function (node, st, c) {
for (var i = 0; i < node.properties.length; ++i)
c(node.properties[i], st)
}
};
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
for (var i = 0; i < node.expressions.length; ++i) {
c(node.expressions[i], st, "Expression");
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration
base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
for (var i = 0; i < node.expressions.length; ++i)
c(node.expressions[i], st, "Expression")
}
};
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
c(node.argument, st, "Expression");
};
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
c(node.left, st, "Expression");
c(node.right, st, "Expression");
};
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
c(node.left, st, "Pattern");
c(node.right, st, "Expression");
};
base.ConditionalExpression = function (node, st, c) {
c(node.test, st, "Expression");
c(node.consequent, st, "Expression");
c(node.alternate, st, "Expression");
};
base.NewExpression = base.CallExpression = function (node, st, c) {
c(node.callee, st, "Expression");
if (node.arguments) for (var i = 0; i < node.arguments.length; ++i) {
c(node.arguments[i], st, "Expression");
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
c(node.argument, st, "Expression")
}
};
base.MemberExpression = function (node, st, c) {
c(node.object, st, "Expression");
if (node.computed) c(node.property, st, "Expression");
};
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
if (node.declaration) c(node.declaration, st, node.type == "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression");
if (node.source) c(node.source, st, "Expression");
};
base.ExportAllDeclaration = function (node, st, c) {
c(node.source, st, "Expression");
};
base.ImportDeclaration = function (node, st, c) {
for (var i = 0; i < node.specifiers.length; i++) {
c(node.specifiers[i], st);
}c(node.source, st, "Expression");
};
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
c(node.left, st, "Expression")
c(node.right, st, "Expression")
}
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
c(node.left, st, "Pattern")
c(node.right, st, "Expression")
}
base.ConditionalExpression = function (node, st, c) {
c(node.test, st, "Expression")
c(node.consequent, st, "Expression")
c(node.alternate, st, "Expression")
}
base.NewExpression = base.CallExpression = function (node, st, c) {
c(node.callee, st, "Expression")
if (node.arguments) for (var i = 0; i < node.arguments.length; ++i)
c(node.arguments[i], st, "Expression")
}
base.MemberExpression = function (node, st, c) {
c(node.object, st, "Expression")
if (node.computed) c(node.property, st, "Expression")
}
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
if (node.declaration)
c(node.declaration, st, node.type == "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression")
if (node.source) c(node.source, st, "Expression")
}
base.ExportAllDeclaration = function (node, st, c) {
c(node.source, st, "Expression")
}
base.ImportDeclaration = function (node, st, c) {
for (var i = 0; i < node.specifiers.length; i++)
c(node.specifiers[i], st)
c(node.source, st, "Expression")
}
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore
base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression");
c(node.quasi, st);
};
base.ClassDeclaration = base.ClassExpression = function (node, st, c) {
return c(node, st, "Class");
};
base.Class = function (node, st, c) {
if (node.id) c(node.id, st, "Pattern");
if (node.superClass) c(node.superClass, st, "Expression");
for (var i = 0; i < node.body.body.length; i++) {
c(node.body.body[i], st);
base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression")
c(node.quasi, st)
}
};
base.MethodDefinition = base.Property = function (node, st, c) {
if (node.computed) c(node.key, st, "Expression");
c(node.value, st, "Expression");
};
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); }
base.Class = function (node, st, c) {
if (node.id) c(node.id, st, "Pattern")
if (node.superClass) c(node.superClass, st, "Expression")
for (var i = 0; i < node.body.body.length; i++)
c(node.body.body[i], st)
}
base.MethodDefinition = base.Property = function (node, st, c) {
if (node.computed) c(node.key, st, "Expression")
c(node.value, st, "Expression")
}
},{}]},{},[1])(1)
});
exports.simple = simple;
exports.ancestor = ancestor;
exports.recursive = recursive;
exports.findNodeAt = findNodeAt;
exports.findNodeAround = findNodeAround;
exports.findNodeAfter = findNodeAfter;
exports.findNodeBefore = findNodeBefore;
exports.make = make;
exports.base = base;
Object.defineProperty(exports, '__esModule', { value: true });
}));

@@ -6,3 +6,4 @@ {

"main": "dist/acorn.js",
"version": "3.2.0",
"jsnext:main": "dist/acorn.es.js",
"version": "3.3.0",
"engines": {

@@ -29,4 +30,10 @@ "node": ">=0.4.0"

"scripts": {
"prepublish": "node bin/build-acorn.js",
"test": "node test/run.js"
"prepublish": "npm test",
"test": "node test/run.js",
"pretest": "npm run build",
"build": "npm run build:main && npm run build:walk && npm run build:loose && npm run build:bin",
"build:main": "rollup -c rollup/config.main.js",
"build:walk": "rollup -c rollup/config.walk.js",
"build:loose": "rollup -c rollup/config.loose.js",
"build:bin": "rollup -c rollup/config.bin.js"
},

@@ -37,8 +44,6 @@ "bin": {

"devDependencies": {
"babel-core": "^5.6.15",
"babelify": "^6.1.2",
"browserify": "^10.2.4",
"browserify-derequire": "^0.9.4",
"unicode-8.0.0": "^0.1.5"
"rollup": "^0.34.1",
"rollup-plugin-buble": "^0.11.0",
"unicode-9.0.0": "^0.7.0"
}
}

@@ -1,6 +0,4 @@

#!/usr/bin/env node
import {basename} from "path"
import {readFileSync as readFile} from "fs"
import * as acorn from "../dist/acorn.js"
import * as acorn from "acorn"

@@ -7,0 +5,0 @@ let infile, forceFile, silent = false, compact = false, tokenize = false

@@ -610,3 +610,4 @@ // A recursive descent parser operates by defining functions for all

// or `arguments`.
if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) {
let useStrict = (!isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) ? node.body.body[0] : null;
if (this.strict || useStrict) {
let oldStrict = this.strict

@@ -616,6 +617,6 @@ this.strict = true

this.checkLVal(node.id, true)
this.checkParams(node)
this.checkParams(node, useStrict)
this.strict = oldStrict
} else if (isArrowFunction) {
this.checkParams(node)
this.checkParams(node, useStrict)
}

@@ -627,6 +628,9 @@ }

pp.checkParams = function(node) {
pp.checkParams = function(node, useStrict) {
let nameHash = {}
for (let i = 0; i < node.params.length; i++)
for (let i = 0; i < node.params.length; i++) {
if (useStrict && this.options.ecmaVersion >= 7 && node.params[i].type !== "Identifier")
this.raiseRecoverable(useStrict.start, "Illegal 'use strict' directive in function with non-simple parameter list");
this.checkLVal(node.params[i], true, nameHash)
}
}

@@ -633,0 +637,0 @@

@@ -29,4 +29,4 @@ // Reserved word lists for various dialects of the language

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\u0561-\u0587\u05d0-\u05ea\u05f0-\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\u08a0-\u08b4\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\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\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\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-\u1877\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\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\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-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ad\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\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-\uab65\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\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\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\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\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-\u0c03\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\u0d01-\u0d03\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-\u0eb9\u0ebb\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\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\u1dfc-\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-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\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\u0561-\u0587\u05d0-\u05ea\u05f0-\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\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\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\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\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-\u1877\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\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\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-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ae\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\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-\uab65\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\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d4-\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\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\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-\u0c03\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\u0d01-\u0d03\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-\u0eb9\u0ebb\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\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\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\ua900-\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"

@@ -43,4 +43,4 @@ const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]")

// generated by bin/generate-identifier-regex.js
const astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,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,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,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,287,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,1288,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,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,4149,196,1340,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,10591,541]
const astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,168,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,20855,9,135,4,60,6,26,9,1016,45,17,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,3617,6,792618,239]
const astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,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,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,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,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,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,4149,196,60,67,1213,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,10591,541]
const astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,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,2214,6,110,6,6,9,792487,239]

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

@@ -39,3 +39,3 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript.

export const version = "3.1.0"
export const version = "3.3.0"

@@ -42,0 +42,0 @@ // The main exported interface (under `self.acorn` when in the

import {LooseParser} from "./state"
import {isDummy} from "./parseutil"
import {tokTypes as tt} from ".."
import {tokTypes as tt} from "acorn"

@@ -5,0 +5,0 @@ const lp = LooseParser.prototype

@@ -32,3 +32,3 @@ // Acorn: Loose parser

import * as acorn from ".."
import acorn from "acorn"
import {LooseParser, pluginsLoose} from "./state"

@@ -35,0 +35,0 @@ import "./tokenize"

@@ -1,2 +0,2 @@

import {tokenizer, SourceLocation, tokTypes as tt, Node, lineBreak, isNewLine} from ".."
import {tokenizer, SourceLocation, tokTypes as tt, Node, lineBreak, isNewLine} from "acorn"

@@ -3,0 +3,0 @@ // Registered plugins

import {LooseParser} from "./state"
import {isDummy} from "./parseutil"
import {getLineInfo, tokTypes as tt} from ".."
import {getLineInfo, tokTypes as tt} from "acorn"

@@ -5,0 +5,0 @@ const lp = LooseParser.prototype

@@ -1,2 +0,2 @@

import {tokTypes as tt, Token, isNewLine, SourceLocation, getLineInfo, lineBreakG} from ".."
import {tokTypes as tt, Token, isNewLine, SourceLocation, getLineInfo, lineBreakG} from "acorn"
import {LooseParser} from "./state"

@@ -3,0 +3,0 @@

@@ -78,3 +78,3 @@ import {types as tt} from "./tokentype"

if (isBinding && last.type === "RestElement" && last.argument.type !== "Identifier")
if (isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
this.unexpected(last.argument.start)

@@ -94,3 +94,3 @@ }

this.next()
node.argument = this.parseMaybeAssign(refDestructuringErrors)
node.argument = this.parseMaybeAssign(false, refDestructuringErrors)
return this.finishNode(node, "SpreadElement")

@@ -97,0 +97,0 @@ }

@@ -43,3 +43,3 @@ import {types as tt} from "./tokentype"

if (isIdentifierStart(nextCh, true)) {
for (var pos = next + 1; isIdentifierChar(this.input.charCodeAt(pos, true)); ++pos) {}
for (var pos = next + 1; isIdentifierChar(this.input.charCodeAt(pos), true); ++pos) {}
let ident = this.input.slice(next, pos)

@@ -46,0 +46,0 @@ if (!this.isKeyword(ident)) return true

@@ -99,3 +99,3 @@ // The algorithm used to determine whether a regexp can appear at a

if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&
(prevType !== tt.colon || this.curContext() !== types.b_stat))
!((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))
this.context.push(types.f_expr)

@@ -102,0 +102,0 @@ this.exprAllowed = false

@@ -44,2 +44,12 @@ // ## Token types

// Map keyword names to token types.
export const keywords = {}
// Succinct definitions of keyword token types
function kw(name, options = {}) {
options.keyword = name
return keywords[name] = new TokenType(name, options)
}
export const types = {

@@ -100,49 +110,40 @@ num: new TokenType("num", startsExpr),

slash: binop("/", 10),
starstar: new TokenType("**", {beforeExpr: true})
}
starstar: new TokenType("**", {beforeExpr: true}),
// Map keyword names to token types.
export const keywords = {}
// Succinct definitions of keyword token types
function kw(name, options = {}) {
options.keyword = name
keywords[name] = types["_" + name] = new TokenType(name, options)
// Keyword token types.
_break: kw("break"),
_case: kw("case", beforeExpr),
_catch: kw("catch"),
_continue: kw("continue"),
_debugger: kw("debugger"),
_default: kw("default", beforeExpr),
_do: kw("do", {isLoop: true, beforeExpr: true}),
_else: kw("else", beforeExpr),
_finally: kw("finally"),
_for: kw("for", {isLoop: true}),
_function: kw("function", startsExpr),
_if: kw("if"),
_return: kw("return", beforeExpr),
_switch: kw("switch"),
_throw: kw("throw", beforeExpr),
_try: kw("try"),
_var: kw("var"),
_const: kw("const"),
_while: kw("while", {isLoop: true}),
_with: kw("with"),
_new: kw("new", {beforeExpr: true, startsExpr: true}),
_this: kw("this", startsExpr),
_super: kw("super", startsExpr),
_class: kw("class"),
_extends: kw("extends", beforeExpr),
_export: kw("export"),
_import: kw("import"),
_null: kw("null", startsExpr),
_true: kw("true", startsExpr),
_false: kw("false", startsExpr),
_in: kw("in", {beforeExpr: true, binop: 7}),
_instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
_typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
_void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
_delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
}
kw("break")
kw("case", beforeExpr)
kw("catch")
kw("continue")
kw("debugger")
kw("default", beforeExpr)
kw("do", {isLoop: true, beforeExpr: true})
kw("else", beforeExpr)
kw("finally")
kw("for", {isLoop: true})
kw("function", startsExpr)
kw("if")
kw("return", beforeExpr)
kw("switch")
kw("throw", beforeExpr)
kw("try")
kw("var")
kw("const")
kw("while", {isLoop: true})
kw("with")
kw("new", {beforeExpr: true, startsExpr: true})
kw("this", startsExpr)
kw("super", startsExpr)
kw("class")
kw("extends", beforeExpr)
kw("export")
kw("import")
kw("null", startsExpr)
kw("true", startsExpr)
kw("false", startsExpr)
kw("in", {beforeExpr: true, binop: 7})
kw("instanceof", {beforeExpr: true, binop: 7})
kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true})
kw("void", {beforeExpr: true, prefix: true, startsExpr: true})
kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc