react / wstein / node_modules / browserify / node_modules / syntax-error / node_modules / acorn / dist / acorn_csp.js
80552 views(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 = 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){123// The main exported interface (under `self.acorn` when in the4// browser) is a `parse` function that takes a code string and5// returns an abstract syntax tree as specified by [Mozilla parser6// API][api].7//8// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API910"use strict";1112exports.parse = parse;1314// This function tries to parse a single expression at a given15// offset in a string. Useful for parsing mixed-language formats16// that embed JavaScript expressions.1718exports.parseExpressionAt = parseExpressionAt;1920// Acorn is organized as a tokenizer and a recursive-descent parser.21// The `tokenize` export provides an interface to the tokenizer.2223exports.tokenizer = tokenizer;24exports.__esModule = true;25// Acorn is a tiny, fast JavaScript parser written in JavaScript.26//27// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and28// various contributors and released under an MIT license.29//30// Git repositories for Acorn are available at31//32// http://marijnhaverbeke.nl/git/acorn33// https://github.com/marijnh/acorn.git34//35// Please use the [github bug tracker][ghbt] to report issues.36//37// [ghbt]: https://github.com/marijnh/acorn/issues38//39// This file defines the main parser interface. The library also comes40// with a [error-tolerant parser][dammit] and an41// [abstract syntax tree walker][walk], defined in other files.42//43// [dammit]: acorn_loose.js44// [walk]: util/walk.js4546var _state = _dereq_("./state");4748var Parser = _state.Parser;4950var _options = _dereq_("./options");5152var getOptions = _options.getOptions;5354_dereq_("./parseutil");5556_dereq_("./statement");5758_dereq_("./lval");5960_dereq_("./expression");6162exports.Parser = _state.Parser;63exports.plugins = _state.plugins;64exports.defaultOptions = _options.defaultOptions;6566var _location = _dereq_("./location");6768exports.SourceLocation = _location.SourceLocation;69exports.getLineInfo = _location.getLineInfo;70exports.Node = _dereq_("./node").Node;7172var _tokentype = _dereq_("./tokentype");7374exports.TokenType = _tokentype.TokenType;75exports.tokTypes = _tokentype.types;7677var _tokencontext = _dereq_("./tokencontext");7879exports.TokContext = _tokencontext.TokContext;80exports.tokContexts = _tokencontext.types;8182var _identifier = _dereq_("./identifier");8384exports.isIdentifierChar = _identifier.isIdentifierChar;85exports.isIdentifierStart = _identifier.isIdentifierStart;86exports.Token = _dereq_("./tokenize").Token;8788var _whitespace = _dereq_("./whitespace");8990exports.isNewLine = _whitespace.isNewLine;91exports.lineBreak = _whitespace.lineBreak;92exports.lineBreakG = _whitespace.lineBreakG;93var version = "1.2.2";exports.version = version;9495function parse(input, options) {96var p = parser(options, input);97var startPos = p.pos,98startLoc = p.options.locations && p.curPosition();99p.nextToken();100return p.parseTopLevel(p.options.program || p.startNodeAt(startPos, startLoc));101}102103function parseExpressionAt(input, pos, options) {104var p = parser(options, input, pos);105p.nextToken();106return p.parseExpression();107}108109function tokenizer(input, options) {110return parser(options, input);111}112113function parser(options, input) {114return new Parser(getOptions(options), String(input));115}116117},{"./expression":6,"./identifier":7,"./location":8,"./lval":9,"./node":10,"./options":11,"./parseutil":12,"./state":13,"./statement":14,"./tokencontext":15,"./tokenize":16,"./tokentype":17,"./whitespace":19}],2:[function(_dereq_,module,exports){118if (typeof Object.create === 'function') {119// implementation from standard node.js 'util' module120module.exports = function inherits(ctor, superCtor) {121ctor.super_ = superCtor122ctor.prototype = Object.create(superCtor.prototype, {123constructor: {124value: ctor,125enumerable: false,126writable: true,127configurable: true128}129});130};131} else {132// old school shim for old browsers133module.exports = function inherits(ctor, superCtor) {134ctor.super_ = superCtor135var TempCtor = function () {}136TempCtor.prototype = superCtor.prototype137ctor.prototype = new TempCtor()138ctor.prototype.constructor = ctor139}140}141142},{}],3:[function(_dereq_,module,exports){143// shim for using process in browser144145var process = module.exports = {};146var queue = [];147var draining = false;148149function drainQueue() {150if (draining) {151return;152}153draining = true;154var currentQueue;155var len = queue.length;156while(len) {157currentQueue = queue;158queue = [];159var i = -1;160while (++i < len) {161currentQueue[i]();162}163len = queue.length;164}165draining = false;166}167process.nextTick = function (fun) {168queue.push(fun);169if (!draining) {170setTimeout(drainQueue, 0);171}172};173174process.title = 'browser';175process.browser = true;176process.env = {};177process.argv = [];178process.version = ''; // empty string to avoid regexp issues179process.versions = {};180181function noop() {}182183process.on = noop;184process.addListener = noop;185process.once = noop;186process.off = noop;187process.removeListener = noop;188process.removeAllListeners = noop;189process.emit = noop;190191process.binding = function (name) {192throw new Error('process.binding is not supported');193};194195// TODO(shtylman)196process.cwd = function () { return '/' };197process.chdir = function (dir) {198throw new Error('process.chdir is not supported');199};200process.umask = function() { return 0; };201202},{}],4:[function(_dereq_,module,exports){203module.exports = function isBuffer(arg) {204return arg && typeof arg === 'object'205&& typeof arg.copy === 'function'206&& typeof arg.fill === 'function'207&& typeof arg.readUInt8 === 'function';208}209},{}],5:[function(_dereq_,module,exports){210(function (process,global){211// Copyright Joyent, Inc. and other Node contributors.212//213// Permission is hereby granted, free of charge, to any person obtaining a214// copy of this software and associated documentation files (the215// "Software"), to deal in the Software without restriction, including216// without limitation the rights to use, copy, modify, merge, publish,217// distribute, sublicense, and/or sell copies of the Software, and to permit218// persons to whom the Software is furnished to do so, subject to the219// following conditions:220//221// The above copyright notice and this permission notice shall be included222// in all copies or substantial portions of the Software.223//224// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS225// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF226// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN227// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,228// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR229// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE230// USE OR OTHER DEALINGS IN THE SOFTWARE.231232var formatRegExp = /%[sdj%]/g;233exports.format = function(f) {234if (!isString(f)) {235var objects = [];236for (var i = 0; i < arguments.length; i++) {237objects.push(inspect(arguments[i]));238}239return objects.join(' ');240}241242var i = 1;243var args = arguments;244var len = args.length;245var str = String(f).replace(formatRegExp, function(x) {246if (x === '%%') return '%';247if (i >= len) return x;248switch (x) {249case '%s': return String(args[i++]);250case '%d': return Number(args[i++]);251case '%j':252try {253return JSON.stringify(args[i++]);254} catch (_) {255return '[Circular]';256}257default:258return x;259}260});261for (var x = args[i]; i < len; x = args[++i]) {262if (isNull(x) || !isObject(x)) {263str += ' ' + x;264} else {265str += ' ' + inspect(x);266}267}268return str;269};270271272// Mark that a method should not be used.273// Returns a modified function which warns once by default.274// If --no-deprecation is set, then it is a no-op.275exports.deprecate = function(fn, msg) {276// Allow for deprecating things in the process of starting up.277if (isUndefined(global.process)) {278return function() {279return exports.deprecate(fn, msg).apply(this, arguments);280};281}282283if (process.noDeprecation === true) {284return fn;285}286287var warned = false;288function deprecated() {289if (!warned) {290if (process.throwDeprecation) {291throw new Error(msg);292} else if (process.traceDeprecation) {293console.trace(msg);294} else {295console.error(msg);296}297warned = true;298}299return fn.apply(this, arguments);300}301302return deprecated;303};304305306var debugs = {};307var debugEnviron;308exports.debuglog = function(set) {309if (isUndefined(debugEnviron))310debugEnviron = process.env.NODE_DEBUG || '';311set = set.toUpperCase();312if (!debugs[set]) {313if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {314var pid = process.pid;315debugs[set] = function() {316var msg = exports.format.apply(exports, arguments);317console.error('%s %d: %s', set, pid, msg);318};319} else {320debugs[set] = function() {};321}322}323return debugs[set];324};325326327/**328* Echos the value of a value. Trys to print the value out329* in the best way possible given the different types.330*331* @param {Object} obj The object to print out.332* @param {Object} opts Optional options object that alters the output.333*/334/* legacy: obj, showHidden, depth, colors*/335function inspect(obj, opts) {336// default options337var ctx = {338seen: [],339stylize: stylizeNoColor340};341// legacy...342if (arguments.length >= 3) ctx.depth = arguments[2];343if (arguments.length >= 4) ctx.colors = arguments[3];344if (isBoolean(opts)) {345// legacy...346ctx.showHidden = opts;347} else if (opts) {348// got an "options" object349exports._extend(ctx, opts);350}351// set default options352if (isUndefined(ctx.showHidden)) ctx.showHidden = false;353if (isUndefined(ctx.depth)) ctx.depth = 2;354if (isUndefined(ctx.colors)) ctx.colors = false;355if (isUndefined(ctx.customInspect)) ctx.customInspect = true;356if (ctx.colors) ctx.stylize = stylizeWithColor;357return formatValue(ctx, obj, ctx.depth);358}359exports.inspect = inspect;360361362// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics363inspect.colors = {364'bold' : [1, 22],365'italic' : [3, 23],366'underline' : [4, 24],367'inverse' : [7, 27],368'white' : [37, 39],369'grey' : [90, 39],370'black' : [30, 39],371'blue' : [34, 39],372'cyan' : [36, 39],373'green' : [32, 39],374'magenta' : [35, 39],375'red' : [31, 39],376'yellow' : [33, 39]377};378379// Don't use 'blue' not visible on cmd.exe380inspect.styles = {381'special': 'cyan',382'number': 'yellow',383'boolean': 'yellow',384'undefined': 'grey',385'null': 'bold',386'string': 'green',387'date': 'magenta',388// "name": intentionally not styling389'regexp': 'red'390};391392393function stylizeWithColor(str, styleType) {394var style = inspect.styles[styleType];395396if (style) {397return '\u001b[' + inspect.colors[style][0] + 'm' + str +398'\u001b[' + inspect.colors[style][1] + 'm';399} else {400return str;401}402}403404405function stylizeNoColor(str, styleType) {406return str;407}408409410function arrayToHash(array) {411var hash = {};412413array.forEach(function(val, idx) {414hash[val] = true;415});416417return hash;418}419420421function formatValue(ctx, value, recurseTimes) {422// Provide a hook for user-specified inspect functions.423// Check that value is an object with an inspect function on it424if (ctx.customInspect &&425value &&426isFunction(value.inspect) &&427// Filter out the util module, it's inspect function is special428value.inspect !== exports.inspect &&429// Also filter out any prototype objects using the circular check.430!(value.constructor && value.constructor.prototype === value)) {431var ret = value.inspect(recurseTimes, ctx);432if (!isString(ret)) {433ret = formatValue(ctx, ret, recurseTimes);434}435return ret;436}437438// Primitive types cannot have properties439var primitive = formatPrimitive(ctx, value);440if (primitive) {441return primitive;442}443444// Look up the keys of the object.445var keys = Object.keys(value);446var visibleKeys = arrayToHash(keys);447448if (ctx.showHidden) {449keys = Object.getOwnPropertyNames(value);450}451452// IE doesn't make error fields non-enumerable453// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx454if (isError(value)455&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {456return formatError(value);457}458459// Some type of object without properties can be shortcutted.460if (keys.length === 0) {461if (isFunction(value)) {462var name = value.name ? ': ' + value.name : '';463return ctx.stylize('[Function' + name + ']', 'special');464}465if (isRegExp(value)) {466return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');467}468if (isDate(value)) {469return ctx.stylize(Date.prototype.toString.call(value), 'date');470}471if (isError(value)) {472return formatError(value);473}474}475476var base = '', array = false, braces = ['{', '}'];477478// Make Array say that they are Array479if (isArray(value)) {480array = true;481braces = ['[', ']'];482}483484// Make functions say that they are functions485if (isFunction(value)) {486var n = value.name ? ': ' + value.name : '';487base = ' [Function' + n + ']';488}489490// Make RegExps say that they are RegExps491if (isRegExp(value)) {492base = ' ' + RegExp.prototype.toString.call(value);493}494495// Make dates with properties first say the date496if (isDate(value)) {497base = ' ' + Date.prototype.toUTCString.call(value);498}499500// Make error with message first say the error501if (isError(value)) {502base = ' ' + formatError(value);503}504505if (keys.length === 0 && (!array || value.length == 0)) {506return braces[0] + base + braces[1];507}508509if (recurseTimes < 0) {510if (isRegExp(value)) {511return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');512} else {513return ctx.stylize('[Object]', 'special');514}515}516517ctx.seen.push(value);518519var output;520if (array) {521output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);522} else {523output = keys.map(function(key) {524return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);525});526}527528ctx.seen.pop();529530return reduceToSingleString(output, base, braces);531}532533534function formatPrimitive(ctx, value) {535if (isUndefined(value))536return ctx.stylize('undefined', 'undefined');537if (isString(value)) {538var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')539.replace(/'/g, "\\'")540.replace(/\\"/g, '"') + '\'';541return ctx.stylize(simple, 'string');542}543if (isNumber(value))544return ctx.stylize('' + value, 'number');545if (isBoolean(value))546return ctx.stylize('' + value, 'boolean');547// For some reason typeof null is "object", so special case here.548if (isNull(value))549return ctx.stylize('null', 'null');550}551552553function formatError(value) {554return '[' + Error.prototype.toString.call(value) + ']';555}556557558function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {559var output = [];560for (var i = 0, l = value.length; i < l; ++i) {561if (hasOwnProperty(value, String(i))) {562output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,563String(i), true));564} else {565output.push('');566}567}568keys.forEach(function(key) {569if (!key.match(/^\d+$/)) {570output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,571key, true));572}573});574return output;575}576577578function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {579var name, str, desc;580desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };581if (desc.get) {582if (desc.set) {583str = ctx.stylize('[Getter/Setter]', 'special');584} else {585str = ctx.stylize('[Getter]', 'special');586}587} else {588if (desc.set) {589str = ctx.stylize('[Setter]', 'special');590}591}592if (!hasOwnProperty(visibleKeys, key)) {593name = '[' + key + ']';594}595if (!str) {596if (ctx.seen.indexOf(desc.value) < 0) {597if (isNull(recurseTimes)) {598str = formatValue(ctx, desc.value, null);599} else {600str = formatValue(ctx, desc.value, recurseTimes - 1);601}602if (str.indexOf('\n') > -1) {603if (array) {604str = str.split('\n').map(function(line) {605return ' ' + line;606}).join('\n').substr(2);607} else {608str = '\n' + str.split('\n').map(function(line) {609return ' ' + line;610}).join('\n');611}612}613} else {614str = ctx.stylize('[Circular]', 'special');615}616}617if (isUndefined(name)) {618if (array && key.match(/^\d+$/)) {619return str;620}621name = JSON.stringify('' + key);622if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {623name = name.substr(1, name.length - 2);624name = ctx.stylize(name, 'name');625} else {626name = name.replace(/'/g, "\\'")627.replace(/\\"/g, '"')628.replace(/(^"|"$)/g, "'");629name = ctx.stylize(name, 'string');630}631}632633return name + ': ' + str;634}635636637function reduceToSingleString(output, base, braces) {638var numLinesEst = 0;639var length = output.reduce(function(prev, cur) {640numLinesEst++;641if (cur.indexOf('\n') >= 0) numLinesEst++;642return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;643}, 0);644645if (length > 60) {646return braces[0] +647(base === '' ? '' : base + '\n ') +648' ' +649output.join(',\n ') +650' ' +651braces[1];652}653654return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];655}656657658// NOTE: These type checking functions intentionally don't use `instanceof`659// because it is fragile and can be easily faked with `Object.create()`.660function isArray(ar) {661return Array.isArray(ar);662}663exports.isArray = isArray;664665function isBoolean(arg) {666return typeof arg === 'boolean';667}668exports.isBoolean = isBoolean;669670function isNull(arg) {671return arg === null;672}673exports.isNull = isNull;674675function isNullOrUndefined(arg) {676return arg == null;677}678exports.isNullOrUndefined = isNullOrUndefined;679680function isNumber(arg) {681return typeof arg === 'number';682}683exports.isNumber = isNumber;684685function isString(arg) {686return typeof arg === 'string';687}688exports.isString = isString;689690function isSymbol(arg) {691return typeof arg === 'symbol';692}693exports.isSymbol = isSymbol;694695function isUndefined(arg) {696return arg === void 0;697}698exports.isUndefined = isUndefined;699700function isRegExp(re) {701return isObject(re) && objectToString(re) === '[object RegExp]';702}703exports.isRegExp = isRegExp;704705function isObject(arg) {706return typeof arg === 'object' && arg !== null;707}708exports.isObject = isObject;709710function isDate(d) {711return isObject(d) && objectToString(d) === '[object Date]';712}713exports.isDate = isDate;714715function isError(e) {716return isObject(e) &&717(objectToString(e) === '[object Error]' || e instanceof Error);718}719exports.isError = isError;720721function isFunction(arg) {722return typeof arg === 'function';723}724exports.isFunction = isFunction;725726function isPrimitive(arg) {727return arg === null ||728typeof arg === 'boolean' ||729typeof arg === 'number' ||730typeof arg === 'string' ||731typeof arg === 'symbol' || // ES6 symbol732typeof arg === 'undefined';733}734exports.isPrimitive = isPrimitive;735736exports.isBuffer = _dereq_('./support/isBuffer');737738function objectToString(o) {739return Object.prototype.toString.call(o);740}741742743function pad(n) {744return n < 10 ? '0' + n.toString(10) : n.toString(10);745}746747748var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',749'Oct', 'Nov', 'Dec'];750751// 26 Feb 16:19:34752function timestamp() {753var d = new Date();754var time = [pad(d.getHours()),755pad(d.getMinutes()),756pad(d.getSeconds())].join(':');757return [d.getDate(), months[d.getMonth()], time].join(' ');758}759760761// log is just a thin wrapper to console.log that prepends a timestamp762exports.log = function() {763console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));764};765766767/**768* Inherit the prototype methods from one constructor into another.769*770* The Function.prototype.inherits from lang.js rewritten as a standalone771* function (not on Function.prototype). NOTE: If this file is to be loaded772* during bootstrapping this function needs to be rewritten using some native773* functions as prototype setup using normal JavaScript does not work as774* expected during bootstrapping (see mirror.js in r114903).775*776* @param {function} ctor Constructor function which needs to inherit the777* prototype.778* @param {function} superCtor Constructor function to inherit prototype from.779*/780exports.inherits = _dereq_('inherits');781782exports._extend = function(origin, add) {783// Don't do anything if add isn't an object784if (!add || !isObject(add)) return origin;785786var keys = Object.keys(add);787var i = keys.length;788while (i--) {789origin[keys[i]] = add[keys[i]];790}791return origin;792};793794function hasOwnProperty(obj, prop) {795return Object.prototype.hasOwnProperty.call(obj, prop);796}797798}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})799},{"./support/isBuffer":4,"_process":3,"inherits":2}],6:[function(_dereq_,module,exports){800// A recursive descent parser operates by defining functions for all801// syntactic elements, and recursively calling those, each function802// advancing the input stream and returning an AST node. Precedence803// of constructs (for example, the fact that `!x[1]` means `!(x[1])`804// instead of `(!x)[1]` is handled by the fact that the parser805// function that parses unary prefix operators is called first, and806// in turn calls the function that parses `[]` subscripts — that807// way, it'll receive the node for `x[1]` already parsed, and wraps808// *that* in the unary operator node.809//810// Acorn uses an [operator precedence parser][opp] to handle binary811// operator precedence, because it is much more compact than using812// the technique outlined above, which uses different, nesting813// functions to specify precedence, for all of the ten binary814// precedence levels that JavaScript defines.815//816// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser817818"use strict";819820var tt = _dereq_("./tokentype").types;821822var Parser = _dereq_("./state").Parser;823824var reservedWords = _dereq_("./identifier").reservedWords;825826var has = _dereq_("./util").has;827828var pp = Parser.prototype;829830// Check if property name clashes with already added.831// Object/class getters and setters are not allowed to clash —832// either with each other or with an init property — and in833// strict mode, init properties are also not allowed to be repeated.834835pp.checkPropClash = function (prop, propHash) {836if (this.options.ecmaVersion >= 6) return;837var key = prop.key,838name = undefined;839switch (key.type) {840case "Identifier":841name = key.name;break;842case "Literal":843name = String(key.value);break;844default:845return;846}847var kind = prop.kind || "init",848other = undefined;849if (has(propHash, name)) {850other = propHash[name];851var isGetSet = kind !== "init";852if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) this.raise(key.start, "Redefinition of property");853} else {854other = propHash[name] = {855init: false,856get: false,857set: false858};859}860other[kind] = true;861};862863// ### Expression parsing864865// These nest, from the most general expression type at the top to866// 'atomic', nondivisible expression types at the bottom. Most of867// the functions will simply let the function(s) below them parse,868// and, *if* the syntactic construct they handle is present, wrap869// the AST node that the inner parser gave them in another node.870871// Parse a full expression. The optional arguments are used to872// forbid the `in` operator (in for loops initalization expressions)873// and provide reference for storing '=' operator inside shorthand874// property assignment in contexts where both object expression875// and object pattern might appear (so it's possible to raise876// delayed syntax error at correct position).877878pp.parseExpression = function (noIn, refShorthandDefaultPos) {879var startPos = this.start,880startLoc = this.startLoc;881var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);882if (this.type === tt.comma) {883var node = this.startNodeAt(startPos, startLoc);884node.expressions = [expr];885while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));886return this.finishNode(node, "SequenceExpression");887}888return expr;889};890891// Parse an assignment expression. This includes applications of892// operators like `+=`.893894pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) {895if (this.type == tt._yield && this.inGenerator) return this.parseYield();896897var failOnShorthandAssign = undefined;898if (!refShorthandDefaultPos) {899refShorthandDefaultPos = { start: 0 };900failOnShorthandAssign = true;901} else {902failOnShorthandAssign = false;903}904var startPos = this.start,905startLoc = this.startLoc;906if (this.type == tt.parenL || this.type == tt.name) this.potentialArrowAt = this.start;907var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos);908if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);909if (this.type.isAssign) {910var node = this.startNodeAt(startPos, startLoc);911node.operator = this.value;912node.left = this.type === tt.eq ? this.toAssignable(left) : left;913refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly914this.checkLVal(left);915this.next();916node.right = this.parseMaybeAssign(noIn);917return this.finishNode(node, "AssignmentExpression");918} else if (failOnShorthandAssign && refShorthandDefaultPos.start) {919this.unexpected(refShorthandDefaultPos.start);920}921return left;922};923924// Parse a ternary conditional (`?:`) operator.925926pp.parseMaybeConditional = function (noIn, refShorthandDefaultPos) {927var startPos = this.start,928startLoc = this.startLoc;929var expr = this.parseExprOps(noIn, refShorthandDefaultPos);930if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;931if (this.eat(tt.question)) {932var node = this.startNodeAt(startPos, startLoc);933node.test = expr;934node.consequent = this.parseMaybeAssign();935this.expect(tt.colon);936node.alternate = this.parseMaybeAssign(noIn);937return this.finishNode(node, "ConditionalExpression");938}939return expr;940};941942// Start the precedence parser.943944pp.parseExprOps = function (noIn, refShorthandDefaultPos) {945var startPos = this.start,946startLoc = this.startLoc;947var expr = this.parseMaybeUnary(refShorthandDefaultPos);948if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;949return this.parseExprOp(expr, startPos, startLoc, -1, noIn);950};951952// Parse binary operators with the operator precedence parsing953// algorithm. `left` is the left-hand side of the operator.954// `minPrec` provides context that allows the function to stop and955// defer further parser to one of its callers when it encounters an956// operator that has a lower precedence than the set it is parsing.957958pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {959var prec = this.type.binop;960if (Array.isArray(leftStartPos)) {961if (this.options.locations && noIn === undefined) {962// shift arguments to left by one963noIn = minPrec;964minPrec = leftStartLoc;965// flatten leftStartPos966leftStartLoc = leftStartPos[1];967leftStartPos = leftStartPos[0];968}969}970if (prec != null && (!noIn || this.type !== tt._in)) {971if (prec > minPrec) {972var node = this.startNodeAt(leftStartPos, leftStartLoc);973node.left = left;974node.operator = this.value;975var op = this.type;976this.next();977var startPos = this.start,978startLoc = this.startLoc;979node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn);980this.finishNode(node, op === tt.logicalOR || op === tt.logicalAND ? "LogicalExpression" : "BinaryExpression");981return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);982}983}984return left;985};986987// Parse unary operators, both prefix and postfix.988989pp.parseMaybeUnary = function (refShorthandDefaultPos) {990if (this.type.prefix) {991var node = this.startNode(),992update = this.type === tt.incDec;993node.operator = this.value;994node.prefix = true;995this.next();996node.argument = this.parseMaybeUnary();997if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);998if (update) this.checkLVal(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raise(node.start, "Deleting local variable in strict mode");999return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");1000}1001var startPos = this.start,1002startLoc = this.startLoc;1003var expr = this.parseExprSubscripts(refShorthandDefaultPos);1004if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;1005while (this.type.postfix && !this.canInsertSemicolon()) {1006var node = this.startNodeAt(startPos, startLoc);1007node.operator = this.value;1008node.prefix = false;1009node.argument = expr;1010this.checkLVal(expr);1011this.next();1012expr = this.finishNode(node, "UpdateExpression");1013}1014return expr;1015};10161017// Parse call, dot, and `[]`-subscript expressions.10181019pp.parseExprSubscripts = function (refShorthandDefaultPos) {1020var startPos = this.start,1021startLoc = this.startLoc;1022var expr = this.parseExprAtom(refShorthandDefaultPos);1023if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;1024return this.parseSubscripts(expr, startPos, startLoc);1025};10261027pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {1028if (Array.isArray(startPos)) {1029if (this.options.locations && noCalls === undefined) {1030// shift arguments to left by one1031noCalls = startLoc;1032// flatten startPos1033startLoc = startPos[1];1034startPos = startPos[0];1035}1036}1037for (;;) {1038if (this.eat(tt.dot)) {1039var node = this.startNodeAt(startPos, startLoc);1040node.object = base;1041node.property = this.parseIdent(true);1042node.computed = false;1043base = this.finishNode(node, "MemberExpression");1044} else if (this.eat(tt.bracketL)) {1045var node = this.startNodeAt(startPos, startLoc);1046node.object = base;1047node.property = this.parseExpression();1048node.computed = true;1049this.expect(tt.bracketR);1050base = this.finishNode(node, "MemberExpression");1051} else if (!noCalls && this.eat(tt.parenL)) {1052var node = this.startNodeAt(startPos, startLoc);1053node.callee = base;1054node.arguments = this.parseExprList(tt.parenR, false);1055base = this.finishNode(node, "CallExpression");1056} else if (this.type === tt.backQuote) {1057var node = this.startNodeAt(startPos, startLoc);1058node.tag = base;1059node.quasi = this.parseTemplate();1060base = this.finishNode(node, "TaggedTemplateExpression");1061} else {1062return base;1063}1064}1065};10661067// Parse an atomic expression — either a single token that is an1068// expression, an expression started by a keyword like `function` or1069// `new`, or an expression wrapped in punctuation like `()`, `[]`,1070// or `{}`.10711072pp.parseExprAtom = function (refShorthandDefaultPos) {1073var node = undefined,1074canBeArrow = this.potentialArrowAt == this.start;1075switch (this.type) {1076case tt._this:1077case tt._super:1078var type = this.type === tt._this ? "ThisExpression" : "Super";1079node = this.startNode();1080this.next();1081return this.finishNode(node, type);10821083case tt._yield:1084if (this.inGenerator) this.unexpected();10851086case tt.name:1087var startPos = this.start,1088startLoc = this.startLoc;1089var id = this.parseIdent(this.type !== tt.name);1090if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id]);1091return id;10921093case tt.regexp:1094var value = this.value;1095node = this.parseLiteral(value.value);1096node.regex = { pattern: value.pattern, flags: value.flags };1097return node;10981099case tt.num:case tt.string:1100return this.parseLiteral(this.value);11011102case tt._null:case tt._true:case tt._false:1103node = this.startNode();1104node.value = this.type === tt._null ? null : this.type === tt._true;1105node.raw = this.type.keyword;1106this.next();1107return this.finishNode(node, "Literal");11081109case tt.parenL:1110return this.parseParenAndDistinguishExpression(canBeArrow);11111112case tt.bracketL:1113node = this.startNode();1114this.next();1115// check whether this is array comprehension or regular array1116if (this.options.ecmaVersion >= 7 && this.type === tt._for) {1117return this.parseComprehension(node, false);1118}1119node.elements = this.parseExprList(tt.bracketR, true, true, refShorthandDefaultPos);1120return this.finishNode(node, "ArrayExpression");11211122case tt.braceL:1123return this.parseObj(false, refShorthandDefaultPos);11241125case tt._function:1126node = this.startNode();1127this.next();1128return this.parseFunction(node, false);11291130case tt._class:1131return this.parseClass(this.startNode(), false);11321133case tt._new:1134return this.parseNew();11351136case tt.backQuote:1137return this.parseTemplate();11381139default:1140this.unexpected();1141}1142};11431144pp.parseLiteral = function (value) {1145var node = this.startNode();1146node.value = value;1147node.raw = this.input.slice(this.start, this.end);1148this.next();1149return this.finishNode(node, "Literal");1150};11511152pp.parseParenExpression = function () {1153this.expect(tt.parenL);1154var val = this.parseExpression();1155this.expect(tt.parenR);1156return val;1157};11581159pp.parseParenAndDistinguishExpression = function (canBeArrow) {1160var startPos = this.start,1161startLoc = this.startLoc,1162val = undefined;1163if (this.options.ecmaVersion >= 6) {1164this.next();11651166if (this.options.ecmaVersion >= 7 && this.type === tt._for) {1167return this.parseComprehension(this.startNodeAt(startPos, startLoc), true);1168}11691170var innerStartPos = this.start,1171innerStartLoc = this.startLoc;1172var exprList = [],1173first = true;1174var refShorthandDefaultPos = { start: 0 },1175spreadStart = undefined,1176innerParenStart = undefined;1177while (this.type !== tt.parenR) {1178first ? first = false : this.expect(tt.comma);1179if (this.type === tt.ellipsis) {1180spreadStart = this.start;1181exprList.push(this.parseParenItem(this.parseRest()));1182break;1183} else {1184if (this.type === tt.parenL && !innerParenStart) {1185innerParenStart = this.start;1186}1187exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem));1188}1189}1190var innerEndPos = this.start,1191innerEndLoc = this.startLoc;1192this.expect(tt.parenR);11931194if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {1195if (innerParenStart) this.unexpected(innerParenStart);1196return this.parseParenArrowList(startPos, startLoc, exprList);1197}11981199if (!exprList.length) this.unexpected(this.lastTokStart);1200if (spreadStart) this.unexpected(spreadStart);1201if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);12021203if (exprList.length > 1) {1204val = this.startNodeAt(innerStartPos, innerStartLoc);1205val.expressions = exprList;1206this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);1207} else {1208val = exprList[0];1209}1210} else {1211val = this.parseParenExpression();1212}12131214if (this.options.preserveParens) {1215var par = this.startNodeAt(startPos, startLoc);1216par.expression = val;1217return this.finishNode(par, "ParenthesizedExpression");1218} else {1219return val;1220}1221};12221223pp.parseParenItem = function (item) {1224return item;1225};12261227pp.parseParenArrowList = function (startPos, startLoc, exprList) {1228return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList);1229};12301231// New's precedence is slightly tricky. It must allow its argument1232// to be a `[]` or dot subscript expression, but not a call — at1233// least, not without wrapping it in parentheses. Thus, it uses the12341235var empty = [];12361237pp.parseNew = function () {1238var node = this.startNode();1239var meta = this.parseIdent(true);1240if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {1241node.meta = meta;1242node.property = this.parseIdent(true);1243if (node.property.name !== "target") this.raise(node.property.start, "The only valid meta property for new is new.target");1244return this.finishNode(node, "MetaProperty");1245}1246var startPos = this.start,1247startLoc = this.startLoc;1248node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);1249if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false);else node.arguments = empty;1250return this.finishNode(node, "NewExpression");1251};12521253// Parse template expression.12541255pp.parseTemplateElement = function () {1256var elem = this.startNode();1257elem.value = {1258raw: this.input.slice(this.start, this.end),1259cooked: this.value1260};1261this.next();1262elem.tail = this.type === tt.backQuote;1263return this.finishNode(elem, "TemplateElement");1264};12651266pp.parseTemplate = function () {1267var node = this.startNode();1268this.next();1269node.expressions = [];1270var curElt = this.parseTemplateElement();1271node.quasis = [curElt];1272while (!curElt.tail) {1273this.expect(tt.dollarBraceL);1274node.expressions.push(this.parseExpression());1275this.expect(tt.braceR);1276node.quasis.push(curElt = this.parseTemplateElement());1277}1278this.next();1279return this.finishNode(node, "TemplateLiteral");1280};12811282// Parse an object literal or binding pattern.12831284pp.parseObj = function (isPattern, refShorthandDefaultPos) {1285var node = this.startNode(),1286first = true,1287propHash = {};1288node.properties = [];1289this.next();1290while (!this.eat(tt.braceR)) {1291if (!first) {1292this.expect(tt.comma);1293if (this.afterTrailingComma(tt.braceR)) break;1294} else first = false;12951296var prop = this.startNode(),1297isGenerator = undefined,1298startPos = undefined,1299startLoc = undefined;1300if (this.options.ecmaVersion >= 6) {1301prop.method = false;1302prop.shorthand = false;1303if (isPattern || refShorthandDefaultPos) {1304startPos = this.start;1305startLoc = this.startLoc;1306}1307if (!isPattern) isGenerator = this.eat(tt.star);1308}1309this.parsePropertyName(prop);1310this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos);1311this.checkPropClash(prop, propHash);1312node.properties.push(this.finishNode(prop, "Property"));1313}1314return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");1315};13161317pp.parsePropertyValue = function (prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos) {1318if (this.eat(tt.colon)) {1319prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);1320prop.kind = "init";1321} else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {1322if (isPattern) this.unexpected();1323prop.kind = "init";1324prop.method = true;1325prop.value = this.parseMethod(isGenerator);1326} else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type != tt.comma && this.type != tt.braceR)) {1327if (isGenerator || isPattern) this.unexpected();1328prop.kind = prop.key.name;1329this.parsePropertyName(prop);1330prop.value = this.parseMethod(false);1331} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {1332prop.kind = "init";1333if (isPattern) {1334if (this.isKeyword(prop.key.name) || this.strict && (reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name)) || !this.options.allowReserved && this.isReservedWord(prop.key.name)) this.raise(prop.key.start, "Binding " + prop.key.name);1335prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);1336} else if (this.type === tt.eq && refShorthandDefaultPos) {1337if (!refShorthandDefaultPos.start) refShorthandDefaultPos.start = this.start;1338prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);1339} else {1340prop.value = prop.key;1341}1342prop.shorthand = true;1343} else this.unexpected();1344};13451346pp.parsePropertyName = function (prop) {1347if (this.options.ecmaVersion >= 6) {1348if (this.eat(tt.bracketL)) {1349prop.computed = true;1350prop.key = this.parseMaybeAssign();1351this.expect(tt.bracketR);1352return prop.key;1353} else {1354prop.computed = false;1355}1356}1357return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true);1358};13591360// Initialize empty function node.13611362pp.initFunction = function (node) {1363node.id = null;1364if (this.options.ecmaVersion >= 6) {1365node.generator = false;1366node.expression = false;1367}1368};13691370// Parse object or class method.13711372pp.parseMethod = function (isGenerator) {1373var node = this.startNode();1374this.initFunction(node);1375this.expect(tt.parenL);1376node.params = this.parseBindingList(tt.parenR, false, false);1377var allowExpressionBody = undefined;1378if (this.options.ecmaVersion >= 6) {1379node.generator = isGenerator;1380allowExpressionBody = true;1381} else {1382allowExpressionBody = false;1383}1384this.parseFunctionBody(node, allowExpressionBody);1385return this.finishNode(node, "FunctionExpression");1386};13871388// Parse arrow function expression with given parameters.13891390pp.parseArrowExpression = function (node, params) {1391this.initFunction(node);1392node.params = this.toAssignableList(params, true);1393this.parseFunctionBody(node, true);1394return this.finishNode(node, "ArrowFunctionExpression");1395};13961397// Parse function body and check parameters.13981399pp.parseFunctionBody = function (node, allowExpression) {1400var isExpression = allowExpression && this.type !== tt.braceL;14011402if (isExpression) {1403node.body = this.parseMaybeAssign();1404node.expression = true;1405} else {1406// Start a new scope with regard to labels and the `inFunction`1407// flag (restore them to their old value afterwards).1408var oldInFunc = this.inFunction,1409oldInGen = this.inGenerator,1410oldLabels = this.labels;1411this.inFunction = true;this.inGenerator = node.generator;this.labels = [];1412node.body = this.parseBlock(true);1413node.expression = false;1414this.inFunction = oldInFunc;this.inGenerator = oldInGen;this.labels = oldLabels;1415}14161417// If this is a strict mode function, verify that argument names1418// are not repeated, and it does not try to bind the words `eval`1419// or `arguments`.1420if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) {1421var nameHash = {},1422oldStrict = this.strict;1423this.strict = true;1424if (node.id) this.checkLVal(node.id, true);1425for (var i = 0; i < node.params.length; i++) {1426this.checkLVal(node.params[i], true, nameHash);1427}this.strict = oldStrict;1428}1429};14301431// Parses a comma-separated list of expressions, and returns them as1432// an array. `close` is the token type that ends the list, and1433// `allowEmpty` can be turned on to allow subsequent commas with1434// nothing in between them to be parsed as `null` (which is needed1435// for array literals).14361437pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) {1438var elts = [],1439first = true;1440while (!this.eat(close)) {1441if (!first) {1442this.expect(tt.comma);1443if (allowTrailingComma && this.afterTrailingComma(close)) break;1444} else first = false;14451446if (allowEmpty && this.type === tt.comma) {1447elts.push(null);1448} else {1449if (this.type === tt.ellipsis) elts.push(this.parseSpread(refShorthandDefaultPos));else elts.push(this.parseMaybeAssign(false, refShorthandDefaultPos));1450}1451}1452return elts;1453};14541455// Parse the next token as an identifier. If `liberal` is true (used1456// when parsing properties), it will also convert keywords into1457// identifiers.14581459pp.parseIdent = function (liberal) {1460var node = this.startNode();1461if (liberal && this.options.allowReserved == "never") liberal = false;1462if (this.type === tt.name) {1463if (!liberal && (!this.options.allowReserved && this.isReservedWord(this.value) || this.strict && reservedWords.strict(this.value) && (this.options.ecmaVersion >= 6 || this.input.slice(this.start, this.end).indexOf("\\") == -1))) this.raise(this.start, "The keyword '" + this.value + "' is reserved");1464node.name = this.value;1465} else if (liberal && this.type.keyword) {1466node.name = this.type.keyword;1467} else {1468this.unexpected();1469}1470this.next();1471return this.finishNode(node, "Identifier");1472};14731474// Parses yield expression inside generator.14751476pp.parseYield = function () {1477var node = this.startNode();1478this.next();1479if (this.type == tt.semi || this.canInsertSemicolon() || this.type != tt.star && !this.type.startsExpr) {1480node.delegate = false;1481node.argument = null;1482} else {1483node.delegate = this.eat(tt.star);1484node.argument = this.parseMaybeAssign();1485}1486return this.finishNode(node, "YieldExpression");1487};14881489// Parses array and generator comprehensions.14901491pp.parseComprehension = function (node, isGenerator) {1492node.blocks = [];1493while (this.type === tt._for) {1494var block = this.startNode();1495this.next();1496this.expect(tt.parenL);1497block.left = this.parseBindingAtom();1498this.checkLVal(block.left, true);1499this.expectContextual("of");1500block.right = this.parseExpression();1501this.expect(tt.parenR);1502node.blocks.push(this.finishNode(block, "ComprehensionBlock"));1503}1504node.filter = this.eat(tt._if) ? this.parseParenExpression() : null;1505node.body = this.parseExpression();1506this.expect(isGenerator ? tt.parenR : tt.bracketR);1507node.generator = isGenerator;1508return this.finishNode(node, "ComprehensionExpression");1509};15101511},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],7:[function(_dereq_,module,exports){151215131514// Test whether a given character code starts an identifier.15151516"use strict";15171518exports.isIdentifierStart = isIdentifierStart;15191520// Test whether a given character is part of an identifier.15211522exports.isIdentifierChar = isIdentifierChar;1523exports.__esModule = true;1524// This is a trick taken from Esprima. It turns out that, on1525// non-Chrome browsers, to check whether a string is in a set, a1526// predicate containing a big ugly `switch` statement is faster than1527// a regular expression, and on Chrome the two are about on par.1528// This function uses `eval` (non-lexical) to produce such a1529// predicate from a space-separated string of words.1530//1531// It starts by sorting the words by length.15321533// Removed to create an eval-free library15341535// Reserved word lists for various dialects of the language15361537var reservedWords = {15383: function anonymous(str) {1539switch(str.length){case 6:switch(str){case "double":case "export":case "import":case "native":case "public":case "static":case "throws":return true}return false;case 4:switch(str){case "byte":case "char":case "enum":case "goto":case "long":return true}return false;case 5:switch(str){case "class":case "final":case "float":case "short":case "super":return true}return false;case 7:switch(str){case "boolean":case "extends":case "package":case "private":return true}return false;case 9:switch(str){case "interface":case "protected":case "transient":return true}return false;case 8:switch(str){case "abstract":case "volatile":return true}return false;case 10:return str === "implements";case 3:return str === "int";case 12:return str === "synchronized";}1540},15415: function anonymous(str) {1542switch(str.length){case 5:switch(str){case "class":case "super":case "const":return true}return false;case 6:switch(str){case "export":case "import":return true}return false;case 4:return str === "enum";case 7:return str === "extends";}1543},15446: function anonymous(str) {1545switch(str){case "enum":case "await":return true}return false;1546},1547strict: function anonymous(str) {1548switch(str.length){case 9:switch(str){case "interface":case "protected":return true}return false;case 7:switch(str){case "package":case "private":return true}return false;case 6:switch(str){case "public":case "static":return true}return false;case 10:return str === "implements";case 3:return str === "let";case 5:return str === "yield";}1549},1550strictBind: function anonymous(str) {1551switch(str){case "eval":case "arguments":return true}return false;1552}1553};15541555exports.reservedWords = reservedWords;1556// And the keywords15571558var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";15591560var keywords = {15615: function anonymous(str) {1562switch(str.length){case 4:switch(str){case "case":case "else":case "with":case "null":case "true":case "void":case "this":return true}return false;case 5:switch(str){case "break":case "catch":case "throw":case "while":case "false":return true}return false;case 3:switch(str){case "for":case "try":case "var":case "new":return true}return false;case 6:switch(str){case "return":case "switch":case "typeof":case "delete":return true}return false;case 8:switch(str){case "continue":case "debugger":case "function":return true}return false;case 2:switch(str){case "do":case "if":case "in":return true}return false;case 7:switch(str){case "default":case "finally":return true}return false;case 10:return str === "instanceof";}1563},15646: function anonymous(str) {1565switch(str.length){case 5:switch(str){case "break":case "catch":case "throw":case "while":case "false":case "const":case "class":case "yield":case "super":return true}return false;case 4:switch(str){case "case":case "else":case "with":case "null":case "true":case "void":case "this":return true}return false;case 6:switch(str){case "return":case "switch":case "typeof":case "delete":case "export":case "import":return true}return false;case 3:switch(str){case "for":case "try":case "var":case "new":case "let":return true}return false;case 8:switch(str){case "continue":case "debugger":case "function":return true}return false;case 7:switch(str){case "default":case "finally":case "extends":return true}return false;case 2:switch(str){case "do":case "if":case "in":return true}return false;case 10:return str === "instanceof";}1566}1567};15681569exports.keywords = keywords;1570// ## Character categories15711572// Big ugly regular expressions that match characters in the1573// whitespace, identifier, and identifier-start categories. These1574// are only applied when a character is found to actually have a1575// code point above 128.1576// Generated by `tools/generate-identifier-regex.js`.15771578var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";1579var nonASCIIidentifierChars = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";15801581var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");1582var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");15831584nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;15851586// These are a run-length and offset encoded representation of the1587// >0xffff code points that are a valid part of identifiers. The1588// offset starts at 0x10000, and each pair of numbers represents an1589// offset to the next range, and then a size of the range. They were1590// generated by tools/generate-identifier-regex.js1591var 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, 98, 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, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 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, 16355, 541];1592var 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, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 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, 4305, 6, 792618, 239];15931594// This has a complexity linear to the value of the code. The1595// assumption is that looking up astral identifier characters is1596// rare.1597function isInAstralSet(code, set) {1598var pos = 65536;1599for (var i = 0; i < set.length; i += 2) {1600pos += set[i];1601if (pos > code) {1602return false;1603}pos += set[i + 1];1604if (pos >= code) {1605return true;1606}1607}1608}1609function isIdentifierStart(code, astral) {1610if (code < 65) {1611return code === 36;1612}if (code < 91) {1613return true;1614}if (code < 97) {1615return code === 95;1616}if (code < 123) {1617return true;1618}if (code <= 65535) {1619return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));1620}if (astral === false) {1621return false;1622}return isInAstralSet(code, astralIdentifierStartCodes);1623}16241625function isIdentifierChar(code, astral) {1626if (code < 48) {1627return code === 36;1628}if (code < 58) {1629return true;1630}if (code < 65) {1631return false;1632}if (code < 91) {1633return true;1634}if (code < 97) {1635return code === 95;1636}if (code < 123) {1637return true;1638}if (code <= 65535) {1639return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));1640}if (astral === false) {1641return false;1642}return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);1643}16441645},{}],8:[function(_dereq_,module,exports){1646"use strict";16471648var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };16491650// The `getLineInfo` function is mostly useful when the1651// `locations` option is off (for performance reasons) and you1652// want to find the line/column position for a given character1653// offset. `input` should be the code string that the offset refers1654// into.16551656exports.getLineInfo = getLineInfo;1657exports.__esModule = true;16581659var Parser = _dereq_("./state").Parser;16601661var lineBreakG = _dereq_("./whitespace").lineBreakG;16621663var deprecate = _dereq_("util").deprecate;16641665// These are used when `options.locations` is on, for the1666// `startLoc` and `endLoc` properties.16671668var Position = exports.Position = (function () {1669function Position(line, col) {1670_classCallCheck(this, Position);16711672this.line = line;1673this.column = col;1674}16751676Position.prototype.offset = function offset(n) {1677return new Position(this.line, this.column + n);1678};16791680return Position;1681})();16821683var SourceLocation = exports.SourceLocation = function SourceLocation(p, start, end) {1684_classCallCheck(this, SourceLocation);16851686this.start = start;1687this.end = end;1688if (p.sourceFile !== null) this.source = p.sourceFile;1689};16901691function getLineInfo(input, offset) {1692for (var line = 1, cur = 0;;) {1693lineBreakG.lastIndex = cur;1694var match = lineBreakG.exec(input);1695if (match && match.index < offset) {1696++line;1697cur = match.index + match[0].length;1698} else {1699return new Position(line, offset - cur);1700}1701}1702}17031704var pp = Parser.prototype;17051706// This function is used to raise exceptions on parse errors. It1707// takes an offset integer (into the current `input`) to indicate1708// the location of the error, attaches the position to the end1709// of the error message, and then raises a `SyntaxError` with that1710// message.17111712pp.raise = function (pos, message) {1713var loc = getLineInfo(this.input, pos);1714message += " (" + loc.line + ":" + loc.column + ")";1715var err = new SyntaxError(message);1716err.pos = pos;err.loc = loc;err.raisedAt = this.pos;1717throw err;1718};17191720pp.curPosition = function () {1721return new Position(this.curLine, this.pos - this.lineStart);1722};17231724pp.markPosition = function () {1725return this.options.locations ? [this.start, this.startLoc] : this.start;1726};17271728},{"./state":13,"./whitespace":19,"util":5}],9:[function(_dereq_,module,exports){1729"use strict";17301731var tt = _dereq_("./tokentype").types;17321733var Parser = _dereq_("./state").Parser;17341735var reservedWords = _dereq_("./identifier").reservedWords;17361737var has = _dereq_("./util").has;17381739var pp = Parser.prototype;17401741// Convert existing expression atom to assignable pattern1742// if possible.17431744pp.toAssignable = function (node, isBinding) {1745if (this.options.ecmaVersion >= 6 && node) {1746switch (node.type) {1747case "Identifier":1748case "ObjectPattern":1749case "ArrayPattern":1750case "AssignmentPattern":1751break;17521753case "ObjectExpression":1754node.type = "ObjectPattern";1755for (var i = 0; i < node.properties.length; i++) {1756var prop = node.properties[i];1757if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter");1758this.toAssignable(prop.value, isBinding);1759}1760break;17611762case "ArrayExpression":1763node.type = "ArrayPattern";1764this.toAssignableList(node.elements, isBinding);1765break;17661767case "AssignmentExpression":1768if (node.operator === "=") {1769node.type = "AssignmentPattern";1770} else {1771this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");1772}1773break;17741775case "ParenthesizedExpression":1776node.expression = this.toAssignable(node.expression, isBinding);1777break;17781779case "MemberExpression":1780if (!isBinding) break;17811782default:1783this.raise(node.start, "Assigning to rvalue");1784}1785}1786return node;1787};17881789// Convert list of expression atoms to binding list.17901791pp.toAssignableList = function (exprList, isBinding) {1792var end = exprList.length;1793if (end) {1794var last = exprList[end - 1];1795if (last && last.type == "RestElement") {1796--end;1797} else if (last && last.type == "SpreadElement") {1798last.type = "RestElement";1799var arg = last.argument;1800this.toAssignable(arg, isBinding);1801if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") this.unexpected(arg.start);1802--end;1803}1804}1805for (var i = 0; i < end; i++) {1806var elt = exprList[i];1807if (elt) this.toAssignable(elt, isBinding);1808}1809return exprList;1810};18111812// Parses spread element.18131814pp.parseSpread = function (refShorthandDefaultPos) {1815var node = this.startNode();1816this.next();1817node.argument = this.parseMaybeAssign(refShorthandDefaultPos);1818return this.finishNode(node, "SpreadElement");1819};18201821pp.parseRest = function () {1822var node = this.startNode();1823this.next();1824node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected();1825return this.finishNode(node, "RestElement");1826};18271828// Parses lvalue (assignable) atom.18291830pp.parseBindingAtom = function () {1831if (this.options.ecmaVersion < 6) return this.parseIdent();1832switch (this.type) {1833case tt.name:1834return this.parseIdent();18351836case tt.bracketL:1837var node = this.startNode();1838this.next();1839node.elements = this.parseBindingList(tt.bracketR, true, true);1840return this.finishNode(node, "ArrayPattern");18411842case tt.braceL:1843return this.parseObj(true);18441845default:1846this.unexpected();1847}1848};18491850pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) {1851var elts = [],1852first = true;1853while (!this.eat(close)) {1854if (first) first = false;else this.expect(tt.comma);1855if (allowEmpty && this.type === tt.comma) {1856elts.push(null);1857} else if (allowTrailingComma && this.afterTrailingComma(close)) {1858break;1859} else if (this.type === tt.ellipsis) {1860var rest = this.parseRest();1861this.parseBindingListItem(rest);1862elts.push(rest);1863this.expect(close);1864break;1865} else {1866var elem = this.parseMaybeDefault(this.start, this.startLoc);1867this.parseBindingListItem(elem);1868elts.push(elem);1869}1870}1871return elts;1872};18731874pp.parseBindingListItem = function (param) {1875return param;1876};18771878// Parses assignment pattern around given atom if possible.18791880pp.parseMaybeDefault = function (startPos, startLoc, left) {1881if (Array.isArray(startPos)) {1882if (this.options.locations && noCalls === undefined) {1883// shift arguments to left by one1884left = startLoc;1885// flatten startPos1886startLoc = startPos[1];1887startPos = startPos[0];1888}1889}1890left = left || this.parseBindingAtom();1891if (!this.eat(tt.eq)) return left;1892var node = this.startNodeAt(startPos, startLoc);1893node.operator = "=";1894node.left = left;1895node.right = this.parseMaybeAssign();1896return this.finishNode(node, "AssignmentPattern");1897};18981899// Verify that a node is an lval — something that can be assigned1900// to.19011902pp.checkLVal = function (expr, isBinding, checkClashes) {1903switch (expr.type) {1904case "Identifier":1905if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode");1906if (checkClashes) {1907if (has(checkClashes, expr.name)) this.raise(expr.start, "Argument name clash in strict mode");1908checkClashes[expr.name] = true;1909}1910break;19111912case "MemberExpression":1913if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression");1914break;19151916case "ObjectPattern":1917for (var i = 0; i < expr.properties.length; i++) {1918this.checkLVal(expr.properties[i].value, isBinding, checkClashes);1919}break;19201921case "ArrayPattern":1922for (var i = 0; i < expr.elements.length; i++) {1923var elem = expr.elements[i];1924if (elem) this.checkLVal(elem, isBinding, checkClashes);1925}1926break;19271928case "AssignmentPattern":1929this.checkLVal(expr.left, isBinding, checkClashes);1930break;19311932case "RestElement":1933this.checkLVal(expr.argument, isBinding, checkClashes);1934break;19351936case "ParenthesizedExpression":1937this.checkLVal(expr.expression, isBinding, checkClashes);1938break;19391940default:1941this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue");1942}1943};19441945},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],10:[function(_dereq_,module,exports){1946"use strict";19471948var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };19491950exports.__esModule = true;19511952var Parser = _dereq_("./state").Parser;19531954var SourceLocation = _dereq_("./location").SourceLocation;19551956// Start an AST node, attaching a start offset.19571958var pp = Parser.prototype;19591960var Node = exports.Node = function Node() {1961_classCallCheck(this, Node);1962};19631964pp.startNode = function () {1965var node = new Node();1966node.start = this.start;1967if (this.options.locations) node.loc = new SourceLocation(this, this.startLoc);1968if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;1969if (this.options.ranges) node.range = [this.start, 0];1970return node;1971};19721973pp.startNodeAt = function (pos, loc) {1974var node = new Node();1975if (Array.isArray(pos)) {1976if (this.options.locations && loc === undefined) {1977// flatten pos1978loc = pos[1];1979pos = pos[0];1980}1981}1982node.start = pos;1983if (this.options.locations) node.loc = new SourceLocation(this, loc);1984if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;1985if (this.options.ranges) node.range = [pos, 0];1986return node;1987};19881989// Finish an AST node, adding `type` and `end` properties.19901991pp.finishNode = function (node, type) {1992node.type = type;1993node.end = this.lastTokEnd;1994if (this.options.locations) node.loc.end = this.lastTokEndLoc;1995if (this.options.ranges) node.range[1] = this.lastTokEnd;1996return node;1997};19981999// Finish node at given position20002001pp.finishNodeAt = function (node, type, pos, loc) {2002node.type = type;2003if (Array.isArray(pos)) {2004if (this.options.locations && loc === undefined) {2005// flatten pos2006loc = pos[1];2007pos = pos[0];2008}2009}2010node.end = pos;2011if (this.options.locations) node.loc.end = loc;2012if (this.options.ranges) node.range[1] = pos;2013return node;2014};20152016},{"./location":8,"./state":13}],11:[function(_dereq_,module,exports){201720182019// Interpret and default an options object20202021"use strict";20222023exports.getOptions = getOptions;2024exports.__esModule = true;20252026var _util = _dereq_("./util");20272028var has = _util.has;2029var isArray = _util.isArray;20302031var SourceLocation = _dereq_("./location").SourceLocation;20322033// A second optional argument can be given to further configure2034// the parser process. These options are recognized:20352036var defaultOptions = {2037// `ecmaVersion` indicates the ECMAScript version to parse. Must2038// be either 3, or 5, or 6. This influences support for strict2039// mode, the set of reserved words, support for getters and2040// setters and other features.2041ecmaVersion: 5,2042// Source type ("script" or "module") for different semantics2043sourceType: "script",2044// `onInsertedSemicolon` can be a callback that will be called2045// when a semicolon is automatically inserted. It will be passed2046// th position of the comma as an offset, and if `locations` is2047// enabled, it is given the location as a `{line, column}` object2048// as second argument.2049onInsertedSemicolon: null,2050// `onTrailingComma` is similar to `onInsertedSemicolon`, but for2051// trailing commas.2052onTrailingComma: null,2053// By default, reserved words are not enforced. Disable2054// `allowReserved` to enforce them. When this option has the2055// value "never", reserved words and keywords can also not be2056// used as property names.2057allowReserved: true,2058// When enabled, a return at the top level is not considered an2059// error.2060allowReturnOutsideFunction: false,2061// When enabled, import/export statements are not constrained to2062// appearing at the top of the program.2063allowImportExportEverywhere: false,2064// When enabled, hashbang directive in the beginning of file2065// is allowed and treated as a line comment.2066allowHashBang: false,2067// When `locations` is on, `loc` properties holding objects with2068// `start` and `end` properties in `{line, column}` form (with2069// line being 1-based and column 0-based) will be attached to the2070// nodes.2071locations: false,2072// A function can be passed as `onToken` option, which will2073// cause Acorn to call that function with object in the same2074// format as tokenize() returns. Note that you are not2075// allowed to call the parser from the callback—that will2076// corrupt its internal state.2077onToken: null,2078// A function can be passed as `onComment` option, which will2079// cause Acorn to call that function with `(block, text, start,2080// end)` parameters whenever a comment is skipped. `block` is a2081// boolean indicating whether this is a block (`/* */`) comment,2082// `text` is the content of the comment, and `start` and `end` are2083// character offsets that denote the start and end of the comment.2084// When the `locations` option is on, two more parameters are2085// passed, the full `{line, column}` locations of the start and2086// end of the comments. Note that you are not allowed to call the2087// parser from the callback—that will corrupt its internal state.2088onComment: null,2089// Nodes have their start and end characters offsets recorded in2090// `start` and `end` properties (directly on the node, rather than2091// the `loc` object, which holds line/column data. To also add a2092// [semi-standardized][range] `range` property holding a `[start,2093// end]` array with the same numbers, set the `ranges` option to2094// `true`.2095//2096// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=7456782097ranges: false,2098// It is possible to parse multiple files into a single AST by2099// passing the tree produced by parsing the first file as2100// `program` option in subsequent parses. This will add the2101// toplevel forms of the parsed file to the `Program` (top) node2102// of an existing parse tree.2103program: null,2104// When `locations` is on, you can pass this to record the source2105// file in every node's `loc` object.2106sourceFile: null,2107// This value, if given, is stored in every node, whether2108// `locations` is on or off.2109directSourceFile: null,2110// When enabled, parenthesized expressions are represented by2111// (non-standard) ParenthesizedExpression nodes2112preserveParens: false,2113plugins: {}2114};exports.defaultOptions = defaultOptions;21152116function getOptions(opts) {2117var options = {};2118for (var opt in defaultOptions) {2119options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt];2120}if (isArray(options.onToken)) {2121(function () {2122var tokens = options.onToken;2123options.onToken = function (token) {2124return tokens.push(token);2125};2126})();2127}2128if (isArray(options.onComment)) options.onComment = pushComment(options, options.onComment);21292130return options;2131}21322133function pushComment(options, array) {2134return function (block, text, start, end, startLoc, endLoc) {2135var comment = {2136type: block ? "Block" : "Line",2137value: text,2138start: start,2139end: end2140};2141if (options.locations) comment.loc = new SourceLocation(this, startLoc, endLoc);2142if (options.ranges) comment.range = [start, end];2143array.push(comment);2144};2145}21462147},{"./location":8,"./util":18}],12:[function(_dereq_,module,exports){2148"use strict";21492150var tt = _dereq_("./tokentype").types;21512152var Parser = _dereq_("./state").Parser;21532154var lineBreak = _dereq_("./whitespace").lineBreak;21552156var pp = Parser.prototype;21572158// ## Parser utilities21592160// Test whether a statement node is the string literal `"use strict"`.21612162pp.isUseStrict = function (stmt) {2163return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.value === "use strict";2164};21652166// Predicate that tests whether the next token is of the given2167// type, and if yes, consumes it as a side effect.21682169pp.eat = function (type) {2170if (this.type === type) {2171this.next();2172return true;2173} else {2174return false;2175}2176};21772178// Tests whether parsed token is a contextual keyword.21792180pp.isContextual = function (name) {2181return this.type === tt.name && this.value === name;2182};21832184// Consumes contextual keyword if possible.21852186pp.eatContextual = function (name) {2187return this.value === name && this.eat(tt.name);2188};21892190// Asserts that following token is given contextual keyword.21912192pp.expectContextual = function (name) {2193if (!this.eatContextual(name)) this.unexpected();2194};21952196// Test whether a semicolon can be inserted at the current position.21972198pp.canInsertSemicolon = function () {2199return this.type === tt.eof || this.type === tt.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));2200};22012202pp.insertSemicolon = function () {2203if (this.canInsertSemicolon()) {2204if (this.options.onInsertedSemicolon) this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);2205return true;2206}2207};22082209// Consume a semicolon, or, failing that, see if we are allowed to2210// pretend that there is a semicolon at this position.22112212pp.semicolon = function () {2213if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected();2214};22152216pp.afterTrailingComma = function (tokType) {2217if (this.type == tokType) {2218if (this.options.onTrailingComma) this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);2219this.next();2220return true;2221}2222};22232224// Expect a token of a given type. If found, consume it, otherwise,2225// raise an unexpected token error.22262227pp.expect = function (type) {2228this.eat(type) || this.unexpected();2229};22302231// Raise an unexpected token error.22322233pp.unexpected = function (pos) {2234this.raise(pos != null ? pos : this.start, "Unexpected token");2235};22362237},{"./state":13,"./tokentype":17,"./whitespace":19}],13:[function(_dereq_,module,exports){2238"use strict";22392240exports.Parser = Parser;2241exports.__esModule = true;22422243var _identifier = _dereq_("./identifier");22442245var reservedWords = _identifier.reservedWords;2246var keywords = _identifier.keywords;22472248var tt = _dereq_("./tokentype").types;22492250var lineBreak = _dereq_("./whitespace").lineBreak;22512252function Parser(options, input, startPos) {2253this.options = options;2254this.sourceFile = this.options.sourceFile || null;2255this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5];2256this.isReservedWord = reservedWords[this.options.ecmaVersion];2257this.input = input;22582259// Load plugins2260this.loadPlugins(this.options.plugins);22612262// Set up token state22632264// The current position of the tokenizer in the input.2265if (startPos) {2266this.pos = startPos;2267this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos));2268this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;2269} else {2270this.pos = this.lineStart = 0;2271this.curLine = 1;2272}22732274// Properties of the current token:2275// Its type2276this.type = tt.eof;2277// For tokens that include more information than their type, the value2278this.value = null;2279// Its start and end offset2280this.start = this.end = this.pos;2281// And, if locations are used, the {line, column} object2282// corresponding to those offsets2283this.startLoc = this.endLoc = null;22842285// Position information for the previous token2286this.lastTokEndLoc = this.lastTokStartLoc = null;2287this.lastTokStart = this.lastTokEnd = this.pos;22882289// The context stack is used to superficially track syntactic2290// context to predict whether a regular expression is allowed in a2291// given position.2292this.context = this.initialContext();2293this.exprAllowed = true;22942295// Figure out if it's a module code.2296this.strict = this.inModule = this.options.sourceType === "module";22972298// Used to signify the start of a potential arrow function2299this.potentialArrowAt = -1;23002301// Flags to track whether we are in a function, a generator.2302this.inFunction = this.inGenerator = false;2303// Labels in scope.2304this.labels = [];23052306// If enabled, skip leading hashbang line.2307if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === "#!") this.skipLineComment(2);2308}23092310Parser.prototype.extend = function (name, f) {2311this[name] = f(this[name]);2312};23132314// Registered plugins23152316var plugins = {};23172318exports.plugins = plugins;2319Parser.prototype.loadPlugins = function (plugins) {2320for (var _name in plugins) {2321var plugin = exports.plugins[_name];2322if (!plugin) throw new Error("Plugin '" + _name + "' not found");2323plugin(this, plugins[_name]);2324}2325};23262327},{"./identifier":7,"./tokentype":17,"./whitespace":19}],14:[function(_dereq_,module,exports){2328"use strict";23292330var tt = _dereq_("./tokentype").types;23312332var Parser = _dereq_("./state").Parser;23332334var lineBreak = _dereq_("./whitespace").lineBreak;23352336var pp = Parser.prototype;23372338// ### Statement parsing23392340// Parse a program. Initializes the parser, reads any number of2341// statements, and wraps them in a Program node. Optionally takes a2342// `program` argument. If present, the statements will be appended2343// to its body instead of creating a new node.23442345pp.parseTopLevel = function (node) {2346var first = true;2347if (!node.body) node.body = [];2348while (this.type !== tt.eof) {2349var stmt = this.parseStatement(true, true);2350node.body.push(stmt);2351if (first && this.isUseStrict(stmt)) this.setStrict(true);2352first = false;2353}2354this.next();2355if (this.options.ecmaVersion >= 6) {2356node.sourceType = this.options.sourceType;2357}2358return this.finishNode(node, "Program");2359};23602361var loopLabel = { kind: "loop" },2362switchLabel = { kind: "switch" };23632364// Parse a single statement.2365//2366// If expecting a statement and finding a slash operator, parse a2367// regular expression literal. This is to handle cases like2368// `if (foo) /blah/.exec(foo)`, where looking at the previous token2369// does not help.23702371pp.parseStatement = function (declaration, topLevel) {2372var starttype = this.type,2373node = this.startNode();23742375// Most types of statements are recognized by the keyword they2376// start with. Many are trivial to parse, some require a bit of2377// complexity.23782379switch (starttype) {2380case tt._break:case tt._continue:2381return this.parseBreakContinueStatement(node, starttype.keyword);2382case tt._debugger:2383return this.parseDebuggerStatement(node);2384case tt._do:2385return this.parseDoStatement(node);2386case tt._for:2387return this.parseForStatement(node);2388case tt._function:2389if (!declaration && this.options.ecmaVersion >= 6) this.unexpected();2390return this.parseFunctionStatement(node);2391case tt._class:2392if (!declaration) this.unexpected();2393return this.parseClass(node, true);2394case tt._if:2395return this.parseIfStatement(node);2396case tt._return:2397return this.parseReturnStatement(node);2398case tt._switch:2399return this.parseSwitchStatement(node);2400case tt._throw:2401return this.parseThrowStatement(node);2402case tt._try:2403return this.parseTryStatement(node);2404case tt._let:case tt._const:2405if (!declaration) this.unexpected(); // NOTE: falls through to _var2406case tt._var:2407return this.parseVarStatement(node, starttype);2408case tt._while:2409return this.parseWhileStatement(node);2410case tt._with:2411return this.parseWithStatement(node);2412case tt.braceL:2413return this.parseBlock();2414case tt.semi:2415return this.parseEmptyStatement(node);2416case tt._export:2417case tt._import:2418if (!this.options.allowImportExportEverywhere) {2419if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");2420if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");2421}2422return starttype === tt._import ? this.parseImport(node) : this.parseExport(node);24232424// If the statement does not start with a statement keyword or a2425// brace, it's an ExpressionStatement or LabeledStatement. We2426// simply start parsing an expression, and afterwards, if the2427// next token is a colon and the expression was a simple2428// Identifier node, we switch to interpreting it as a label.2429default:2430var maybeName = this.value,2431expr = this.parseExpression();2432if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) return this.parseLabeledStatement(node, maybeName, expr);else return this.parseExpressionStatement(node, expr);2433}2434};24352436pp.parseBreakContinueStatement = function (node, keyword) {2437var isBreak = keyword == "break";2438this.next();2439if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null;else if (this.type !== tt.name) this.unexpected();else {2440node.label = this.parseIdent();2441this.semicolon();2442}24432444// Verify that there is an actual destination to break or2445// continue to.2446for (var i = 0; i < this.labels.length; ++i) {2447var lab = this.labels[i];2448if (node.label == null || lab.name === node.label.name) {2449if (lab.kind != null && (isBreak || lab.kind === "loop")) break;2450if (node.label && isBreak) break;2451}2452}2453if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword);2454return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");2455};24562457pp.parseDebuggerStatement = function (node) {2458this.next();2459this.semicolon();2460return this.finishNode(node, "DebuggerStatement");2461};24622463pp.parseDoStatement = function (node) {2464this.next();2465this.labels.push(loopLabel);2466node.body = this.parseStatement(false);2467this.labels.pop();2468this.expect(tt._while);2469node.test = this.parseParenExpression();2470if (this.options.ecmaVersion >= 6) this.eat(tt.semi);else this.semicolon();2471return this.finishNode(node, "DoWhileStatement");2472};24732474// Disambiguating between a `for` and a `for`/`in` or `for`/`of`2475// loop is non-trivial. Basically, we have to parse the init `var`2476// statement or expression, disallowing the `in` operator (see2477// the second parameter to `parseExpression`), and then check2478// whether the next token is `in` or `of`. When there is no init2479// part (semicolon immediately after the opening parenthesis), it2480// is a regular `for` loop.24812482pp.parseForStatement = function (node) {2483this.next();2484this.labels.push(loopLabel);2485this.expect(tt.parenL);2486if (this.type === tt.semi) return this.parseFor(node, null);2487if (this.type === tt._var || this.type === tt._let || this.type === tt._const) {2488var _init = this.startNode(),2489varKind = this.type;2490this.next();2491this.parseVar(_init, true, varKind);2492this.finishNode(_init, "VariableDeclaration");2493if ((this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && _init.declarations.length === 1 && !(varKind !== tt._var && _init.declarations[0].init)) return this.parseForIn(node, _init);2494return this.parseFor(node, _init);2495}2496var refShorthandDefaultPos = { start: 0 };2497var init = this.parseExpression(true, refShorthandDefaultPos);2498if (this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) {2499this.toAssignable(init);2500this.checkLVal(init);2501return this.parseForIn(node, init);2502} else if (refShorthandDefaultPos.start) {2503this.unexpected(refShorthandDefaultPos.start);2504}2505return this.parseFor(node, init);2506};25072508pp.parseFunctionStatement = function (node) {2509this.next();2510return this.parseFunction(node, true);2511};25122513pp.parseIfStatement = function (node) {2514this.next();2515node.test = this.parseParenExpression();2516node.consequent = this.parseStatement(false);2517node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null;2518return this.finishNode(node, "IfStatement");2519};25202521pp.parseReturnStatement = function (node) {2522if (!this.inFunction && !this.options.allowReturnOutsideFunction) this.raise(this.start, "'return' outside of function");2523this.next();25242525// In `return` (and `break`/`continue`), the keywords with2526// optional arguments, we eagerly look for a semicolon or the2527// possibility to insert one.25282529if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null;else {2530node.argument = this.parseExpression();this.semicolon();2531}2532return this.finishNode(node, "ReturnStatement");2533};25342535pp.parseSwitchStatement = function (node) {2536this.next();2537node.discriminant = this.parseParenExpression();2538node.cases = [];2539this.expect(tt.braceL);2540this.labels.push(switchLabel);25412542// Statements under must be grouped (by label) in SwitchCase2543// nodes. `cur` is used to keep the node that we are currently2544// adding statements to.25452546for (var cur, sawDefault; this.type != tt.braceR;) {2547if (this.type === tt._case || this.type === tt._default) {2548var isCase = this.type === tt._case;2549if (cur) this.finishNode(cur, "SwitchCase");2550node.cases.push(cur = this.startNode());2551cur.consequent = [];2552this.next();2553if (isCase) {2554cur.test = this.parseExpression();2555} else {2556if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses");2557sawDefault = true;2558cur.test = null;2559}2560this.expect(tt.colon);2561} else {2562if (!cur) this.unexpected();2563cur.consequent.push(this.parseStatement(true));2564}2565}2566if (cur) this.finishNode(cur, "SwitchCase");2567this.next(); // Closing brace2568this.labels.pop();2569return this.finishNode(node, "SwitchStatement");2570};25712572pp.parseThrowStatement = function (node) {2573this.next();2574if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) this.raise(this.lastTokEnd, "Illegal newline after throw");2575node.argument = this.parseExpression();2576this.semicolon();2577return this.finishNode(node, "ThrowStatement");2578};25792580// Reused empty array added for node fields that are always empty.25812582var empty = [];25832584pp.parseTryStatement = function (node) {2585this.next();2586node.block = this.parseBlock();2587node.handler = null;2588if (this.type === tt._catch) {2589var clause = this.startNode();2590this.next();2591this.expect(tt.parenL);2592clause.param = this.parseBindingAtom();2593this.checkLVal(clause.param, true);2594this.expect(tt.parenR);2595clause.guard = null;2596clause.body = this.parseBlock();2597node.handler = this.finishNode(clause, "CatchClause");2598}2599node.guardedHandlers = empty;2600node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null;2601if (!node.handler && !node.finalizer) this.raise(node.start, "Missing catch or finally clause");2602return this.finishNode(node, "TryStatement");2603};26042605pp.parseVarStatement = function (node, kind) {2606this.next();2607this.parseVar(node, false, kind);2608this.semicolon();2609return this.finishNode(node, "VariableDeclaration");2610};26112612pp.parseWhileStatement = function (node) {2613this.next();2614node.test = this.parseParenExpression();2615this.labels.push(loopLabel);2616node.body = this.parseStatement(false);2617this.labels.pop();2618return this.finishNode(node, "WhileStatement");2619};26202621pp.parseWithStatement = function (node) {2622if (this.strict) this.raise(this.start, "'with' in strict mode");2623this.next();2624node.object = this.parseParenExpression();2625node.body = this.parseStatement(false);2626return this.finishNode(node, "WithStatement");2627};26282629pp.parseEmptyStatement = function (node) {2630this.next();2631return this.finishNode(node, "EmptyStatement");2632};26332634pp.parseLabeledStatement = function (node, maybeName, expr) {2635for (var i = 0; i < this.labels.length; ++i) {2636if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");2637}var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null;2638this.labels.push({ name: maybeName, kind: kind });2639node.body = this.parseStatement(true);2640this.labels.pop();2641node.label = expr;2642return this.finishNode(node, "LabeledStatement");2643};26442645pp.parseExpressionStatement = function (node, expr) {2646node.expression = expr;2647this.semicolon();2648return this.finishNode(node, "ExpressionStatement");2649};26502651// Parse a semicolon-enclosed block of statements, handling `"use2652// strict"` declarations when `allowStrict` is true (used for2653// function bodies).26542655pp.parseBlock = function (allowStrict) {2656var node = this.startNode(),2657first = true,2658oldStrict = undefined;2659node.body = [];2660this.expect(tt.braceL);2661while (!this.eat(tt.braceR)) {2662var stmt = this.parseStatement(true);2663node.body.push(stmt);2664if (first && allowStrict && this.isUseStrict(stmt)) {2665oldStrict = this.strict;2666this.setStrict(this.strict = true);2667}2668first = false;2669}2670if (oldStrict === false) this.setStrict(false);2671return this.finishNode(node, "BlockStatement");2672};26732674// Parse a regular `for` loop. The disambiguation code in2675// `parseStatement` will already have parsed the init statement or2676// expression.26772678pp.parseFor = function (node, init) {2679node.init = init;2680this.expect(tt.semi);2681node.test = this.type === tt.semi ? null : this.parseExpression();2682this.expect(tt.semi);2683node.update = this.type === tt.parenR ? null : this.parseExpression();2684this.expect(tt.parenR);2685node.body = this.parseStatement(false);2686this.labels.pop();2687return this.finishNode(node, "ForStatement");2688};26892690// Parse a `for`/`in` and `for`/`of` loop, which are almost2691// same from parser's perspective.26922693pp.parseForIn = function (node, init) {2694var type = this.type === tt._in ? "ForInStatement" : "ForOfStatement";2695this.next();2696node.left = init;2697node.right = this.parseExpression();2698this.expect(tt.parenR);2699node.body = this.parseStatement(false);2700this.labels.pop();2701return this.finishNode(node, type);2702};27032704// Parse a list of variable declarations.27052706pp.parseVar = function (node, isFor, kind) {2707node.declarations = [];2708node.kind = kind.keyword;2709for (;;) {2710var decl = this.startNode();2711this.parseVarId(decl);2712if (this.eat(tt.eq)) {2713decl.init = this.parseMaybeAssign(isFor);2714} else if (kind === tt._const && !(this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {2715this.unexpected();2716} else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) {2717this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");2718} else {2719decl.init = null;2720}2721node.declarations.push(this.finishNode(decl, "VariableDeclarator"));2722if (!this.eat(tt.comma)) break;2723}2724return node;2725};27262727pp.parseVarId = function (decl) {2728decl.id = this.parseBindingAtom();2729this.checkLVal(decl.id, true);2730};27312732// Parse a function declaration or literal (depending on the2733// `isStatement` parameter).27342735pp.parseFunction = function (node, isStatement, allowExpressionBody) {2736this.initFunction(node);2737if (this.options.ecmaVersion >= 6) node.generator = this.eat(tt.star);2738if (isStatement || this.type === tt.name) node.id = this.parseIdent();2739this.parseFunctionParams(node);2740this.parseFunctionBody(node, allowExpressionBody);2741return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");2742};27432744pp.parseFunctionParams = function (node) {2745this.expect(tt.parenL);2746node.params = this.parseBindingList(tt.parenR, false, false);2747};27482749// Parse a class declaration or literal (depending on the2750// `isStatement` parameter).27512752pp.parseClass = function (node, isStatement) {2753this.next();2754this.parseClassId(node, isStatement);2755this.parseClassSuper(node);2756var classBody = this.startNode();2757var hadConstructor = false;2758classBody.body = [];2759this.expect(tt.braceL);2760while (!this.eat(tt.braceR)) {2761if (this.eat(tt.semi)) continue;2762var method = this.startNode();2763var isGenerator = this.eat(tt.star);2764var isMaybeStatic = this.type === tt.name && this.value === "static";2765this.parsePropertyName(method);2766method["static"] = isMaybeStatic && this.type !== tt.parenL;2767if (method["static"]) {2768if (isGenerator) this.unexpected();2769isGenerator = this.eat(tt.star);2770this.parsePropertyName(method);2771}2772method.kind = "method";2773if (!method.computed) {2774var key = method.key;27752776var isGetSet = false;2777if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) {2778isGetSet = true;2779method.kind = key.name;2780key = this.parsePropertyName(method);2781}2782if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) {2783if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");2784if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");2785if (isGenerator) this.raise(key.start, "Constructor can't be a generator");2786method.kind = "constructor";2787hadConstructor = true;2788}2789}2790this.parseClassMethod(classBody, method, isGenerator);2791}2792node.body = this.finishNode(classBody, "ClassBody");2793return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");2794};27952796pp.parseClassMethod = function (classBody, method, isGenerator) {2797method.value = this.parseMethod(isGenerator);2798classBody.body.push(this.finishNode(method, "MethodDefinition"));2799};28002801pp.parseClassId = function (node, isStatement) {2802node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null;2803};28042805pp.parseClassSuper = function (node) {2806node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null;2807};28082809// Parses module export declaration.28102811pp.parseExport = function (node) {2812this.next();2813// export * from '...'2814if (this.eat(tt.star)) {2815this.expectContextual("from");2816node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();2817this.semicolon();2818return this.finishNode(node, "ExportAllDeclaration");2819}2820if (this.eat(tt._default)) {2821// export default ...2822var expr = this.parseMaybeAssign();2823var needsSemi = true;2824if (expr.type == "FunctionExpression" || expr.type == "ClassExpression") {2825needsSemi = false;2826if (expr.id) {2827expr.type = expr.type == "FunctionExpression" ? "FunctionDeclaration" : "ClassDeclaration";2828}2829}2830node.declaration = expr;2831if (needsSemi) this.semicolon();2832return this.finishNode(node, "ExportDefaultDeclaration");2833}2834// export var|const|let|function|class ...2835if (this.shouldParseExportStatement()) {2836node.declaration = this.parseStatement(true);2837node.specifiers = [];2838node.source = null;2839} else {2840// export { x, y as z } [from '...']2841node.declaration = null;2842node.specifiers = this.parseExportSpecifiers();2843if (this.eatContextual("from")) {2844node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();2845} else {2846node.source = null;2847}2848this.semicolon();2849}2850return this.finishNode(node, "ExportNamedDeclaration");2851};28522853pp.shouldParseExportStatement = function () {2854return this.type.keyword;2855};28562857// Parses a comma-separated list of module exports.28582859pp.parseExportSpecifiers = function () {2860var nodes = [],2861first = true;2862// export { x, y as z } [from '...']2863this.expect(tt.braceL);2864while (!this.eat(tt.braceR)) {2865if (!first) {2866this.expect(tt.comma);2867if (this.afterTrailingComma(tt.braceR)) break;2868} else first = false;28692870var node = this.startNode();2871node.local = this.parseIdent(this.type === tt._default);2872node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;2873nodes.push(this.finishNode(node, "ExportSpecifier"));2874}2875return nodes;2876};28772878// Parses import declaration.28792880pp.parseImport = function (node) {2881this.next();2882// import '...'2883if (this.type === tt.string) {2884node.specifiers = empty;2885node.source = this.parseExprAtom();2886node.kind = "";2887} else {2888node.specifiers = this.parseImportSpecifiers();2889this.expectContextual("from");2890node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();2891}2892this.semicolon();2893return this.finishNode(node, "ImportDeclaration");2894};28952896// Parses a comma-separated list of module imports.28972898pp.parseImportSpecifiers = function () {2899var nodes = [],2900first = true;2901if (this.type === tt.name) {2902// import defaultObj, { x, y as z } from '...'2903var node = this.startNode();2904node.local = this.parseIdent();2905this.checkLVal(node.local, true);2906nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));2907if (!this.eat(tt.comma)) return nodes;2908}2909if (this.type === tt.star) {2910var node = this.startNode();2911this.next();2912this.expectContextual("as");2913node.local = this.parseIdent();2914this.checkLVal(node.local, true);2915nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"));2916return nodes;2917}2918this.expect(tt.braceL);2919while (!this.eat(tt.braceR)) {2920if (!first) {2921this.expect(tt.comma);2922if (this.afterTrailingComma(tt.braceR)) break;2923} else first = false;29242925var node = this.startNode();2926node.imported = this.parseIdent(true);2927node.local = this.eatContextual("as") ? this.parseIdent() : node.imported;2928this.checkLVal(node.local, true);2929nodes.push(this.finishNode(node, "ImportSpecifier"));2930}2931return nodes;2932};29332934},{"./state":13,"./tokentype":17,"./whitespace":19}],15:[function(_dereq_,module,exports){2935"use strict";29362937var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };29382939exports.__esModule = true;2940// The algorithm used to determine whether a regexp can appear at a2941// given point in the program is loosely based on sweet.js' approach.2942// See https://github.com/mozilla/sweet.js/wiki/design29432944var Parser = _dereq_("./state").Parser;29452946var tt = _dereq_("./tokentype").types;29472948var lineBreak = _dereq_("./whitespace").lineBreak;29492950var TokContext = exports.TokContext = function TokContext(token, isExpr, preserveSpace, override) {2951_classCallCheck(this, TokContext);29522953this.token = token;2954this.isExpr = isExpr;2955this.preserveSpace = preserveSpace;2956this.override = override;2957};29582959var types = {2960b_stat: new TokContext("{", false),2961b_expr: new TokContext("{", true),2962b_tmpl: new TokContext("${", true),2963p_stat: new TokContext("(", false),2964p_expr: new TokContext("(", true),2965q_tmpl: new TokContext("`", true, true, function (p) {2966return p.readTmplToken();2967}),2968f_expr: new TokContext("function", true)2969};29702971exports.types = types;2972var pp = Parser.prototype;29732974pp.initialContext = function () {2975return [types.b_stat];2976};29772978pp.braceIsBlock = function (prevType) {2979var parent = undefined;2980if (prevType === tt.colon && (parent = this.curContext()).token == "{") return !parent.isExpr;2981if (prevType === tt._return) return lineBreak.test(this.input.slice(this.lastTokEnd, this.start));2982if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof) return true;2983if (prevType == tt.braceL) return this.curContext() === types.b_stat;2984return !this.exprAllowed;2985};29862987pp.updateContext = function (prevType) {2988var update = undefined,2989type = this.type;2990if (type.keyword && prevType == tt.dot) this.exprAllowed = false;else if (update = type.updateContext) update.call(this, prevType);else this.exprAllowed = type.beforeExpr;2991};29922993// Token-specific context update code29942995tt.parenR.updateContext = tt.braceR.updateContext = function () {2996if (this.context.length == 1) {2997this.exprAllowed = true;2998return;2999}3000var out = this.context.pop();3001if (out === types.b_stat && this.curContext() === types.f_expr) {3002this.context.pop();3003this.exprAllowed = false;3004} else if (out === types.b_tmpl) {3005this.exprAllowed = true;3006} else {3007this.exprAllowed = !out.isExpr;3008}3009};30103011tt.braceL.updateContext = function (prevType) {3012this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);3013this.exprAllowed = true;3014};30153016tt.dollarBraceL.updateContext = function () {3017this.context.push(types.b_tmpl);3018this.exprAllowed = true;3019};30203021tt.parenL.updateContext = function (prevType) {3022var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while;3023this.context.push(statementParens ? types.p_stat : types.p_expr);3024this.exprAllowed = true;3025};30263027tt.incDec.updateContext = function () {};30283029tt._function.updateContext = function () {3030if (this.curContext() !== types.b_stat) this.context.push(types.f_expr);3031this.exprAllowed = false;3032};30333034tt.backQuote.updateContext = function () {3035if (this.curContext() === types.q_tmpl) this.context.pop();else this.context.push(types.q_tmpl);3036this.exprAllowed = false;3037};30383039// tokExprAllowed stays unchanged30403041},{"./state":13,"./tokentype":17,"./whitespace":19}],16:[function(_dereq_,module,exports){3042"use strict";30433044var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };30453046exports.__esModule = true;30473048var _identifier = _dereq_("./identifier");30493050var isIdentifierStart = _identifier.isIdentifierStart;3051var isIdentifierChar = _identifier.isIdentifierChar;30523053var _tokentype = _dereq_("./tokentype");30543055var tt = _tokentype.types;3056var keywordTypes = _tokentype.keywords;30573058var Parser = _dereq_("./state").Parser;30593060var SourceLocation = _dereq_("./location").SourceLocation;30613062var _whitespace = _dereq_("./whitespace");30633064var lineBreak = _whitespace.lineBreak;3065var lineBreakG = _whitespace.lineBreakG;3066var isNewLine = _whitespace.isNewLine;3067var nonASCIIwhitespace = _whitespace.nonASCIIwhitespace;30683069// Object type used to represent tokens. Note that normally, tokens3070// simply exist as properties on the parser object. This is only3071// used for the onToken callback and the external tokenizer.30723073var Token = exports.Token = function Token(p) {3074_classCallCheck(this, Token);30753076this.type = p.type;3077this.value = p.value;3078this.start = p.start;3079this.end = p.end;3080if (p.options.locations) this.loc = new SourceLocation(p, p.startLoc, p.endLoc);3081if (p.options.ranges) this.range = [p.start, p.end];3082};30833084// ## Tokenizer30853086var pp = Parser.prototype;30873088// Are we running under Rhino?3089var isRhino = typeof Packages !== "undefined";30903091// Move to the next token30923093pp.next = function () {3094if (this.options.onToken) this.options.onToken(new Token(this));30953096this.lastTokEnd = this.end;3097this.lastTokStart = this.start;3098this.lastTokEndLoc = this.endLoc;3099this.lastTokStartLoc = this.startLoc;3100this.nextToken();3101};31023103pp.getToken = function () {3104this.next();3105return new Token(this);3106};31073108// If we're in an ES6 environment, make parsers iterable3109if (typeof Symbol !== "undefined") pp[Symbol.iterator] = function () {3110var self = this;3111return { next: function next() {3112var token = self.getToken();3113return {3114done: token.type === tt.eof,3115value: token3116};3117} };3118};31193120// Toggle strict mode. Re-reads the next number or string to please3121// pedantic tests (`"use strict"; 010;` should fail).31223123pp.setStrict = function (strict) {3124this.strict = strict;3125if (this.type !== tt.num && this.type !== tt.string) return;3126this.pos = this.start;3127if (this.options.locations) {3128while (this.pos < this.lineStart) {3129this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;3130--this.curLine;3131}3132}3133this.nextToken();3134};31353136pp.curContext = function () {3137return this.context[this.context.length - 1];3138};31393140// Read a single token, updating the parser object's token-related3141// properties.31423143pp.nextToken = function () {3144var curContext = this.curContext();3145if (!curContext || !curContext.preserveSpace) this.skipSpace();31463147this.start = this.pos;3148if (this.options.locations) this.startLoc = this.curPosition();3149if (this.pos >= this.input.length) return this.finishToken(tt.eof);31503151if (curContext.override) return curContext.override(this);else this.readToken(this.fullCharCodeAtPos());3152};31533154pp.readToken = function (code) {3155// Identifier or keyword. '\uXXXX' sequences are allowed in3156// identifiers, so '\' also dispatches to that.3157if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) return this.readWord();31583159return this.getTokenFromCode(code);3160};31613162pp.fullCharCodeAtPos = function () {3163var code = this.input.charCodeAt(this.pos);3164if (code <= 55295 || code >= 57344) return code;3165var next = this.input.charCodeAt(this.pos + 1);3166return (code << 10) + next - 56613888;3167};31683169pp.skipBlockComment = function () {3170var startLoc = this.options.onComment && this.options.locations && this.curPosition();3171var start = this.pos,3172end = this.input.indexOf("*/", this.pos += 2);3173if (end === -1) this.raise(this.pos - 2, "Unterminated comment");3174this.pos = end + 2;3175if (this.options.locations) {3176lineBreakG.lastIndex = start;3177var match = undefined;3178while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {3179++this.curLine;3180this.lineStart = match.index + match[0].length;3181}3182}3183if (this.options.onComment) this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, startLoc, this.options.locations && this.curPosition());3184};31853186pp.skipLineComment = function (startSkip) {3187var start = this.pos;3188var startLoc = this.options.onComment && this.options.locations && this.curPosition();3189var ch = this.input.charCodeAt(this.pos += startSkip);3190while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {3191++this.pos;3192ch = this.input.charCodeAt(this.pos);3193}3194if (this.options.onComment) this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, startLoc, this.options.locations && this.curPosition());3195};31963197// Called at the start of the parse and after every token. Skips3198// whitespace and comments, and.31993200pp.skipSpace = function () {3201while (this.pos < this.input.length) {3202var ch = this.input.charCodeAt(this.pos);3203if (ch === 32) {3204// ' '3205++this.pos;3206} else if (ch === 13) {3207++this.pos;3208var next = this.input.charCodeAt(this.pos);3209if (next === 10) {3210++this.pos;3211}3212if (this.options.locations) {3213++this.curLine;3214this.lineStart = this.pos;3215}3216} else if (ch === 10 || ch === 8232 || ch === 8233) {3217++this.pos;3218if (this.options.locations) {3219++this.curLine;3220this.lineStart = this.pos;3221}3222} else if (ch > 8 && ch < 14) {3223++this.pos;3224} else if (ch === 47) {3225// '/'3226var next = this.input.charCodeAt(this.pos + 1);3227if (next === 42) {3228// '*'3229this.skipBlockComment();3230} else if (next === 47) {3231// '/'3232this.skipLineComment(2);3233} else break;3234} else if (ch === 160) {3235// '\xa0'3236++this.pos;3237} else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {3238++this.pos;3239} else {3240break;3241}3242}3243};32443245// Called at the end of every token. Sets `end`, `val`, and3246// maintains `context` and `exprAllowed`, and skips the space after3247// the token, so that the next one's `start` will point at the3248// right position.32493250pp.finishToken = function (type, val) {3251this.end = this.pos;3252if (this.options.locations) this.endLoc = this.curPosition();3253var prevType = this.type;3254this.type = type;3255this.value = val;32563257this.updateContext(prevType);3258};32593260// ### Token reading32613262// This is the function that is called to fetch the next token. It3263// is somewhat obscure, because it works in character codes rather3264// than characters, and because operator parsing has been inlined3265// into it.3266//3267// All in the name of speed.3268//3269pp.readToken_dot = function () {3270var next = this.input.charCodeAt(this.pos + 1);3271if (next >= 48 && next <= 57) return this.readNumber(true);3272var next2 = this.input.charCodeAt(this.pos + 2);3273if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {3274// 46 = dot '.'3275this.pos += 3;3276return this.finishToken(tt.ellipsis);3277} else {3278++this.pos;3279return this.finishToken(tt.dot);3280}3281};32823283pp.readToken_slash = function () {3284// '/'3285var next = this.input.charCodeAt(this.pos + 1);3286if (this.exprAllowed) {3287++this.pos;return this.readRegexp();3288}3289if (next === 61) return this.finishOp(tt.assign, 2);3290return this.finishOp(tt.slash, 1);3291};32923293pp.readToken_mult_modulo = function (code) {3294// '%*'3295var next = this.input.charCodeAt(this.pos + 1);3296if (next === 61) return this.finishOp(tt.assign, 2);3297return this.finishOp(code === 42 ? tt.star : tt.modulo, 1);3298};32993300pp.readToken_pipe_amp = function (code) {3301// '|&'3302var next = this.input.charCodeAt(this.pos + 1);3303if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2);3304if (next === 61) return this.finishOp(tt.assign, 2);3305return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1);3306};33073308pp.readToken_caret = function () {3309// '^'3310var next = this.input.charCodeAt(this.pos + 1);3311if (next === 61) return this.finishOp(tt.assign, 2);3312return this.finishOp(tt.bitwiseXOR, 1);3313};33143315pp.readToken_plus_min = function (code) {3316// '+-'3317var next = this.input.charCodeAt(this.pos + 1);3318if (next === code) {3319if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {3320// A `-->` line comment3321this.skipLineComment(3);3322this.skipSpace();3323return this.nextToken();3324}3325return this.finishOp(tt.incDec, 2);3326}3327if (next === 61) return this.finishOp(tt.assign, 2);3328return this.finishOp(tt.plusMin, 1);3329};33303331pp.readToken_lt_gt = function (code) {3332// '<>'3333var next = this.input.charCodeAt(this.pos + 1);3334var size = 1;3335if (next === code) {3336size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;3337if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1);3338return this.finishOp(tt.bitShift, size);3339}3340if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) {3341if (this.inModule) this.unexpected();3342// `<!--`, an XML-style comment that should be interpreted as a line comment3343this.skipLineComment(4);3344this.skipSpace();3345return this.nextToken();3346}3347if (next === 61) size = this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2;3348return this.finishOp(tt.relational, size);3349};33503351pp.readToken_eq_excl = function (code) {3352// '=!'3353var next = this.input.charCodeAt(this.pos + 1);3354if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);3355if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) {3356// '=>'3357this.pos += 2;3358return this.finishToken(tt.arrow);3359}3360return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1);3361};33623363pp.getTokenFromCode = function (code) {3364switch (code) {3365// The interpretation of a dot depends on whether it is followed3366// by a digit or another two dots.3367case 46:3368// '.'3369return this.readToken_dot();33703371// Punctuation tokens.3372case 40:3373++this.pos;return this.finishToken(tt.parenL);3374case 41:3375++this.pos;return this.finishToken(tt.parenR);3376case 59:3377++this.pos;return this.finishToken(tt.semi);3378case 44:3379++this.pos;return this.finishToken(tt.comma);3380case 91:3381++this.pos;return this.finishToken(tt.bracketL);3382case 93:3383++this.pos;return this.finishToken(tt.bracketR);3384case 123:3385++this.pos;return this.finishToken(tt.braceL);3386case 125:3387++this.pos;return this.finishToken(tt.braceR);3388case 58:3389++this.pos;return this.finishToken(tt.colon);3390case 63:3391++this.pos;return this.finishToken(tt.question);33923393case 96:3394// '`'3395if (this.options.ecmaVersion < 6) break;3396++this.pos;3397return this.finishToken(tt.backQuote);33983399case 48:3400// '0'3401var next = this.input.charCodeAt(this.pos + 1);3402if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number3403if (this.options.ecmaVersion >= 6) {3404if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number3405if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number3406}3407// Anything else beginning with a digit is an integer, octal3408// number, or float.3409case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:3410// 1-93411return this.readNumber(false);34123413// Quotes produce strings.3414case 34:case 39:3415// '"', "'"3416return this.readString(code);34173418// Operators are parsed inline in tiny state machines. '=' (61) is3419// often referred to. `finishOp` simply skips the amount of3420// characters it is given as second argument, and returns a token3421// of the type given by its first argument.34223423case 47:3424// '/'3425return this.readToken_slash();34263427case 37:case 42:3428// '%*'3429return this.readToken_mult_modulo(code);34303431case 124:case 38:3432// '|&'3433return this.readToken_pipe_amp(code);34343435case 94:3436// '^'3437return this.readToken_caret();34383439case 43:case 45:3440// '+-'3441return this.readToken_plus_min(code);34423443case 60:case 62:3444// '<>'3445return this.readToken_lt_gt(code);34463447case 61:case 33:3448// '=!'3449return this.readToken_eq_excl(code);34503451case 126:3452// '~'3453return this.finishOp(tt.prefix, 1);3454}34553456this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");3457};34583459pp.finishOp = function (type, size) {3460var str = this.input.slice(this.pos, this.pos + size);3461this.pos += size;3462return this.finishToken(type, str);3463};34643465var regexpUnicodeSupport = false;3466try {3467new RegExp("", "u");regexpUnicodeSupport = true;3468} catch (e) {}34693470// Parse a regular expression. Some context-awareness is necessary,3471// since a '/' inside a '[]' set does not end the expression.34723473pp.readRegexp = function () {3474var escaped = undefined,3475inClass = undefined,3476start = this.pos;3477for (;;) {3478if (this.pos >= this.input.length) this.raise(start, "Unterminated regular expression");3479var ch = this.input.charAt(this.pos);3480if (lineBreak.test(ch)) this.raise(start, "Unterminated regular expression");3481if (!escaped) {3482if (ch === "[") inClass = true;else if (ch === "]" && inClass) inClass = false;else if (ch === "/" && !inClass) break;3483escaped = ch === "\\";3484} else escaped = false;3485++this.pos;3486}3487var content = this.input.slice(start, this.pos);3488++this.pos;3489// Need to use `readWord1` because '\uXXXX' sequences are allowed3490// here (don't ask).3491var mods = this.readWord1();3492var tmp = content;3493if (mods) {3494var validFlags = /^[gmsiy]*$/;3495if (this.options.ecmaVersion >= 6) validFlags = /^[gmsiyu]*$/;3496if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag");3497if (mods.indexOf("u") >= 0 && !regexpUnicodeSupport) {3498// Replace each astral symbol and every Unicode escape sequence that3499// possibly represents an astral symbol or a paired surrogate with a3500// single ASCII symbol to avoid throwing on regular expressions that3501// are only valid in combination with the `/u` flag.3502// Note: replacing with the ASCII symbol `x` might cause false3503// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a3504// perfectly valid pattern that is equivalent to `[a-b]`, but it would3505// be replaced by `[x-b]` which throws an error.3506tmp = tmp.replace(/\\u([a-fA-F0-9]{4})|\\u\{([0-9a-fA-F]+)\}|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x");3507}3508}3509// Detect invalid regular expressions.3510var value = null;3511// Rhino's regular expression parser is flaky and throws uncatchable exceptions,3512// so don't do detection if we are running under Rhino3513if (!isRhino) {3514try {3515new RegExp(tmp);3516} catch (e) {3517if (e instanceof SyntaxError) this.raise(start, "Error parsing regular expression: " + e.message);3518this.raise(e);3519}3520// Get a regular expression object for this pattern-flag pair, or `null` in3521// case the current environment doesn't support the flags it uses.3522try {3523value = new RegExp(content, mods);3524} catch (err) {}3525}3526return this.finishToken(tt.regexp, { pattern: content, flags: mods, value: value });3527};35283529// Read an integer in the given radix. Return null if zero digits3530// were read, the integer value otherwise. When `len` is given, this3531// will return `null` unless the integer has exactly `len` digits.35323533pp.readInt = function (radix, len) {3534var start = this.pos,3535total = 0;3536for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {3537var code = this.input.charCodeAt(this.pos),3538val = undefined;3539if (code >= 97) val = code - 97 + 10; // a3540else if (code >= 65) val = code - 65 + 10; // A3541else if (code >= 48 && code <= 57) val = code - 48; // 0-93542else val = Infinity;3543if (val >= radix) break;3544++this.pos;3545total = total * radix + val;3546}3547if (this.pos === start || len != null && this.pos - start !== len) return null;35483549return total;3550};35513552pp.readRadixNumber = function (radix) {3553this.pos += 2; // 0x3554var val = this.readInt(radix);3555if (val == null) this.raise(this.start + 2, "Expected number in radix " + radix);3556if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");3557return this.finishToken(tt.num, val);3558};35593560// Read an integer, octal integer, or floating-point number.35613562pp.readNumber = function (startsWithDot) {3563var start = this.pos,3564isFloat = false,3565octal = this.input.charCodeAt(this.pos) === 48;3566if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");3567if (this.input.charCodeAt(this.pos) === 46) {3568++this.pos;3569this.readInt(10);3570isFloat = true;3571}3572var next = this.input.charCodeAt(this.pos);3573if (next === 69 || next === 101) {3574// 'eE'3575next = this.input.charCodeAt(++this.pos);3576if (next === 43 || next === 45) ++this.pos; // '+-'3577if (this.readInt(10) === null) this.raise(start, "Invalid number");3578isFloat = true;3579}3580if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");35813582var str = this.input.slice(start, this.pos),3583val = undefined;3584if (isFloat) val = parseFloat(str);else if (!octal || str.length === 1) val = parseInt(str, 10);else if (/[89]/.test(str) || this.strict) this.raise(start, "Invalid number");else val = parseInt(str, 8);3585return this.finishToken(tt.num, val);3586};35873588// Read a string value, interpreting backslash-escapes.35893590pp.readCodePoint = function () {3591var ch = this.input.charCodeAt(this.pos),3592code = undefined;35933594if (ch === 123) {3595if (this.options.ecmaVersion < 6) this.unexpected();3596++this.pos;3597code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);3598++this.pos;3599if (code > 1114111) this.unexpected();3600} else {3601code = this.readHexChar(4);3602}3603return code;3604};36053606function codePointToString(code) {3607// UTF-16 Decoding3608if (code <= 65535) {3609return String.fromCharCode(code);3610}return String.fromCharCode((code - 65536 >> 10) + 55296, (code - 65536 & 1023) + 56320);3611}36123613pp.readString = function (quote) {3614var out = "",3615chunkStart = ++this.pos;3616for (;;) {3617if (this.pos >= this.input.length) this.raise(this.start, "Unterminated string constant");3618var ch = this.input.charCodeAt(this.pos);3619if (ch === quote) break;3620if (ch === 92) {3621// '\'3622out += this.input.slice(chunkStart, this.pos);3623out += this.readEscapedChar();3624chunkStart = this.pos;3625} else {3626if (isNewLine(ch)) this.raise(this.start, "Unterminated string constant");3627++this.pos;3628}3629}3630out += this.input.slice(chunkStart, this.pos++);3631return this.finishToken(tt.string, out);3632};36333634// Reads template string tokens.36353636pp.readTmplToken = function () {3637var out = "",3638chunkStart = this.pos;3639for (;;) {3640if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template");3641var ch = this.input.charCodeAt(this.pos);3642if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {3643// '`', '${'3644if (this.pos === this.start && this.type === tt.template) {3645if (ch === 36) {3646this.pos += 2;3647return this.finishToken(tt.dollarBraceL);3648} else {3649++this.pos;3650return this.finishToken(tt.backQuote);3651}3652}3653out += this.input.slice(chunkStart, this.pos);3654return this.finishToken(tt.template, out);3655}3656if (ch === 92) {3657// '\'3658out += this.input.slice(chunkStart, this.pos);3659out += this.readEscapedChar();3660chunkStart = this.pos;3661} else if (isNewLine(ch)) {3662out += this.input.slice(chunkStart, this.pos);3663++this.pos;3664if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {3665++this.pos;3666out += "\n";3667} else {3668out += String.fromCharCode(ch);3669}3670if (this.options.locations) {3671++this.curLine;3672this.lineStart = this.pos;3673}3674chunkStart = this.pos;3675} else {3676++this.pos;3677}3678}3679};36803681// Used to read escaped characters36823683pp.readEscapedChar = function () {3684var ch = this.input.charCodeAt(++this.pos);3685var octal = /^[0-7]+/.exec(this.input.slice(this.pos, this.pos + 3));3686if (octal) octal = octal[0];3687while (octal && parseInt(octal, 8) > 255) octal = octal.slice(0, -1);3688if (octal === "0") octal = null;3689++this.pos;3690if (octal) {3691if (this.strict) this.raise(this.pos - 2, "Octal literal in strict mode");3692this.pos += octal.length - 1;3693return String.fromCharCode(parseInt(octal, 8));3694} else {3695switch (ch) {3696case 110:3697return "\n"; // 'n' -> '\n'3698case 114:3699return "\r"; // 'r' -> '\r'3700case 120:3701return String.fromCharCode(this.readHexChar(2)); // 'x'3702case 117:3703return codePointToString(this.readCodePoint()); // 'u'3704case 116:3705return "\t"; // 't' -> '\t'3706case 98:3707return "\b"; // 'b' -> '\b'3708case 118:3709return "\u000b"; // 'v' -> '\u000b'3710case 102:3711return "\f"; // 'f' -> '\f'3712case 48:3713return "\u0000"; // 0 -> '\0'3714case 13:3715if (this.input.charCodeAt(this.pos) === 10) ++this.pos; // '\r\n'3716case 10:3717// ' \n'3718if (this.options.locations) {3719this.lineStart = this.pos;++this.curLine;3720}3721return "";3722default:3723return String.fromCharCode(ch);3724}3725}3726};37273728// Used to read character escape sequences ('\x', '\u', '\U').37293730pp.readHexChar = function (len) {3731var n = this.readInt(16, len);3732if (n === null) this.raise(this.start, "Bad character escape sequence");3733return n;3734};37353736// Used to signal to callers of `readWord1` whether the word3737// contained any escape sequences. This is needed because words with3738// escape sequences must not be interpreted as keywords.37393740var containsEsc;37413742// Read an identifier, and return it as a string. Sets `containsEsc`3743// to whether the word contained a '\u' escape.3744//3745// Incrementally adds only escaped chars, adding other chunks as-is3746// as a micro-optimization.37473748pp.readWord1 = function () {3749containsEsc = false;3750var word = "",3751first = true,3752chunkStart = this.pos;3753var astral = this.options.ecmaVersion >= 6;3754while (this.pos < this.input.length) {3755var ch = this.fullCharCodeAtPos();3756if (isIdentifierChar(ch, astral)) {3757this.pos += ch <= 65535 ? 1 : 2;3758} else if (ch === 92) {3759// "\"3760containsEsc = true;3761word += this.input.slice(chunkStart, this.pos);3762var escStart = this.pos;3763if (this.input.charCodeAt(++this.pos) != 117) // "u"3764this.raise(this.pos, "Expecting Unicode escape sequence \\uXXXX");3765++this.pos;3766var esc = this.readCodePoint();3767if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) this.raise(escStart, "Invalid Unicode escape");3768word += codePointToString(esc);3769chunkStart = this.pos;3770} else {3771break;3772}3773first = false;3774}3775return word + this.input.slice(chunkStart, this.pos);3776};37773778// Read an identifier or keyword token. Will check for reserved3779// words when necessary.37803781pp.readWord = function () {3782var word = this.readWord1();3783var type = tt.name;3784if ((this.options.ecmaVersion >= 6 || !containsEsc) && this.isKeyword(word)) type = keywordTypes[word];3785return this.finishToken(type, word);3786};37873788},{"./identifier":7,"./location":8,"./state":13,"./tokentype":17,"./whitespace":19}],17:[function(_dereq_,module,exports){3789"use strict";37903791var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };37923793exports.__esModule = true;3794// ## Token types37953796// The assignment of fine-grained, information-carrying type objects3797// allows the tokenizer to store the information it has about a3798// token in a way that is very cheap for the parser to look up.37993800// All token type variables start with an underscore, to make them3801// easy to recognize.38023803// The `beforeExpr` property is used to disambiguate between regular3804// expressions and divisions. It is set on all token types that can3805// be followed by an expression (thus, a slash after them would be a3806// regular expression).3807//3808// `isLoop` marks a keyword as starting a loop, which is important3809// to know when parsing a label, in order to allow or disallow3810// continue jumps to that label.38113812var TokenType = exports.TokenType = function TokenType(label) {3813var conf = arguments[1] === undefined ? {} : arguments[1];38143815_classCallCheck(this, TokenType);38163817this.label = label;3818this.keyword = conf.keyword;3819this.beforeExpr = !!conf.beforeExpr;3820this.startsExpr = !!conf.startsExpr;3821this.isLoop = !!conf.isLoop;3822this.isAssign = !!conf.isAssign;3823this.prefix = !!conf.prefix;3824this.postfix = !!conf.postfix;3825this.binop = conf.binop || null;3826this.updateContext = null;3827};38283829function binop(name, prec) {3830return new TokenType(name, { beforeExpr: true, binop: prec });3831}3832var beforeExpr = { beforeExpr: true },3833startsExpr = { startsExpr: true };38343835var types = {3836num: new TokenType("num", startsExpr),3837regexp: new TokenType("regexp", startsExpr),3838string: new TokenType("string", startsExpr),3839name: new TokenType("name", startsExpr),3840eof: new TokenType("eof"),38413842// Punctuation token types.3843bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),3844bracketR: new TokenType("]"),3845braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),3846braceR: new TokenType("}"),3847parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),3848parenR: new TokenType(")"),3849comma: new TokenType(",", beforeExpr),3850semi: new TokenType(";", beforeExpr),3851colon: new TokenType(":", beforeExpr),3852dot: new TokenType("."),3853question: new TokenType("?", beforeExpr),3854arrow: new TokenType("=>", beforeExpr),3855template: new TokenType("template"),3856ellipsis: new TokenType("...", beforeExpr),3857backQuote: new TokenType("`", startsExpr),3858dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),38593860// Operators. These carry several kinds of properties to help the3861// parser use them properly (the presence of these properties is3862// what categorizes them as operators).3863//3864// `binop`, when present, specifies that this operator is a binary3865// operator, and will refer to its precedence.3866//3867// `prefix` and `postfix` mark the operator as a prefix or postfix3868// unary operator.3869//3870// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as3871// binary operators with a very low precedence, that should result3872// in AssignmentExpression nodes.38733874eq: new TokenType("=", { beforeExpr: true, isAssign: true }),3875assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),3876incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),3877prefix: new TokenType("prefix", { beforeExpr: true, prefix: true, startsExpr: true }),3878logicalOR: binop("||", 1),3879logicalAND: binop("&&", 2),3880bitwiseOR: binop("|", 3),3881bitwiseXOR: binop("^", 4),3882bitwiseAND: binop("&", 5),3883equality: binop("==/!=", 6),3884relational: binop("</>", 7),3885bitShift: binop("<</>>", 8),3886plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),3887modulo: binop("%", 10),3888star: binop("*", 10),3889slash: binop("/", 10)3890};38913892exports.types = types;3893// Map keyword names to token types.38943895var keywords = {};38963897exports.keywords = keywords;3898// Succinct definitions of keyword token types3899function kw(name) {3900var options = arguments[1] === undefined ? {} : arguments[1];39013902options.keyword = name;3903keywords[name] = types["_" + name] = new TokenType(name, options);3904}39053906kw("break");3907kw("case", beforeExpr);3908kw("catch");3909kw("continue");3910kw("debugger");3911kw("default");3912kw("do", { isLoop: true });3913kw("else", beforeExpr);3914kw("finally");3915kw("for", { isLoop: true });3916kw("function", startsExpr);3917kw("if");3918kw("return", beforeExpr);3919kw("switch");3920kw("throw", beforeExpr);3921kw("try");3922kw("var");3923kw("let");3924kw("const");3925kw("while", { isLoop: true });3926kw("with");3927kw("new", { beforeExpr: true, startsExpr: true });3928kw("this", startsExpr);3929kw("super", startsExpr);3930kw("class");3931kw("extends", beforeExpr);3932kw("export");3933kw("import");3934kw("yield", { beforeExpr: true, startsExpr: true });3935kw("null", startsExpr);3936kw("true", startsExpr);3937kw("false", startsExpr);3938kw("in", { beforeExpr: true, binop: 7 });3939kw("instanceof", { beforeExpr: true, binop: 7 });3940kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true });3941kw("void", { beforeExpr: true, prefix: true, startsExpr: true });3942kw("delete", { beforeExpr: true, prefix: true, startsExpr: true });39433944},{}],18:[function(_dereq_,module,exports){3945"use strict";39463947exports.isArray = isArray;39483949// Checks if an object has a property.39503951exports.has = has;3952exports.__esModule = true;39533954function isArray(obj) {3955return Object.prototype.toString.call(obj) === "[object Array]";3956}39573958function has(obj, propName) {3959return Object.prototype.hasOwnProperty.call(obj, propName);3960}39613962},{}],19:[function(_dereq_,module,exports){3963"use strict";39643965exports.isNewLine = isNewLine;3966exports.__esModule = true;3967// Matches a whole line break (where CRLF is considered a single3968// line break). Used to count lines.39693970var lineBreak = /\r\n?|\n|\u2028|\u2029/;3971exports.lineBreak = lineBreak;3972var lineBreakG = new RegExp(lineBreak.source, "g");39733974exports.lineBreakG = lineBreakG;39753976function isNewLine(code) {3977return code === 10 || code === 13 || code === 8232 || code == 8233;3978}39793980var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;3981exports.nonASCIIwhitespace = nonASCIIwhitespace;39823983},{}]},{},[1])(1)3984});39853986