You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@griffin.apache.org by gu...@apache.org on 2017/03/20 17:51:05 UTC
[43/52] [partial] incubator-griffin-site git commit: init website by
hexo
http://git-wip-us.apache.org/repos/asf/incubator-griffin-site/blob/4f8fa326/node_modules/acorn/dist/acorn_loose.js
----------------------------------------------------------------------
diff --git a/node_modules/acorn/dist/acorn_loose.js b/node_modules/acorn/dist/acorn_loose.js
new file mode 100644
index 0000000..d18e6aa
--- /dev/null
+++ b/node_modules/acorn/dist/acorn_loose.js
@@ -0,0 +1,1300 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).loose = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
+"use strict";
+
+module.exports = typeof acorn != 'undefined' ? acorn : require("./acorn");
+
+},{}],2:[function(_dereq_,module,exports){
+"use strict";
+
+var _state = _dereq_("./state");
+
+var _parseutil = _dereq_("./parseutil");
+
+var _ = _dereq_("..");
+
+var lp = _state.LooseParser.prototype;
+
+lp.checkLVal = function (expr) {
+ if (!expr) return expr;
+ switch (expr.type) {
+ case "Identifier":
+ case "MemberExpression":
+ return expr;
+
+ case "ParenthesizedExpression":
+ expr.expression = this.checkLVal(expr.expression);
+ return expr;
+
+ default:
+ return this.dummyIdent();
+ }
+};
+
+lp.parseExpression = function (noIn) {
+ var start = this.storeCurrentPos();
+ var expr = this.parseMaybeAssign(noIn);
+ if (this.tok.type === _.tokTypes.comma) {
+ var node = this.startNodeAt(start);
+ node.expressions = [expr];
+ while (this.eat(_.tokTypes.comma)) node.expressions.push(this.parseMaybeAssign(noIn));
+ return this.finishNode(node, "SequenceExpression");
+ }
+ return expr;
+};
+
+lp.parseParenExpression = function () {
+ this.pushCx();
+ this.expect(_.tokTypes.parenL);
+ var val = this.parseExpression();
+ this.popCx();
+ this.expect(_.tokTypes.parenR);
+ return val;
+};
+
+lp.parseMaybeAssign = function (noIn) {
+ var start = this.storeCurrentPos();
+ var left = this.parseMaybeConditional(noIn);
+ if (this.tok.type.isAssign) {
+ var node = this.startNodeAt(start);
+ node.operator = this.tok.value;
+ node.left = this.tok.type === _.tokTypes.eq ? this.toAssignable(left) : this.checkLVal(left);
+ this.next();
+ node.right = this.parseMaybeAssign(noIn);
+ return this.finishNode(node, "AssignmentExpression");
+ }
+ return left;
+};
+
+lp.parseMaybeConditional = function (noIn) {
+ var start = this.storeCurrentPos();
+ var expr = this.parseExprOps(noIn);
+ if (this.eat(_.tokTypes.question)) {
+ var node = this.startNodeAt(start);
+ node.test = expr;
+ node.consequent = this.parseMaybeAssign();
+ node.alternate = this.expect(_.tokTypes.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent();
+ return this.finishNode(node, "ConditionalExpression");
+ }
+ return expr;
+};
+
+lp.parseExprOps = function (noIn) {
+ var start = this.storeCurrentPos();
+ var indent = this.curIndent,
+ line = this.curLineStart;
+ return this.parseExprOp(this.parseMaybeUnary(noIn), start, -1, noIn, indent, line);
+};
+
+lp.parseExprOp = function (left, start, minPrec, noIn, indent, line) {
+ if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) return left;
+ var prec = this.tok.type.binop;
+ if (prec != null && (!noIn || this.tok.type !== _.tokTypes._in)) {
+ if (prec > minPrec) {
+ var node = this.startNodeAt(start);
+ node.left = left;
+ node.operator = this.tok.value;
+ this.next();
+ if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) {
+ node.right = this.dummyIdent();
+ } else {
+ var rightStart = this.storeCurrentPos();
+ node.right = this.parseExprOp(this.parseMaybeUnary(noIn), rightStart, prec, noIn, indent, line);
+ }
+ this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression");
+ return this.parseExprOp(node, start, minPrec, noIn, indent, line);
+ }
+ }
+ return left;
+};
+
+lp.parseMaybeUnary = function (noIn) {
+ if (this.tok.type.prefix) {
+ var node = this.startNode(),
+ update = this.tok.type === _.tokTypes.incDec;
+ node.operator = this.tok.value;
+ node.prefix = true;
+ this.next();
+ node.argument = this.parseMaybeUnary(noIn);
+ if (update) node.argument = this.checkLVal(node.argument);
+ return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
+ } else if (this.tok.type === _.tokTypes.ellipsis) {
+ var node = this.startNode();
+ this.next();
+ node.argument = this.parseMaybeUnary(noIn);
+ return this.finishNode(node, "SpreadElement");
+ }
+ var start = this.storeCurrentPos();
+ var expr = this.parseExprSubscripts();
+ while (this.tok.type.postfix && !this.canInsertSemicolon()) {
+ var node = this.startNodeAt(start);
+ node.operator = this.tok.value;
+ node.prefix = false;
+ node.argument = this.checkLVal(expr);
+ this.next();
+ expr = this.finishNode(node, "UpdateExpression");
+ }
+ return expr;
+};
+
+lp.parseExprSubscripts = function () {
+ var start = this.storeCurrentPos();
+ return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart);
+};
+
+lp.parseSubscripts = function (base, start, noCalls, startIndent, line) {
+ for (;;) {
+ if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) {
+ if (this.tok.type == _.tokTypes.dot && this.curIndent == startIndent) --startIndent;else return base;
+ }
+
+ if (this.eat(_.tokTypes.dot)) {
+ var node = this.startNodeAt(start);
+ node.object = base;
+ if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) node.property = this.dummyIdent();else node.property = this.parsePropertyAccessor() || this.dummyIdent();
+ node.computed = false;
+ base = this.finishNode(node, "MemberExpression");
+ } else if (this.tok.type == _.tokTypes.bracketL) {
+ this.pushCx();
+ this.next();
+ var node = this.startNodeAt(start);
+ node.object = base;
+ node.property = this.parseExpression();
+ node.computed = true;
+ this.popCx();
+ this.expect(_.tokTypes.bracketR);
+ base = this.finishNode(node, "MemberExpression");
+ } else if (!noCalls && this.tok.type == _.tokTypes.parenL) {
+ var node = this.startNodeAt(start);
+ node.callee = base;
+ node.arguments = this.parseExprList(_.tokTypes.parenR);
+ base = this.finishNode(node, "CallExpression");
+ } else if (this.tok.type == _.tokTypes.backQuote) {
+ var node = this.startNodeAt(start);
+ node.tag = base;
+ node.quasi = this.parseTemplate();
+ base = this.finishNode(node, "TaggedTemplateExpression");
+ } else {
+ return base;
+ }
+ }
+};
+
+lp.parseExprAtom = function () {
+ var node = undefined;
+ switch (this.tok.type) {
+ case _.tokTypes._this:
+ case _.tokTypes._super:
+ var type = this.tok.type === _.tokTypes._this ? "ThisExpression" : "Super";
+ node = this.startNode();
+ this.next();
+ return this.finishNode(node, type);
+
+ case _.tokTypes.name:
+ var start = this.storeCurrentPos();
+ var id = this.parseIdent();
+ return this.eat(_.tokTypes.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id]) : id;
+
+ case _.tokTypes.regexp:
+ node = this.startNode();
+ var val = this.tok.value;
+ node.regex = { pattern: val.pattern, flags: val.flags };
+ node.value = val.value;
+ node.raw = this.input.slice(this.tok.start, this.tok.end);
+ this.next();
+ return this.finishNode(node, "Literal");
+
+ case _.tokTypes.num:case _.tokTypes.string:
+ node = this.startNode();
+ node.value = this.tok.value;
+ node.raw = this.input.slice(this.tok.start, this.tok.end);
+ this.next();
+ return this.finishNode(node, "Literal");
+
+ case _.tokTypes._null:case _.tokTypes._true:case _.tokTypes._false:
+ node = this.startNode();
+ node.value = this.tok.type === _.tokTypes._null ? null : this.tok.type === _.tokTypes._true;
+ node.raw = this.tok.type.keyword;
+ this.next();
+ return this.finishNode(node, "Literal");
+
+ case _.tokTypes.parenL:
+ var parenStart = this.storeCurrentPos();
+ this.next();
+ var inner = this.parseExpression();
+ this.expect(_.tokTypes.parenR);
+ if (this.eat(_.tokTypes.arrow)) {
+ return this.parseArrowExpression(this.startNodeAt(parenStart), inner.expressions || (_parseutil.isDummy(inner) ? [] : [inner]));
+ }
+ if (this.options.preserveParens) {
+ var par = this.startNodeAt(parenStart);
+ par.expression = inner;
+ inner = this.finishNode(par, "ParenthesizedExpression");
+ }
+ return inner;
+
+ case _.tokTypes.bracketL:
+ node = this.startNode();
+ node.elements = this.parseExprList(_.tokTypes.bracketR, true);
+ return this.finishNode(node, "ArrayExpression");
+
+ case _.tokTypes.braceL:
+ return this.parseObj();
+
+ case _.tokTypes._class:
+ return this.parseClass();
+
+ case _.tokTypes._function:
+ node = this.startNode();
+ this.next();
+ return this.parseFunction(node, false);
+
+ case _.tokTypes._new:
+ return this.parseNew();
+
+ case _.tokTypes._yield:
+ node = this.startNode();
+ this.next();
+ if (this.semicolon() || this.canInsertSemicolon() || this.tok.type != _.tokTypes.star && !this.tok.type.startsExpr) {
+ node.delegate = false;
+ node.argument = null;
+ } else {
+ node.delegate = this.eat(_.tokTypes.star);
+ node.argument = this.parseMaybeAssign();
+ }
+ return this.finishNode(node, "YieldExpression");
+
+ case _.tokTypes.backQuote:
+ return this.parseTemplate();
+
+ default:
+ return this.dummyIdent();
+ }
+};
+
+lp.parseNew = function () {
+ var node = this.startNode(),
+ startIndent = this.curIndent,
+ line = this.curLineStart;
+ var meta = this.parseIdent(true);
+ if (this.options.ecmaVersion >= 6 && this.eat(_.tokTypes.dot)) {
+ node.meta = meta;
+ node.property = this.parseIdent(true);
+ return this.finishNode(node, "MetaProperty");
+ }
+ var start = this.storeCurrentPos();
+ node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
+ if (this.tok.type == _.tokTypes.parenL) {
+ node.arguments = this.parseExprList(_.tokTypes.parenR);
+ } else {
+ node.arguments = [];
+ }
+ return this.finishNode(node, "NewExpression");
+};
+
+lp.parseTemplateElement = function () {
+ var elem = this.startNode();
+ elem.value = {
+ raw: this.input.slice(this.tok.start, this.tok.end).replace(/\r\n?/g, '\n'),
+ cooked: this.tok.value
+ };
+ this.next();
+ elem.tail = this.tok.type === _.tokTypes.backQuote;
+ return this.finishNode(elem, "TemplateElement");
+};
+
+lp.parseTemplate = function () {
+ var node = this.startNode();
+ this.next();
+ node.expressions = [];
+ var curElt = this.parseTemplateElement();
+ node.quasis = [curElt];
+ while (!curElt.tail) {
+ this.next();
+ node.expressions.push(this.parseExpression());
+ if (this.expect(_.tokTypes.braceR)) {
+ curElt = this.parseTemplateElement();
+ } else {
+ curElt = this.startNode();
+ curElt.value = { cooked: '', raw: '' };
+ curElt.tail = true;
+ }
+ node.quasis.push(curElt);
+ }
+ this.expect(_.tokTypes.backQuote);
+ return this.finishNode(node, "TemplateLiteral");
+};
+
+lp.parseObj = function () {
+ var node = this.startNode();
+ node.properties = [];
+ this.pushCx();
+ var indent = this.curIndent + 1,
+ line = this.curLineStart;
+ this.eat(_.tokTypes.braceL);
+ if (this.curIndent + 1 < indent) {
+ indent = this.curIndent;line = this.curLineStart;
+ }
+ while (!this.closes(_.tokTypes.braceR, indent, line)) {
+ var prop = this.startNode(),
+ isGenerator = undefined,
+ start = undefined;
+ if (this.options.ecmaVersion >= 6) {
+ start = this.storeCurrentPos();
+ prop.method = false;
+ prop.shorthand = false;
+ isGenerator = this.eat(_.tokTypes.star);
+ }
+ this.parsePropertyName(prop);
+ if (_parseutil.isDummy(prop.key)) {
+ if (_parseutil.isDummy(this.parseMaybeAssign())) this.next();this.eat(_.tokTypes.comma);continue;
+ }
+ if (this.eat(_.tokTypes.colon)) {
+ prop.kind = "init";
+ prop.value = this.parseMaybeAssign();
+ } else if (this.options.ecmaVersion >= 6 && (this.tok.type === _.tokTypes.parenL || this.tok.type === _.tokTypes.braceL)) {
+ prop.kind = "init";
+ prop.method = true;
+ prop.value = this.parseMethod(isGenerator);
+ } else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" && !prop.computed && (prop.key.name === "get" || prop.key.name === "set") && (this.tok.type != _.tokTypes.comma && this.tok.type != _.tokTypes.braceR)) {
+ prop.kind = prop.key.name;
+ this.parsePropertyName(prop);
+ prop.value = this.parseMethod(false);
+ } else {
+ prop.kind = "init";
+ if (this.options.ecmaVersion >= 6) {
+ if (this.eat(_.tokTypes.eq)) {
+ var assign = this.startNodeAt(start);
+ assign.operator = "=";
+ assign.left = prop.key;
+ assign.right = this.parseMaybeAssign();
+ prop.value = this.finishNode(assign, "AssignmentExpression");
+ } else {
+ prop.value = prop.key;
+ }
+ } else {
+ prop.value = this.dummyIdent();
+ }
+ prop.shorthand = true;
+ }
+ node.properties.push(this.finishNode(prop, "Property"));
+ this.eat(_.tokTypes.comma);
+ }
+ this.popCx();
+ if (!this.eat(_.tokTypes.braceR)) {
+ // If there is no closing brace, make the node span to the start
+ // of the next token (this is useful for Tern)
+ this.last.end = this.tok.start;
+ if (this.options.locations) this.last.loc.end = this.tok.loc.start;
+ }
+ return this.finishNode(node, "ObjectExpression");
+};
+
+lp.parsePropertyName = function (prop) {
+ if (this.options.ecmaVersion >= 6) {
+ if (this.eat(_.tokTypes.bracketL)) {
+ prop.computed = true;
+ prop.key = this.parseExpression();
+ this.expect(_.tokTypes.bracketR);
+ return;
+ } else {
+ prop.computed = false;
+ }
+ }
+ var key = this.tok.type === _.tokTypes.num || this.tok.type === _.tokTypes.string ? this.parseExprAtom() : this.parseIdent();
+ prop.key = key || this.dummyIdent();
+};
+
+lp.parsePropertyAccessor = function () {
+ if (this.tok.type === _.tokTypes.name || this.tok.type.keyword) return this.parseIdent();
+};
+
+lp.parseIdent = function () {
+ var name = this.tok.type === _.tokTypes.name ? this.tok.value : this.tok.type.keyword;
+ if (!name) return this.dummyIdent();
+ var node = this.startNode();
+ this.next();
+ node.name = name;
+ return this.finishNode(node, "Identifier");
+};
+
+lp.initFunction = function (node) {
+ node.id = null;
+ node.params = [];
+ if (this.options.ecmaVersion >= 6) {
+ node.generator = false;
+ node.expression = false;
+ }
+};
+
+// Convert existing expression atom to assignable pattern
+// if possible.
+
+lp.toAssignable = function (node, binding) {
+ if (!node || node.type == "Identifier" || node.type == "MemberExpression" && !binding) {
+ // Okay
+ } else if (node.type == "ParenthesizedExpression") {
+ node.expression = this.toAssignable(node.expression, binding);
+ } else if (this.options.ecmaVersion < 6) {
+ return this.dummyIdent();
+ } else if (node.type == "ObjectExpression") {
+ node.type = "ObjectPattern";
+ var props = node.properties;
+ for (var i = 0; i < props.length; i++) {
+ props[i].value = this.toAssignable(props[i].value, binding);
+ }
+ } else if (node.type == "ArrayExpression") {
+ node.type = "ArrayPattern";
+ this.toAssignableList(node.elements, binding);
+ } else if (node.type == "SpreadElement") {
+ node.type = "RestElement";
+ node.argument = this.toAssignable(node.argument, binding);
+ } else if (node.type == "AssignmentExpression") {
+ node.type = "AssignmentPattern";
+ delete node.operator;
+ } else {
+ return this.dummyIdent();
+ }
+ return node;
+};
+
+lp.toAssignableList = function (exprList, binding) {
+ for (var i = 0; i < exprList.length; i++) {
+ exprList[i] = this.toAssignable(exprList[i], binding);
+ }return exprList;
+};
+
+lp.parseFunctionParams = function (params) {
+ params = this.parseExprList(_.tokTypes.parenR);
+ return this.toAssignableList(params, true);
+};
+
+lp.parseMethod = function (isGenerator) {
+ var node = this.startNode();
+ this.initFunction(node);
+ node.params = this.parseFunctionParams();
+ node.generator = isGenerator || false;
+ node.expression = this.options.ecmaVersion >= 6 && this.tok.type !== _.tokTypes.braceL;
+ node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
+ return this.finishNode(node, "FunctionExpression");
+};
+
+lp.parseArrowExpression = function (node, params) {
+ this.initFunction(node);
+ node.params = this.toAssignableList(params, true);
+ node.expression = this.tok.type !== _.tokTypes.braceL;
+ node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
+ return this.finishNode(node, "ArrowFunctionExpression");
+};
+
+lp.parseExprList = function (close, allowEmpty) {
+ this.pushCx();
+ var indent = this.curIndent,
+ line = this.curLineStart,
+ elts = [];
+ this.next(); // Opening bracket
+ while (!this.closes(close, indent + 1, line)) {
+ if (this.eat(_.tokTypes.comma)) {
+ elts.push(allowEmpty ? null : this.dummyIdent());
+ continue;
+ }
+ var elt = this.parseMaybeAssign();
+ if (_parseutil.isDummy(elt)) {
+ if (this.closes(close, indent, line)) break;
+ this.next();
+ } else {
+ elts.push(elt);
+ }
+ this.eat(_.tokTypes.comma);
+ }
+ this.popCx();
+ if (!this.eat(close)) {
+ // If there is no closing brace, make the node span to the start
+ // of the next token (this is useful for Tern)
+ this.last.end = this.tok.start;
+ if (this.options.locations) this.last.loc.end = this.tok.loc.start;
+ }
+ return elts;
+};
+
+},{"..":1,"./parseutil":4,"./state":5}],3:[function(_dereq_,module,exports){
+// Acorn: Loose parser
+//
+// This module provides an alternative parser (`parse_dammit`) that
+// exposes that same interface as `parse`, but will try to parse
+// anything as JavaScript, repairing syntax error the best it can.
+// There are circumstances in which it will raise an error and give
+// up, but they are very rare. The resulting AST will be a mostly
+// valid JavaScript AST (as per the [Mozilla parser API][api], except
+// that:
+//
+// - Return outside functions is allowed
+//
+// - Label consistency (no conflicts, break only to existing labels)
+// is not enforced.
+//
+// - Bogus Identifier nodes with a name of `"\u2716"` are inserted whenever
+// the parser got too confused to return anything meaningful.
+//
+// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
+//
+// The expected use for this is to *first* try `acorn.parse`, and only
+// if that fails switch to `parse_dammit`. The loose parser might
+// parse badly indented code incorrectly, so **don't** use it as
+// your default parser.
+//
+// Quite a lot of acorn.js is duplicated here. The alternative was to
+// add a *lot* of extra cruft to that file, making it less readable
+// and slower. Copying and editing the code allowed me to make
+// invasive changes and simplifications without creating a complicated
+// tangle.
+
+"use strict";
+
+exports.__esModule = true;
+exports.parse_dammit = parse_dammit;
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
+
+var _ = _dereq_("..");
+
+var acorn = _interopRequireWildcard(_);
+
+var _state = _dereq_("./state");
+
+_dereq_("./tokenize");
+
+_dereq_("./statement");
+
+_dereq_("./expression");
+
+exports.LooseParser = _state.LooseParser;
+exports.pluginsLoose = _state.pluginsLoose;
+
+acorn.defaultOptions.tabSize = 4;
+
+function parse_dammit(input, options) {
+ var p = new _state.LooseParser(input, options);
+ p.next();
+ return p.parseTopLevel();
+}
+
+acorn.parse_dammit = parse_dammit;
+acorn.LooseParser = _state.LooseParser;
+acorn.pluginsLoose = _state.pluginsLoose;
+
+},{"..":1,"./expression":2,"./state":5,"./statement":6,"./tokenize":7}],4:[function(_dereq_,module,exports){
+"use strict";
+
+exports.__esModule = true;
+exports.isDummy = isDummy;
+
+function isDummy(node) {
+ return node.name == "\u2716";
+}
+
+},{}],5:[function(_dereq_,module,exports){
+"use strict";
+
+exports.__esModule = true;
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var _ = _dereq_("..");
+
+// Registered plugins
+var pluginsLoose = {};
+
+exports.pluginsLoose = pluginsLoose;
+
+var LooseParser = (function () {
+ function LooseParser(input, options) {
+ _classCallCheck(this, LooseParser);
+
+ this.toks = _.tokenizer(input, options);
+ this.options = this.toks.options;
+ this.input = this.toks.input;
+ this.tok = this.last = { type: _.tokTypes.eof, start: 0, end: 0 };
+ if (this.options.locations) {
+ var here = this.toks.curPosition();
+ this.tok.loc = new _.SourceLocation(this.toks, here, here);
+ }
+ this.ahead = []; // Tokens ahead
+ this.context = []; // Indentation contexted
+ this.curIndent = 0;
+ this.curLineStart = 0;
+ this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
+ // Load plugins
+ this.options.pluginsLoose = options.pluginsLoose || {};
+ this.loadPlugins(this.options.pluginsLoose);
+ }
+
+ LooseParser.prototype.startNode = function startNode() {
+ return new _.Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null);
+ };
+
+ LooseParser.prototype.storeCurrentPos = function storeCurrentPos() {
+ return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start;
+ };
+
+ LooseParser.prototype.startNodeAt = function startNodeAt(pos) {
+ if (this.options.locations) {
+ return new _.Node(this.toks, pos[0], pos[1]);
+ } else {
+ return new _.Node(this.toks, pos);
+ }
+ };
+
+ LooseParser.prototype.finishNode = function finishNode(node, type) {
+ node.type = type;
+ node.end = this.last.end;
+ if (this.options.locations) node.loc.end = this.last.loc.end;
+ if (this.options.ranges) node.range[1] = this.last.end;
+ return node;
+ };
+
+ LooseParser.prototype.dummyNode = function dummyNode(type) {
+ var dummy = this.startNode();
+ dummy.type = type;
+ dummy.end = dummy.start;
+ if (this.options.locations) dummy.loc.end = dummy.loc.start;
+ if (this.options.ranges) dummy.range[1] = dummy.start;
+ this.last = { type: _.tokTypes.name, start: dummy.start, end: dummy.start, loc: dummy.loc };
+ return dummy;
+ };
+
+ LooseParser.prototype.dummyIdent = function dummyIdent() {
+ var dummy = this.dummyNode("Identifier");
+ dummy.name = "\u2716";
+ return dummy;
+ };
+
+ LooseParser.prototype.dummyString = function dummyString() {
+ var dummy = this.dummyNode("Literal");
+ dummy.value = dummy.raw = "\u2716";
+ return dummy;
+ };
+
+ LooseParser.prototype.eat = function eat(type) {
+ if (this.tok.type === type) {
+ this.next();
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ LooseParser.prototype.isContextual = function isContextual(name) {
+ return this.tok.type === _.tokTypes.name && this.tok.value === name;
+ };
+
+ LooseParser.prototype.eatContextual = function eatContextual(name) {
+ return this.tok.value === name && this.eat(_.tokTypes.name);
+ };
+
+ LooseParser.prototype.canInsertSemicolon = function canInsertSemicolon() {
+ return this.tok.type === _.tokTypes.eof || this.tok.type === _.tokTypes.braceR || _.lineBreak.test(this.input.slice(this.last.end, this.tok.start));
+ };
+
+ LooseParser.prototype.semicolon = function semicolon() {
+ return this.eat(_.tokTypes.semi);
+ };
+
+ LooseParser.prototype.expect = function expect(type) {
+ if (this.eat(type)) return true;
+ for (var i = 1; i <= 2; i++) {
+ if (this.lookAhead(i).type == type) {
+ for (var j = 0; j < i; j++) {
+ this.next();
+ }return true;
+ }
+ }
+ };
+
+ LooseParser.prototype.pushCx = function pushCx() {
+ this.context.push(this.curIndent);
+ };
+
+ LooseParser.prototype.popCx = function popCx() {
+ this.curIndent = this.context.pop();
+ };
+
+ LooseParser.prototype.lineEnd = function lineEnd(pos) {
+ while (pos < this.input.length && !_.isNewLine(this.input.charCodeAt(pos))) ++pos;
+ return pos;
+ };
+
+ LooseParser.prototype.indentationAfter = function indentationAfter(pos) {
+ for (var count = 0;; ++pos) {
+ var ch = this.input.charCodeAt(pos);
+ if (ch === 32) ++count;else if (ch === 9) count += this.options.tabSize;else return count;
+ }
+ };
+
+ LooseParser.prototype.closes = function closes(closeTok, indent, line, blockHeuristic) {
+ if (this.tok.type === closeTok || this.tok.type === _.tokTypes.eof) return true;
+ return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() && (!blockHeuristic || this.nextLineStart >= this.input.length || this.indentationAfter(this.nextLineStart) < indent);
+ };
+
+ LooseParser.prototype.tokenStartsLine = function tokenStartsLine() {
+ for (var p = this.tok.start - 1; p >= this.curLineStart; --p) {
+ var ch = this.input.charCodeAt(p);
+ if (ch !== 9 && ch !== 32) return false;
+ }
+ return true;
+ };
+
+ LooseParser.prototype.extend = function extend(name, f) {
+ this[name] = f(this[name]);
+ };
+
+ LooseParser.prototype.loadPlugins = function loadPlugins(pluginConfigs) {
+ for (var _name in pluginConfigs) {
+ var plugin = pluginsLoose[_name];
+ if (!plugin) throw new Error("Plugin '" + _name + "' not found");
+ plugin(this, pluginConfigs[_name]);
+ }
+ };
+
+ return LooseParser;
+})();
+
+exports.LooseParser = LooseParser;
+
+},{"..":1}],6:[function(_dereq_,module,exports){
+"use strict";
+
+var _state = _dereq_("./state");
+
+var _parseutil = _dereq_("./parseutil");
+
+var _ = _dereq_("..");
+
+var lp = _state.LooseParser.prototype;
+
+lp.parseTopLevel = function () {
+ var node = this.startNodeAt(this.options.locations ? [0, _.getLineInfo(this.input, 0)] : 0);
+ node.body = [];
+ while (this.tok.type !== _.tokTypes.eof) node.body.push(this.parseStatement());
+ this.last = this.tok;
+ if (this.options.ecmaVersion >= 6) {
+ node.sourceType = this.options.sourceType;
+ }
+ return this.finishNode(node, "Program");
+};
+
+lp.parseStatement = function () {
+ var starttype = this.tok.type,
+ node = this.startNode();
+
+ switch (starttype) {
+ case _.tokTypes._break:case _.tokTypes._continue:
+ this.next();
+ var isBreak = starttype === _.tokTypes._break;
+ if (this.semicolon() || this.canInsertSemicolon()) {
+ node.label = null;
+ } else {
+ node.label = this.tok.type === _.tokTypes.name ? this.parseIdent() : null;
+ this.semicolon();
+ }
+ return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
+
+ case _.tokTypes._debugger:
+ this.next();
+ this.semicolon();
+ return this.finishNode(node, "DebuggerStatement");
+
+ case _.tokTypes._do:
+ this.next();
+ node.body = this.parseStatement();
+ node.test = this.eat(_.tokTypes._while) ? this.parseParenExpression() : this.dummyIdent();
+ this.semicolon();
+ return this.finishNode(node, "DoWhileStatement");
+
+ case _.tokTypes._for:
+ this.next();
+ this.pushCx();
+ this.expect(_.tokTypes.parenL);
+ if (this.tok.type === _.tokTypes.semi) return this.parseFor(node, null);
+ if (this.tok.type === _.tokTypes._var || this.tok.type === _.tokTypes._let || this.tok.type === _.tokTypes._const) {
+ var _init = this.parseVar(true);
+ if (_init.declarations.length === 1 && (this.tok.type === _.tokTypes._in || this.isContextual("of"))) {
+ return this.parseForIn(node, _init);
+ }
+ return this.parseFor(node, _init);
+ }
+ var init = this.parseExpression(true);
+ if (this.tok.type === _.tokTypes._in || this.isContextual("of")) return this.parseForIn(node, this.toAssignable(init));
+ return this.parseFor(node, init);
+
+ case _.tokTypes._function:
+ this.next();
+ return this.parseFunction(node, true);
+
+ case _.tokTypes._if:
+ this.next();
+ node.test = this.parseParenExpression();
+ node.consequent = this.parseStatement();
+ node.alternate = this.eat(_.tokTypes._else) ? this.parseStatement() : null;
+ return this.finishNode(node, "IfStatement");
+
+ case _.tokTypes._return:
+ this.next();
+ if (this.eat(_.tokTypes.semi) || this.canInsertSemicolon()) node.argument = null;else {
+ node.argument = this.parseExpression();this.semicolon();
+ }
+ return this.finishNode(node, "ReturnStatement");
+
+ case _.tokTypes._switch:
+ var blockIndent = this.curIndent,
+ line = this.curLineStart;
+ this.next();
+ node.discriminant = this.parseParenExpression();
+ node.cases = [];
+ this.pushCx();
+ this.expect(_.tokTypes.braceL);
+
+ var cur = undefined;
+ while (!this.closes(_.tokTypes.braceR, blockIndent, line, true)) {
+ if (this.tok.type === _.tokTypes._case || this.tok.type === _.tokTypes._default) {
+ var isCase = this.tok.type === _.tokTypes._case;
+ if (cur) this.finishNode(cur, "SwitchCase");
+ node.cases.push(cur = this.startNode());
+ cur.consequent = [];
+ this.next();
+ if (isCase) cur.test = this.parseExpression();else cur.test = null;
+ this.expect(_.tokTypes.colon);
+ } else {
+ if (!cur) {
+ node.cases.push(cur = this.startNode());
+ cur.consequent = [];
+ cur.test = null;
+ }
+ cur.consequent.push(this.parseStatement());
+ }
+ }
+ if (cur) this.finishNode(cur, "SwitchCase");
+ this.popCx();
+ this.eat(_.tokTypes.braceR);
+ return this.finishNode(node, "SwitchStatement");
+
+ case _.tokTypes._throw:
+ this.next();
+ node.argument = this.parseExpression();
+ this.semicolon();
+ return this.finishNode(node, "ThrowStatement");
+
+ case _.tokTypes._try:
+ this.next();
+ node.block = this.parseBlock();
+ node.handler = null;
+ if (this.tok.type === _.tokTypes._catch) {
+ var clause = this.startNode();
+ this.next();
+ this.expect(_.tokTypes.parenL);
+ clause.param = this.toAssignable(this.parseExprAtom(), true);
+ this.expect(_.tokTypes.parenR);
+ clause.body = this.parseBlock();
+ node.handler = this.finishNode(clause, "CatchClause");
+ }
+ node.finalizer = this.eat(_.tokTypes._finally) ? this.parseBlock() : null;
+ if (!node.handler && !node.finalizer) return node.block;
+ return this.finishNode(node, "TryStatement");
+
+ case _.tokTypes._var:
+ case _.tokTypes._let:
+ case _.tokTypes._const:
+ return this.parseVar();
+
+ case _.tokTypes._while:
+ this.next();
+ node.test = this.parseParenExpression();
+ node.body = this.parseStatement();
+ return this.finishNode(node, "WhileStatement");
+
+ case _.tokTypes._with:
+ this.next();
+ node.object = this.parseParenExpression();
+ node.body = this.parseStatement();
+ return this.finishNode(node, "WithStatement");
+
+ case _.tokTypes.braceL:
+ return this.parseBlock();
+
+ case _.tokTypes.semi:
+ this.next();
+ return this.finishNode(node, "EmptyStatement");
+
+ case _.tokTypes._class:
+ return this.parseClass(true);
+
+ case _.tokTypes._import:
+ return this.parseImport();
+
+ case _.tokTypes._export:
+ return this.parseExport();
+
+ default:
+ var expr = this.parseExpression();
+ if (_parseutil.isDummy(expr)) {
+ this.next();
+ if (this.tok.type === _.tokTypes.eof) return this.finishNode(node, "EmptyStatement");
+ return this.parseStatement();
+ } else if (starttype === _.tokTypes.name && expr.type === "Identifier" && this.eat(_.tokTypes.colon)) {
+ node.body = this.parseStatement();
+ node.label = expr;
+ return this.finishNode(node, "LabeledStatement");
+ } else {
+ node.expression = expr;
+ this.semicolon();
+ return this.finishNode(node, "ExpressionStatement");
+ }
+ }
+};
+
+lp.parseBlock = function () {
+ var node = this.startNode();
+ this.pushCx();
+ this.expect(_.tokTypes.braceL);
+ var blockIndent = this.curIndent,
+ line = this.curLineStart;
+ node.body = [];
+ while (!this.closes(_.tokTypes.braceR, blockIndent, line, true)) node.body.push(this.parseStatement());
+ this.popCx();
+ this.eat(_.tokTypes.braceR);
+ return this.finishNode(node, "BlockStatement");
+};
+
+lp.parseFor = function (node, init) {
+ node.init = init;
+ node.test = node.update = null;
+ if (this.eat(_.tokTypes.semi) && this.tok.type !== _.tokTypes.semi) node.test = this.parseExpression();
+ if (this.eat(_.tokTypes.semi) && this.tok.type !== _.tokTypes.parenR) node.update = this.parseExpression();
+ this.popCx();
+ this.expect(_.tokTypes.parenR);
+ node.body = this.parseStatement();
+ return this.finishNode(node, "ForStatement");
+};
+
+lp.parseForIn = function (node, init) {
+ var type = this.tok.type === _.tokTypes._in ? "ForInStatement" : "ForOfStatement";
+ this.next();
+ node.left = init;
+ node.right = this.parseExpression();
+ this.popCx();
+ this.expect(_.tokTypes.parenR);
+ node.body = this.parseStatement();
+ return this.finishNode(node, type);
+};
+
+lp.parseVar = function (noIn) {
+ var node = this.startNode();
+ node.kind = this.tok.type.keyword;
+ this.next();
+ node.declarations = [];
+ do {
+ var decl = this.startNode();
+ decl.id = this.options.ecmaVersion >= 6 ? this.toAssignable(this.parseExprAtom(), true) : this.parseIdent();
+ decl.init = this.eat(_.tokTypes.eq) ? this.parseMaybeAssign(noIn) : null;
+ node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
+ } while (this.eat(_.tokTypes.comma));
+ if (!node.declarations.length) {
+ var decl = this.startNode();
+ decl.id = this.dummyIdent();
+ node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
+ }
+ if (!noIn) this.semicolon();
+ return this.finishNode(node, "VariableDeclaration");
+};
+
+lp.parseClass = function (isStatement) {
+ var node = this.startNode();
+ this.next();
+ if (this.tok.type === _.tokTypes.name) node.id = this.parseIdent();else if (isStatement) node.id = this.dummyIdent();else node.id = null;
+ node.superClass = this.eat(_.tokTypes._extends) ? this.parseExpression() : null;
+ node.body = this.startNode();
+ node.body.body = [];
+ this.pushCx();
+ var indent = this.curIndent + 1,
+ line = this.curLineStart;
+ this.eat(_.tokTypes.braceL);
+ if (this.curIndent + 1 < indent) {
+ indent = this.curIndent;line = this.curLineStart;
+ }
+ while (!this.closes(_.tokTypes.braceR, indent, line)) {
+ if (this.semicolon()) continue;
+ var method = this.startNode(),
+ isGenerator = undefined;
+ if (this.options.ecmaVersion >= 6) {
+ method["static"] = false;
+ isGenerator = this.eat(_.tokTypes.star);
+ }
+ this.parsePropertyName(method);
+ if (_parseutil.isDummy(method.key)) {
+ if (_parseutil.isDummy(this.parseMaybeAssign())) this.next();this.eat(_.tokTypes.comma);continue;
+ }
+ if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" && (this.tok.type != _.tokTypes.parenL && this.tok.type != _.tokTypes.braceL)) {
+ method["static"] = true;
+ isGenerator = this.eat(_.tokTypes.star);
+ this.parsePropertyName(method);
+ } else {
+ method["static"] = false;
+ }
+ if (this.options.ecmaVersion >= 5 && method.key.type === "Identifier" && !method.computed && (method.key.name === "get" || method.key.name === "set") && this.tok.type !== _.tokTypes.parenL && this.tok.type !== _.tokTypes.braceL) {
+ method.kind = method.key.name;
+ this.parsePropertyName(method);
+ method.value = this.parseMethod(false);
+ } else {
+ if (!method.computed && !method["static"] && !isGenerator && (method.key.type === "Identifier" && method.key.name === "constructor" || method.key.type === "Literal" && method.key.value === "constructor")) {
+ method.kind = "constructor";
+ } else {
+ method.kind = "method";
+ }
+ method.value = this.parseMethod(isGenerator);
+ }
+ node.body.body.push(this.finishNode(method, "MethodDefinition"));
+ }
+ this.popCx();
+ if (!this.eat(_.tokTypes.braceR)) {
+ // If there is no closing brace, make the node span to the start
+ // of the next token (this is useful for Tern)
+ this.last.end = this.tok.start;
+ if (this.options.locations) this.last.loc.end = this.tok.loc.start;
+ }
+ this.semicolon();
+ this.finishNode(node.body, "ClassBody");
+ return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
+};
+
+lp.parseFunction = function (node, isStatement) {
+ this.initFunction(node);
+ if (this.options.ecmaVersion >= 6) {
+ node.generator = this.eat(_.tokTypes.star);
+ }
+ if (this.tok.type === _.tokTypes.name) node.id = this.parseIdent();else if (isStatement) node.id = this.dummyIdent();
+ node.params = this.parseFunctionParams();
+ node.body = this.parseBlock();
+ return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
+};
+
+lp.parseExport = function () {
+ var node = this.startNode();
+ this.next();
+ if (this.eat(_.tokTypes.star)) {
+ node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
+ return this.finishNode(node, "ExportAllDeclaration");
+ }
+ if (this.eat(_.tokTypes._default)) {
+ var expr = this.parseMaybeAssign();
+ if (expr.id) {
+ switch (expr.type) {
+ case "FunctionExpression":
+ expr.type = "FunctionDeclaration";break;
+ case "ClassExpression":
+ expr.type = "ClassDeclaration";break;
+ }
+ }
+ node.declaration = expr;
+ this.semicolon();
+ return this.finishNode(node, "ExportDefaultDeclaration");
+ }
+ if (this.tok.type.keyword) {
+ node.declaration = this.parseStatement();
+ node.specifiers = [];
+ node.source = null;
+ } else {
+ node.declaration = null;
+ node.specifiers = this.parseExportSpecifierList();
+ node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
+ this.semicolon();
+ }
+ return this.finishNode(node, "ExportNamedDeclaration");
+};
+
+lp.parseImport = function () {
+ var node = this.startNode();
+ this.next();
+ if (this.tok.type === _.tokTypes.string) {
+ node.specifiers = [];
+ node.source = this.parseExprAtom();
+ node.kind = '';
+ } else {
+ var elt = undefined;
+ if (this.tok.type === _.tokTypes.name && this.tok.value !== "from") {
+ elt = this.startNode();
+ elt.local = this.parseIdent();
+ this.finishNode(elt, "ImportDefaultSpecifier");
+ this.eat(_.tokTypes.comma);
+ }
+ node.specifiers = this.parseImportSpecifierList();
+ node.source = this.eatContextual("from") && this.tok.type == _.tokTypes.string ? this.parseExprAtom() : this.dummyString();
+ if (elt) node.specifiers.unshift(elt);
+ }
+ this.semicolon();
+ return this.finishNode(node, "ImportDeclaration");
+};
+
+lp.parseImportSpecifierList = function () {
+ var elts = [];
+ if (this.tok.type === _.tokTypes.star) {
+ var elt = this.startNode();
+ this.next();
+ if (this.eatContextual("as")) elt.local = this.parseIdent();
+ elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"));
+ } else {
+ var indent = this.curIndent,
+ line = this.curLineStart,
+ continuedLine = this.nextLineStart;
+ this.pushCx();
+ this.eat(_.tokTypes.braceL);
+ if (this.curLineStart > continuedLine) continuedLine = this.curLineStart;
+ while (!this.closes(_.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
+ var elt = this.startNode();
+ if (this.eat(_.tokTypes.star)) {
+ elt.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent();
+ this.finishNode(elt, "ImportNamespaceSpecifier");
+ } else {
+ if (this.isContextual("from")) break;
+ elt.imported = this.parseIdent();
+ if (_parseutil.isDummy(elt.imported)) break;
+ elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported;
+ this.finishNode(elt, "ImportSpecifier");
+ }
+ elts.push(elt);
+ this.eat(_.tokTypes.comma);
+ }
+ this.eat(_.tokTypes.braceR);
+ this.popCx();
+ }
+ return elts;
+};
+
+lp.parseExportSpecifierList = function () {
+ var elts = [];
+ var indent = this.curIndent,
+ line = this.curLineStart,
+ continuedLine = this.nextLineStart;
+ this.pushCx();
+ this.eat(_.tokTypes.braceL);
+ if (this.curLineStart > continuedLine) continuedLine = this.curLineStart;
+ while (!this.closes(_.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
+ if (this.isContextual("from")) break;
+ var elt = this.startNode();
+ elt.local = this.parseIdent();
+ if (_parseutil.isDummy(elt.local)) break;
+ elt.exported = this.eatContextual("as") ? this.parseIdent() : elt.local;
+ this.finishNode(elt, "ExportSpecifier");
+ elts.push(elt);
+ this.eat(_.tokTypes.comma);
+ }
+ this.eat(_.tokTypes.braceR);
+ this.popCx();
+ return elts;
+};
+
+},{"..":1,"./parseutil":4,"./state":5}],7:[function(_dereq_,module,exports){
+"use strict";
+
+var _ = _dereq_("..");
+
+var _state = _dereq_("./state");
+
+var lp = _state.LooseParser.prototype;
+
+function isSpace(ch) {
+ return ch < 14 && ch > 8 || ch === 32 || ch === 160 || _.isNewLine(ch);
+}
+
+lp.next = function () {
+ this.last = this.tok;
+ if (this.ahead.length) this.tok = this.ahead.shift();else this.tok = this.readToken();
+
+ if (this.tok.start >= this.nextLineStart) {
+ while (this.tok.start >= this.nextLineStart) {
+ this.curLineStart = this.nextLineStart;
+ this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
+ }
+ this.curIndent = this.indentationAfter(this.curLineStart);
+ }
+};
+
+lp.readToken = function () {
+ for (;;) {
+ try {
+ this.toks.next();
+ if (this.toks.type === _.tokTypes.dot && this.input.substr(this.toks.end, 1) === "." && this.options.ecmaVersion >= 6) {
+ this.toks.end++;
+ this.toks.type = _.tokTypes.ellipsis;
+ }
+ return new _.Token(this.toks);
+ } catch (e) {
+ if (!(e instanceof SyntaxError)) throw e;
+
+ // Try to skip some text, based on the error message, and then continue
+ var msg = e.message,
+ pos = e.raisedAt,
+ replace = true;
+ if (/unterminated/i.test(msg)) {
+ pos = this.lineEnd(e.pos + 1);
+ if (/string/.test(msg)) {
+ replace = { start: e.pos, end: pos, type: _.tokTypes.string, value: this.input.slice(e.pos + 1, pos) };
+ } else if (/regular expr/i.test(msg)) {
+ var re = this.input.slice(e.pos, pos);
+ try {
+ re = new RegExp(re);
+ } catch (e) {}
+ replace = { start: e.pos, end: pos, type: _.tokTypes.regexp, value: re };
+ } else if (/template/.test(msg)) {
+ replace = { start: e.pos, end: pos,
+ type: _.tokTypes.template,
+ value: this.input.slice(e.pos, pos) };
+ } else {
+ replace = false;
+ }
+ } else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
+ while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos;
+ } else if (/character escape|expected hexadecimal/i.test(msg)) {
+ while (pos < this.input.length) {
+ var ch = this.input.charCodeAt(pos++);
+ if (ch === 34 || ch === 39 || _.isNewLine(ch)) break;
+ }
+ } else if (/unexpected character/i.test(msg)) {
+ pos++;
+ replace = false;
+ } else if (/regular expression/i.test(msg)) {
+ replace = true;
+ } else {
+ throw e;
+ }
+ this.resetTo(pos);
+ if (replace === true) replace = { start: pos, end: pos, type: _.tokTypes.name, value: "\u2716" };
+ if (replace) {
+ if (this.options.locations) replace.loc = new _.SourceLocation(this.toks, _.getLineInfo(this.input, replace.start), _.getLineInfo(this.input, replace.end));
+ return replace;
+ }
+ }
+ }
+};
+
+lp.resetTo = function (pos) {
+ this.toks.pos = pos;
+ var ch = this.input.charAt(pos - 1);
+ this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) || /[enwfd]/.test(ch) && /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos));
+
+ if (this.options.locations) {
+ this.toks.curLine = 1;
+ this.toks.lineStart = _.lineBreakG.lastIndex = 0;
+ var match = undefined;
+ while ((match = _.lineBreakG.exec(this.input)) && match.index < pos) {
+ ++this.toks.curLine;
+ this.toks.lineStart = match.index + match[0].length;
+ }
+ }
+};
+
+lp.lookAhead = function (n) {
+ while (n > this.ahead.length) this.ahead.push(this.readToken());
+ return this.ahead[n - 1];
+};
+
+},{"..":1,"./state":5}]},{},[3])(3)
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-griffin-site/blob/4f8fa326/node_modules/acorn/dist/walk.js
----------------------------------------------------------------------
diff --git a/node_modules/acorn/dist/walk.js b/node_modules/acorn/dist/walk.js
new file mode 100644
index 0000000..9429e0b
--- /dev/null
+++ b/node_modules/acorn/dist/walk.js
@@ -0,0 +1,377 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).walk = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
+// AST walker module for Mozilla Parser API compatible trees
+
+// A simple walk is one where you simply specify callbacks to be
+// called on specific nodes. The last two arguments are optional. A
+// simple use would be
+//
+// walk.simple(myTree, {
+// Expression: function(node) { ... }
+// });
+//
+// to do something with all expressions. All Parser API node types
+// can be used to identify node types, as well as Expression,
+// Statement, and ScopeBody, which denote categories of nodes.
+//
+// The base argument can be used to pass a custom (recursive)
+// walker, and state can be used to give this walked an initial
+// state.
+
+"use strict";
+
+exports.__esModule = true;
+exports.simple = simple;
+exports.ancestor = ancestor;
+exports.recursive = recursive;
+exports.findNodeAt = findNodeAt;
+exports.findNodeAround = findNodeAround;
+exports.findNodeAfter = findNodeAfter;
+exports.findNodeBefore = findNodeBefore;
+exports.make = make;
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function simple(node, visitors, base, state, override) {
+ if (!base) base = exports.base;(function c(node, st, override) {
+ var type = override || node.type,
+ found = visitors[type];
+ base[type](node, st, c);
+ if (found) found(node, st);
+ })(node, state, override);
+}
+
+// An ancestor walk builds up an array of ancestor nodes (including
+// the current node) and passes them to the callback as the state parameter.
+
+function ancestor(node, visitors, base, state) {
+ if (!base) base = exports.base;
+ if (!state) state = [];(function c(node, st, override) {
+ var type = override || node.type,
+ found = visitors[type];
+ if (node != st[st.length - 1]) {
+ st = st.slice();
+ st.push(node);
+ }
+ base[type](node, st, c);
+ if (found) found(node, st);
+ })(node, state);
+}
+
+// A recursive walk is one where your functions override the default
+// walkers. They can modify and replace the state parameter that's
+// threaded through the walk, and can opt how and whether to walk
+// their child nodes (by calling their third argument on these
+// nodes).
+
+function recursive(node, state, funcs, base, override) {
+ var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {
+ visitor[override || node.type](node, st, c);
+ })(node, state, override);
+}
+
+function makeTest(test) {
+ if (typeof test == "string") return function (type) {
+ return type == test;
+ };else if (!test) return function () {
+ return true;
+ };else return test;
+}
+
+var Found = function Found(node, state) {
+ _classCallCheck(this, Found);
+
+ this.node = node;this.state = state;
+}
+
+// Find a node with a given start, end, and type (all are optional,
+// null can be used as wildcard). Returns a {node, state} object, or
+// undefined when it doesn't find a matching node.
+;
+
+function findNodeAt(node, start, end, test, base, state) {
+ test = makeTest(test);
+ if (!base) base = exports.base;
+ try {
+ ;(function c(node, st, override) {
+ var type = override || node.type;
+ if ((start == null || node.start <= start) && (end == null || node.end >= end)) base[type](node, st, c);
+ if ((start == null || node.start == start) && (end == null || node.end == end) && test(type, node)) throw new Found(node, st);
+ })(node, state);
+ } catch (e) {
+ if (e instanceof Found) return e;
+ throw e;
+ }
+}
+
+// Find the innermost node of a given type that contains the given
+// position. Interface similar to findNodeAt.
+
+function findNodeAround(node, pos, test, base, state) {
+ test = makeTest(test);
+ if (!base) base = exports.base;
+ try {
+ ;(function c(node, st, override) {
+ var type = override || node.type;
+ if (node.start > pos || node.end < pos) return;
+ base[type](node, st, c);
+ if (test(type, node)) throw new Found(node, st);
+ })(node, state);
+ } catch (e) {
+ if (e instanceof Found) return e;
+ throw e;
+ }
+}
+
+// Find the outermost matching node after a given position.
+
+function findNodeAfter(node, pos, test, base, state) {
+ test = makeTest(test);
+ if (!base) base = exports.base;
+ try {
+ ;(function c(node, st, override) {
+ if (node.end < pos) return;
+ var type = override || node.type;
+ if (node.start >= pos && test(type, node)) throw new Found(node, st);
+ base[type](node, st, c);
+ })(node, state);
+ } catch (e) {
+ if (e instanceof Found) return e;
+ throw e;
+ }
+}
+
+// Find the outermost matching node before a given position.
+
+function findNodeBefore(node, pos, test, base, state) {
+ test = makeTest(test);
+ if (!base) base = exports.base;
+ var max = undefined;(function c(node, st, override) {
+ if (node.start > pos) return;
+ var type = override || node.type;
+ if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) max = new Found(node, st);
+ base[type](node, st, c);
+ })(node, state);
+ return max;
+}
+
+// Used to create a custom walker. Will fill in all missing node
+// type properties with the defaults.
+
+function make(funcs, base) {
+ if (!base) base = exports.base;
+ var visitor = {};
+ for (var type in base) visitor[type] = base[type];
+ for (var type in funcs) visitor[type] = funcs[type];
+ return visitor;
+}
+
+function skipThrough(node, st, c) {
+ c(node, st);
+}
+function ignore(_node, _st, _c) {}
+
+// Node walkers.
+
+var base = {};
+
+exports.base = base;
+base.Program = base.BlockStatement = function (node, st, c) {
+ for (var i = 0; i < node.body.length; ++i) {
+ c(node.body[i], st, "Statement");
+ }
+};
+base.Statement = skipThrough;
+base.EmptyStatement = ignore;
+base.ExpressionStatement = base.ParenthesizedExpression = function (node, st, c) {
+ return c(node.expression, st, "Expression");
+};
+base.IfStatement = function (node, st, c) {
+ c(node.test, st, "Expression");
+ c(node.consequent, st, "Statement");
+ if (node.alternate) c(node.alternate, st, "Statement");
+};
+base.LabeledStatement = function (node, st, c) {
+ return c(node.body, st, "Statement");
+};
+base.BreakStatement = base.ContinueStatement = ignore;
+base.WithStatement = function (node, st, c) {
+ c(node.object, st, "Expression");
+ c(node.body, st, "Statement");
+};
+base.SwitchStatement = function (node, st, c) {
+ c(node.discriminant, st, "Expression");
+ for (var i = 0; i < node.cases.length; ++i) {
+ var cs = node.cases[i];
+ if (cs.test) c(cs.test, st, "Expression");
+ for (var j = 0; j < cs.consequent.length; ++j) {
+ c(cs.consequent[j], st, "Statement");
+ }
+ }
+};
+base.ReturnStatement = base.YieldExpression = function (node, st, c) {
+ if (node.argument) c(node.argument, st, "Expression");
+};
+base.ThrowStatement = base.SpreadElement = function (node, st, c) {
+ return c(node.argument, st, "Expression");
+};
+base.TryStatement = function (node, st, c) {
+ c(node.block, st, "Statement");
+ if (node.handler) {
+ c(node.handler.param, st, "Pattern");
+ c(node.handler.body, st, "ScopeBody");
+ }
+ if (node.finalizer) c(node.finalizer, st, "Statement");
+};
+base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
+ c(node.test, st, "Expression");
+ c(node.body, st, "Statement");
+};
+base.ForStatement = function (node, st, c) {
+ if (node.init) c(node.init, st, "ForInit");
+ if (node.test) c(node.test, st, "Expression");
+ if (node.update) c(node.update, st, "Expression");
+ c(node.body, st, "Statement");
+};
+base.ForInStatement = base.ForOfStatement = function (node, st, c) {
+ c(node.left, st, "ForInit");
+ c(node.right, st, "Expression");
+ c(node.body, st, "Statement");
+};
+base.ForInit = function (node, st, c) {
+ if (node.type == "VariableDeclaration") c(node, st);else c(node, st, "Expression");
+};
+base.DebuggerStatement = ignore;
+
+base.FunctionDeclaration = function (node, st, c) {
+ return c(node, st, "Function");
+};
+base.VariableDeclaration = function (node, st, c) {
+ for (var i = 0; i < node.declarations.length; ++i) {
+ c(node.declarations[i], st);
+ }
+};
+base.VariableDeclarator = function (node, st, c) {
+ c(node.id, st, "Pattern");
+ if (node.init) c(node.init, st, "Expression");
+};
+
+base.Function = function (node, st, c) {
+ if (node.id) c(node.id, st, "Pattern");
+ for (var i = 0; i < node.params.length; i++) {
+ c(node.params[i], st, "Pattern");
+ }c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody");
+};
+// FIXME drop these node types in next major version
+// (They are awkward, and in ES6 every block can be a scope.)
+base.ScopeBody = function (node, st, c) {
+ return c(node, st, "Statement");
+};
+base.ScopeExpression = function (node, st, c) {
+ return c(node, st, "Expression");
+};
+
+base.Pattern = function (node, st, c) {
+ if (node.type == "Identifier") c(node, st, "VariablePattern");else if (node.type == "MemberExpression") c(node, st, "MemberPattern");else c(node, st);
+};
+base.VariablePattern = ignore;
+base.MemberPattern = skipThrough;
+base.RestElement = function (node, st, c) {
+ return c(node.argument, st, "Pattern");
+};
+base.ArrayPattern = function (node, st, c) {
+ for (var i = 0; i < node.elements.length; ++i) {
+ var elt = node.elements[i];
+ if (elt) c(elt, st, "Pattern");
+ }
+};
+base.ObjectPattern = function (node, st, c) {
+ for (var i = 0; i < node.properties.length; ++i) {
+ c(node.properties[i].value, st, "Pattern");
+ }
+};
+
+base.Expression = skipThrough;
+base.ThisExpression = base.Super = base.MetaProperty = ignore;
+base.ArrayExpression = function (node, st, c) {
+ for (var i = 0; i < node.elements.length; ++i) {
+ var elt = node.elements[i];
+ if (elt) c(elt, st, "Expression");
+ }
+};
+base.ObjectExpression = function (node, st, c) {
+ for (var i = 0; i < node.properties.length; ++i) {
+ c(node.properties[i], st);
+ }
+};
+base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
+base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
+ for (var i = 0; i < node.expressions.length; ++i) {
+ c(node.expressions[i], st, "Expression");
+ }
+};
+base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
+ c(node.argument, st, "Expression");
+};
+base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
+ c(node.left, st, "Expression");
+ c(node.right, st, "Expression");
+};
+base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
+ c(node.left, st, "Pattern");
+ c(node.right, st, "Expression");
+};
+base.ConditionalExpression = function (node, st, c) {
+ c(node.test, st, "Expression");
+ c(node.consequent, st, "Expression");
+ c(node.alternate, st, "Expression");
+};
+base.NewExpression = base.CallExpression = function (node, st, c) {
+ c(node.callee, st, "Expression");
+ if (node.arguments) for (var i = 0; i < node.arguments.length; ++i) {
+ c(node.arguments[i], st, "Expression");
+ }
+};
+base.MemberExpression = function (node, st, c) {
+ c(node.object, st, "Expression");
+ if (node.computed) c(node.property, st, "Expression");
+};
+base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
+ if (node.declaration) c(node.declaration, st, node.type == "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression");
+ if (node.source) c(node.source, st, "Expression");
+};
+base.ExportAllDeclaration = function (node, st, c) {
+ c(node.source, st, "Expression");
+};
+base.ImportDeclaration = function (node, st, c) {
+ for (var i = 0; i < node.specifiers.length; i++) {
+ c(node.specifiers[i], st);
+ }c(node.source, st, "Expression");
+};
+base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
+
+base.TaggedTemplateExpression = function (node, st, c) {
+ c(node.tag, st, "Expression");
+ c(node.quasi, st);
+};
+base.ClassDeclaration = base.ClassExpression = function (node, st, c) {
+ return c(node, st, "Class");
+};
+base.Class = function (node, st, c) {
+ if (node.id) c(node.id, st, "Pattern");
+ if (node.superClass) c(node.superClass, st, "Expression");
+ for (var i = 0; i < node.body.body.length; i++) {
+ c(node.body.body[i], st);
+ }
+};
+base.MethodDefinition = base.Property = function (node, st, c) {
+ if (node.computed) c(node.key, st, "Expression");
+ c(node.value, st, "Expression");
+};
+base.ComprehensionExpression = function (node, st, c) {
+ for (var i = 0; i < node.blocks.length; i++) {
+ c(node.blocks[i].right, st, "Expression");
+ }c(node.body, st, "Expression");
+};
+
+},{}]},{},[1])(1)
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-griffin-site/blob/4f8fa326/node_modules/acorn/package.json
----------------------------------------------------------------------
diff --git a/node_modules/acorn/package.json b/node_modules/acorn/package.json
new file mode 100644
index 0000000..5b3f812
--- /dev/null
+++ b/node_modules/acorn/package.json
@@ -0,0 +1,223 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "acorn@^2.4.0",
+ "scope": null,
+ "escapedName": "acorn",
+ "name": "acorn",
+ "rawSpec": "^2.4.0",
+ "spec": ">=2.4.0 <3.0.0",
+ "type": "range"
+ },
+ "/Users/yueguo/tmp/griffin-site/node_modules/jsdom"
+ ]
+ ],
+ "_from": "acorn@>=2.4.0 <3.0.0",
+ "_id": "acorn@2.7.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/acorn",
+ "_nodeVersion": "4.2.2",
+ "_npmUser": {
+ "name": "marijn",
+ "email": "marijnh@gmail.com"
+ },
+ "_npmVersion": "2.14.7",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "acorn@^2.4.0",
+ "scope": null,
+ "escapedName": "acorn",
+ "name": "acorn",
+ "rawSpec": "^2.4.0",
+ "spec": ">=2.4.0 <3.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/acorn-globals",
+ "/jsdom"
+ ],
+ "_resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz",
+ "_shasum": "ab6e7d9d886aaca8b085bc3312b79a198433f0e7",
+ "_shrinkwrap": null,
+ "_spec": "acorn@^2.4.0",
+ "_where": "/Users/yueguo/tmp/griffin-site/node_modules/jsdom",
+ "bin": {
+ "acorn": "./bin/acorn"
+ },
+ "bugs": {
+ "url": "https://github.com/ternjs/acorn/issues"
+ },
+ "contributors": [
+ {
+ "name": "List of Acorn contributors. Updated before every release."
+ },
+ {
+ "name": "Adrian Rakovsky"
+ },
+ {
+ "name": "Alistair Braidwood"
+ },
+ {
+ "name": "Andres Suarez"
+ },
+ {
+ "name": "Aparajita Fishman"
+ },
+ {
+ "name": "Arian Stolwijk"
+ },
+ {
+ "name": "Artem Govorov"
+ },
+ {
+ "name": "Brandon Mills"
+ },
+ {
+ "name": "Charles Hughes"
+ },
+ {
+ "name": "Conrad Irwin"
+ },
+ {
+ "name": "David Bonnet"
+ },
+ {
+ "name": "ForbesLindesay"
+ },
+ {
+ "name": "Forbes Lindesay"
+ },
+ {
+ "name": "Gilad Peleg"
+ },
+ {
+ "name": "impinball"
+ },
+ {
+ "name": "Ingvar Stepanyan"
+ },
+ {
+ "name": "Jesse McCarthy"
+ },
+ {
+ "name": "Jiaxing Wang"
+ },
+ {
+ "name": "Joel Kemp"
+ },
+ {
+ "name": "Johannes Herr"
+ },
+ {
+ "name": "J�rg Lehni"
+ },
+ {
+ "name": "keeyipchan"
+ },
+ {
+ "name": "Kevin Kwok"
+ },
+ {
+ "name": "krator"
+ },
+ {
+ "name": "Marijn Haverbeke"
+ },
+ {
+ "name": "Martin Carlberg"
+ },
+ {
+ "name": "Mathias Bynens"
+ },
+ {
+ "name": "Mathieu 'p01' Henri"
+ },
+ {
+ "name": "Max Schaefer"
+ },
+ {
+ "name": "Max Zerzouri"
+ },
+ {
+ "name": "Mihai Bazon"
+ },
+ {
+ "name": "Mike Rennie"
+ },
+ {
+ "name": "Nick Fitzgerald"
+ },
+ {
+ "name": "Oskar Sch�ldstr�m"
+ },
+ {
+ "name": "Paul Harper"
+ },
+ {
+ "name": "Peter Rust"
+ },
+ {
+ "name": "PlNG"
+ },
+ {
+ "name": "r-e-d"
+ },
+ {
+ "name": "Rich Harris"
+ },
+ {
+ "name": "Sebastian McKenzie"
+ },
+ {
+ "name": "Timothy Gu"
+ },
+ {
+ "name": "zsjforcn"
+ }
+ ],
+ "dependencies": {},
+ "description": "ECMAScript parser",
+ "devDependencies": {
+ "babel-core": "^5.6.15",
+ "babelify": "^6.1.2",
+ "browserify": "^10.2.4",
+ "browserify-derequire": "^0.9.4",
+ "unicode-7.0.0": "~0.1.5"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "ab6e7d9d886aaca8b085bc3312b79a198433f0e7",
+ "tarball": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "gitHead": "1405436064bff087f14af55a763396aa5c0ca148",
+ "homepage": "https://github.com/ternjs/acorn",
+ "license": "MIT",
+ "main": "dist/acorn.js",
+ "maintainers": [
+ {
+ "name": "marijn",
+ "email": "marijnh@gmail.com"
+ },
+ {
+ "name": "rreverser",
+ "email": "me@rreverser.com"
+ }
+ ],
+ "name": "acorn",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/ternjs/acorn.git"
+ },
+ "scripts": {
+ "prepublish": "node bin/build-acorn.js",
+ "test": "node test/run.js"
+ },
+ "version": "2.7.0"
+}
http://git-wip-us.apache.org/repos/asf/incubator-griffin-site/blob/4f8fa326/node_modules/acorn/src/bin/acorn.js
----------------------------------------------------------------------
diff --git a/node_modules/acorn/src/bin/acorn.js b/node_modules/acorn/src/bin/acorn.js
new file mode 100644
index 0000000..71a5dff
--- /dev/null
+++ b/node_modules/acorn/src/bin/acorn.js
@@ -0,0 +1,59 @@
+#!/usr/bin/env node
+
+import {basename} from "path"
+import {readFileSync as readFile} from "fs"
+import * as acorn from "../dist/acorn.js"
+
+let infile, forceFile, silent = false, compact = false, tokenize = false
+const options = {}
+
+function help(status) {
+ const print = (status == 0) ? console.log : console.error
+ print("usage: " + basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6]")
+ print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]")
+ process.exit(status)
+}
+
+for (let i = 2; i < process.argv.length; ++i) {
+ const arg = process.argv[i]
+ if ((arg == "-" || arg[0] != "-") && !infile) infile = arg
+ else if (arg == "--" && !infile && i + 2 == process.argv.length) forceFile = infile = process.argv[++i]
+ else if (arg == "--ecma3") options.ecmaVersion = 3
+ else if (arg == "--ecma5") options.ecmaVersion = 5
+ else if (arg == "--ecma6") options.ecmaVersion = 6
+ else if (arg == "--locations") options.locations = true
+ else if (arg == "--allow-hash-bang") options.allowHashBang = true
+ else if (arg == "--silent") silent = true
+ else if (arg == "--compact") compact = true
+ else if (arg == "--help") help(0)
+ else if (arg == "--tokenize") tokenize = true
+ else if (arg == "--module") options.sourceType = 'module'
+ else help(1)
+}
+
+function run(code) {
+ let result
+ if (!tokenize) {
+ try { result = acorn.parse(code, options) }
+ catch(e) { console.error(e.message); process.exit(1) }
+ } else {
+ result = []
+ let tokenizer = acorn.tokenizer(code, options), token
+ while (true) {
+ try { token = tokenizer.getToken() }
+ catch(e) { console.error(e.message); process.exit(1) }
+ result.push(token)
+ if (token.type == acorn.tokTypes.eof) break
+ }
+ }
+ if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2))
+}
+
+if (forceFile || infile && infile != "-") {
+ run(readFile(infile, "utf8"))
+} else {
+ let code = ""
+ process.stdin.resume()
+ process.stdin.on("data", chunk => code += chunk)
+ process.stdin.on("end", () => run(code))
+}