-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
acorn_loose.min.js
2 lines (2 loc) · 29.3 KB
/
acorn_loose.min.js
1
2
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("./acorn")):"function"==typeof define&&define.amd?define(["exports","./acorn"],e):e((t.acorn=t.acorn||{},t.acorn.loose=t.acorn.loose||{}),t.acorn)}(this,function(t,e){"use strict";function s(t){return t<14&&t>8||32===t||160===t||e.isNewLine(t)}function i(t){return"✖"==t.name}function r(t,e){var s=new n(t,e);return s.next(),s.parseTopLevel()}var o={},n=function(t,s){if(void 0===s&&(s={}),this.toks=e.tokenizer(t,s),this.options=this.toks.options,this.input=this.toks.input,this.tok=this.last={type:e.tokTypes.eof,start:0,end:0},this.options.locations){var i=this.toks.curPosition();this.tok.loc=new e.SourceLocation(this.toks,i,i)}this.ahead=[],this.context=[],this.curIndent=0,this.curLineStart=0,this.nextLineStart=this.lineEnd(this.curLineStart)+1,this.inAsync=!1,this.options.pluginsLoose=s.pluginsLoose||{},this.loadPlugins(this.options.pluginsLoose)};n.prototype.startNode=function(){return new e.Node(this.toks,this.tok.start,this.options.locations?this.tok.loc.start:null)},n.prototype.storeCurrentPos=function(){return this.options.locations?[this.tok.start,this.tok.loc.start]:this.tok.start},n.prototype.startNodeAt=function(t){return this.options.locations?new e.Node(this.toks,t[0],t[1]):new e.Node(this.toks,t)},n.prototype.finishNode=function(t,e){return t.type=e,t.end=this.last.end,this.options.locations&&(t.loc.end=this.last.loc.end),this.options.ranges&&(t.range[1]=this.last.end),t},n.prototype.dummyNode=function(t){var s=this.startNode();return s.type=t,s.end=s.start,this.options.locations&&(s.loc.end=s.loc.start),this.options.ranges&&(s.range[1]=s.start),this.last={type:e.tokTypes.name,start:s.start,end:s.start,loc:s.loc},s},n.prototype.dummyIdent=function(){var t=this.dummyNode("Identifier");return t.name="✖",t},n.prototype.dummyString=function(){var t=this.dummyNode("Literal");return t.value=t.raw="✖",t},n.prototype.eat=function(t){return this.tok.type===t&&(this.next(),!0)},n.prototype.isContextual=function(t){return this.tok.type===e.tokTypes.name&&this.tok.value===t},n.prototype.eatContextual=function(t){return this.tok.value===t&&this.eat(e.tokTypes.name)},n.prototype.canInsertSemicolon=function(){return this.tok.type===e.tokTypes.eof||this.tok.type===e.tokTypes.braceR||e.lineBreak.test(this.input.slice(this.last.end,this.tok.start))},n.prototype.semicolon=function(){return this.eat(e.tokTypes.semi)},n.prototype.expect=function(t){var e=this;if(this.eat(t))return!0;for(var s=1;s<=2;s++)if(e.lookAhead(s).type==t){for(var i=0;i<s;i++)e.next();return!0}},n.prototype.pushCx=function(){this.context.push(this.curIndent)},n.prototype.popCx=function(){this.curIndent=this.context.pop()},n.prototype.lineEnd=function(t){for(;t<this.input.length&&!e.isNewLine(this.input.charCodeAt(t));)++t;return t},n.prototype.indentationAfter=function(t){for(var e=this,s=0;;++t){var i=e.input.charCodeAt(t);if(32===i)++s;else{if(9!==i)return s;s+=e.options.tabSize}}},n.prototype.closes=function(t,s,i,r){return this.tok.type===t||this.tok.type===e.tokTypes.eof||i!=this.curLineStart&&this.curIndent<s&&this.tokenStartsLine()&&(!r||this.nextLineStart>=this.input.length||this.indentationAfter(this.nextLineStart)<s)},n.prototype.tokenStartsLine=function(){for(var t=this,e=this.tok.start-1;e>=this.curLineStart;--e){var s=t.input.charCodeAt(e);if(9!==s&&32!==s)return!1}return!0},n.prototype.extend=function(t,e){this[t]=e(this[t])},n.prototype.loadPlugins=function(t){var e=this;for(var s in t){var i=o[s];if(!i)throw new Error("Plugin '"+s+"' not found");i(e,t[s])}};var a=n.prototype;a.next=function(){var t=this;if(this.last=this.tok,this.ahead.length?this.tok=this.ahead.shift():this.tok=this.readToken(),this.tok.start>=this.nextLineStart){for(;this.tok.start>=this.nextLineStart;)t.curLineStart=t.nextLineStart,t.nextLineStart=t.lineEnd(t.curLineStart)+1;this.curIndent=this.indentationAfter(this.curLineStart)}},a.readToken=function(){for(var t=this;;)try{return t.toks.next(),t.toks.type===e.tokTypes.dot&&"."===t.input.substr(t.toks.end,1)&&t.options.ecmaVersion>=6&&(t.toks.end++,t.toks.type=e.tokTypes.ellipsis),new e.Token(t.toks)}catch(p){if(!(p instanceof SyntaxError))throw p;var i=p.message,r=p.raisedAt,o=!0;if(/unterminated/i.test(i))if(r=t.lineEnd(p.pos+1),/string/.test(i))o={start:p.pos,end:r,type:e.tokTypes.string,value:t.input.slice(p.pos+1,r)};else if(/regular expr/i.test(i)){var n=t.input.slice(p.pos,r);try{n=new RegExp(n)}catch(t){}o={start:p.pos,end:r,type:e.tokTypes.regexp,value:n}}else o=!!/template/.test(i)&&{start:p.pos,end:r,type:e.tokTypes.template,value:t.input.slice(p.pos,r)};else if(/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(i))for(;r<this.input.length&&!s(this.input.charCodeAt(r));)++r;else if(/character escape|expected hexadecimal/i.test(i))for(;r<this.input.length;){var a=t.input.charCodeAt(r++);if(34===a||39===a||e.isNewLine(a))break}else if(/unexpected character/i.test(i))r++,o=!1;else{if(!/regular expression/i.test(i))throw p;o=!0}if(t.resetTo(r),o===!0&&(o={start:r,end:r,type:e.tokTypes.name,value:"✖"}),o)return t.options.locations&&(o.loc=new e.SourceLocation(t.toks,e.getLineInfo(t.input,o.start),e.getLineInfo(t.input,o.end))),o}},a.resetTo=function(t){var s=this;this.toks.pos=t;var i=this.input.charAt(t-1);if(this.toks.exprAllowed=!i||/[[{(,;:?\/*=+\-~!|&%^<>]/.test(i)||/[enwfd]/.test(i)&&/\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(t-10,t)),this.options.locations){this.toks.curLine=1,this.toks.lineStart=e.lineBreakG.lastIndex=0;for(var r;(r=e.lineBreakG.exec(this.input))&&r.index<t;)++s.toks.curLine,s.toks.lineStart=r.index+r[0].length}},a.lookAhead=function(t){for(var e=this;t>this.ahead.length;)e.ahead.push(e.readToken());return this.ahead[t-1]};var p=n.prototype;p.parseTopLevel=function(){var t=this,s=this.startNodeAt(this.options.locations?[0,e.getLineInfo(this.input,0)]:0);for(s.body=[];this.tok.type!==e.tokTypes.eof;)s.body.push(t.parseStatement());return this.last=this.tok,this.options.ecmaVersion>=6&&(s.sourceType=this.options.sourceType),this.finishNode(s,"Program")},p.parseStatement=function(){var t,s=this,r=this.tok.type,o=this.startNode();switch(this.toks.isLet()&&(r=e.tokTypes._var,t="let"),r){case e.tokTypes._break:case e.tokTypes._continue:this.next();var n=r===e.tokTypes._break;return this.semicolon()||this.canInsertSemicolon()?o.label=null:(o.label=this.tok.type===e.tokTypes.name?this.parseIdent():null,this.semicolon()),this.finishNode(o,n?"BreakStatement":"ContinueStatement");case e.tokTypes._debugger:return this.next(),this.semicolon(),this.finishNode(o,"DebuggerStatement");case e.tokTypes._do:return this.next(),o.body=this.parseStatement(),o.test=this.eat(e.tokTypes._while)?this.parseParenExpression():this.dummyIdent(),this.semicolon(),this.finishNode(o,"DoWhileStatement");case e.tokTypes._for:if(this.next(),this.pushCx(),this.expect(e.tokTypes.parenL),this.tok.type===e.tokTypes.semi)return this.parseFor(o,null);var a=this.toks.isLet();if(a||this.tok.type===e.tokTypes._var||this.tok.type===e.tokTypes._const){var p=this.parseVar(!0,a?"let":this.tok.value);return 1!==p.declarations.length||this.tok.type!==e.tokTypes._in&&!this.isContextual("of")?this.parseFor(o,p):this.parseForIn(o,p)}var h=this.parseExpression(!0);return this.tok.type===e.tokTypes._in||this.isContextual("of")?this.parseForIn(o,this.toAssignable(h)):this.parseFor(o,h);case e.tokTypes._function:return this.next(),this.parseFunction(o,!0);case e.tokTypes._if:return this.next(),o.test=this.parseParenExpression(),o.consequent=this.parseStatement(),o.alternate=this.eat(e.tokTypes._else)?this.parseStatement():null,this.finishNode(o,"IfStatement");case e.tokTypes._return:return this.next(),this.eat(e.tokTypes.semi)||this.canInsertSemicolon()?o.argument=null:(o.argument=this.parseExpression(),this.semicolon()),this.finishNode(o,"ReturnStatement");case e.tokTypes._switch:var c=this.curIndent,u=this.curLineStart;this.next(),o.discriminant=this.parseParenExpression(),o.cases=[],this.pushCx(),this.expect(e.tokTypes.braceL);for(var y;!this.closes(e.tokTypes.braceR,c,u,!0);)if(s.tok.type===e.tokTypes._case||s.tok.type===e.tokTypes._default){var l=s.tok.type===e.tokTypes._case;y&&s.finishNode(y,"SwitchCase"),o.cases.push(y=s.startNode()),y.consequent=[],s.next(),l?y.test=s.parseExpression():y.test=null,s.expect(e.tokTypes.colon)}else y||(o.cases.push(y=s.startNode()),y.consequent=[],y.test=null),y.consequent.push(s.parseStatement());return y&&this.finishNode(y,"SwitchCase"),this.popCx(),this.eat(e.tokTypes.braceR),this.finishNode(o,"SwitchStatement");case e.tokTypes._throw:return this.next(),o.argument=this.parseExpression(),this.semicolon(),this.finishNode(o,"ThrowStatement");case e.tokTypes._try:if(this.next(),o.block=this.parseBlock(),o.handler=null,this.tok.type===e.tokTypes._catch){var d=this.startNode();this.next(),this.expect(e.tokTypes.parenL),d.param=this.toAssignable(this.parseExprAtom(),!0),this.expect(e.tokTypes.parenR),d.body=this.parseBlock(),o.handler=this.finishNode(d,"CatchClause")}return o.finalizer=this.eat(e.tokTypes._finally)?this.parseBlock():null,o.handler||o.finalizer?this.finishNode(o,"TryStatement"):o.block;case e.tokTypes._var:case e.tokTypes._const:return this.parseVar(!1,t||this.tok.value);case e.tokTypes._while:return this.next(),o.test=this.parseParenExpression(),o.body=this.parseStatement(),this.finishNode(o,"WhileStatement");case e.tokTypes._with:return this.next(),o.object=this.parseParenExpression(),o.body=this.parseStatement(),this.finishNode(o,"WithStatement");case e.tokTypes.braceL:return this.parseBlock();case e.tokTypes.semi:return this.next(),this.finishNode(o,"EmptyStatement");case e.tokTypes._class:return this.parseClass(!0);case e.tokTypes._import:return this.parseImport();case e.tokTypes._export:return this.parseExport();default:if(this.toks.isAsyncFunction())return this.next(),this.next(),this.parseFunction(o,!0,!0);var k=this.parseExpression();return i(k)?(this.next(),this.tok.type===e.tokTypes.eof?this.finishNode(o,"EmptyStatement"):this.parseStatement()):r===e.tokTypes.name&&"Identifier"===k.type&&this.eat(e.tokTypes.colon)?(o.body=this.parseStatement(),o.label=k,this.finishNode(o,"LabeledStatement")):(o.expression=k,this.semicolon(),this.finishNode(o,"ExpressionStatement"))}},p.parseBlock=function(){var t=this,s=this.startNode();this.pushCx(),this.expect(e.tokTypes.braceL);var i=this.curIndent,r=this.curLineStart;for(s.body=[];!this.closes(e.tokTypes.braceR,i,r,!0);)s.body.push(t.parseStatement());return this.popCx(),this.eat(e.tokTypes.braceR),this.finishNode(s,"BlockStatement")},p.parseFor=function(t,s){return t.init=s,t.test=t.update=null,this.eat(e.tokTypes.semi)&&this.tok.type!==e.tokTypes.semi&&(t.test=this.parseExpression()),this.eat(e.tokTypes.semi)&&this.tok.type!==e.tokTypes.parenR&&(t.update=this.parseExpression()),this.popCx(),this.expect(e.tokTypes.parenR),t.body=this.parseStatement(),this.finishNode(t,"ForStatement")},p.parseForIn=function(t,s){var i=this.tok.type===e.tokTypes._in?"ForInStatement":"ForOfStatement";return this.next(),t.left=s,t.right=this.parseExpression(),this.popCx(),this.expect(e.tokTypes.parenR),t.body=this.parseStatement(),this.finishNode(t,i)},p.parseVar=function(t,s){var i=this,r=this.startNode();r.kind=s,this.next(),r.declarations=[];do{var o=i.startNode();o.id=i.options.ecmaVersion>=6?i.toAssignable(i.parseExprAtom(),!0):i.parseIdent(),o.init=i.eat(e.tokTypes.eq)?i.parseMaybeAssign(t):null,r.declarations.push(i.finishNode(o,"VariableDeclarator"))}while(this.eat(e.tokTypes.comma));if(!r.declarations.length){var n=this.startNode();n.id=this.dummyIdent(),r.declarations.push(this.finishNode(n,"VariableDeclarator"))}return t||this.semicolon(),this.finishNode(r,"VariableDeclaration")},p.parseClass=function(t){var s=this,r=this.startNode();this.next(),this.tok.type===e.tokTypes.name?r.id=this.parseIdent():t===!0?r.id=this.dummyIdent():r.id=null,r.superClass=this.eat(e.tokTypes._extends)?this.parseExpression():null,r.body=this.startNode(),r.body.body=[],this.pushCx();var o=this.curIndent+1,n=this.curLineStart;for(this.eat(e.tokTypes.braceL),this.curIndent+1<o&&(o=this.curIndent,n=this.curLineStart);!this.closes(e.tokTypes.braceR,o,n);)if(!s.semicolon()){var a,p,h=s.startNode();s.options.ecmaVersion>=6&&(h.static=!1,a=s.eat(e.tokTypes.star)),s.parsePropertyName(h),i(h.key)?(i(s.parseMaybeAssign())&&s.next(),s.eat(e.tokTypes.comma)):("Identifier"!==h.key.type||h.computed||"static"!==h.key.name||s.tok.type==e.tokTypes.parenL||s.tok.type==e.tokTypes.braceL?h.static=!1:(h.static=!0,a=s.eat(e.tokTypes.star),s.parsePropertyName(h)),h.computed||"Identifier"!==h.key.type||"async"!==h.key.name||s.tok.type===e.tokTypes.parenL||s.canInsertSemicolon()?p=!1:(s.parsePropertyName(h),p=!0),s.options.ecmaVersion>=5&&"Identifier"===h.key.type&&!h.computed&&("get"===h.key.name||"set"===h.key.name)&&s.tok.type!==e.tokTypes.parenL&&s.tok.type!==e.tokTypes.braceL?(h.kind=h.key.name,s.parsePropertyName(h),h.value=s.parseMethod(!1)):(h.computed||h.static||a||p||!("Identifier"===h.key.type&&"constructor"===h.key.name||"Literal"===h.key.type&&"constructor"===h.key.value)?h.kind="method":h.kind="constructor",h.value=s.parseMethod(a,p)),r.body.body.push(s.finishNode(h,"MethodDefinition")))}return this.popCx(),this.eat(e.tokTypes.braceR)||(this.last.end=this.tok.start,this.options.locations&&(this.last.loc.end=this.tok.loc.start)),this.semicolon(),this.finishNode(r.body,"ClassBody"),this.finishNode(r,t?"ClassDeclaration":"ClassExpression")},p.parseFunction=function(t,s,i){var r=this.inAsync;return this.initFunction(t),this.options.ecmaVersion>=6&&(t.generator=this.eat(e.tokTypes.star)),this.options.ecmaVersion>=8&&(t.async=!!i),this.tok.type===e.tokTypes.name?t.id=this.parseIdent():s===!0&&(t.id=this.dummyIdent()),this.inAsync=t.async,t.params=this.parseFunctionParams(),t.body=this.parseBlock(),this.inAsync=r,this.finishNode(t,s?"FunctionDeclaration":"FunctionExpression")},p.parseExport=function(){var t=this.startNode();if(this.next(),this.eat(e.tokTypes.star))return t.source=this.eatContextual("from")?this.parseExprAtom():this.dummyString(),this.finishNode(t,"ExportAllDeclaration");if(this.eat(e.tokTypes._default)){var s;if(this.tok.type===e.tokTypes._function||(s=this.toks.isAsyncFunction())){var i=this.startNode();this.next(),s&&this.next(),t.declaration=this.parseFunction(i,"nullableID",s)}else this.tok.type===e.tokTypes._class?t.declaration=this.parseClass("nullableID"):(t.declaration=this.parseMaybeAssign(),this.semicolon());return this.finishNode(t,"ExportDefaultDeclaration")}return this.tok.type.keyword||this.toks.isLet()||this.toks.isAsyncFunction()?(t.declaration=this.parseStatement(),t.specifiers=[],t.source=null):(t.declaration=null,t.specifiers=this.parseExportSpecifierList(),t.source=this.eatContextual("from")?this.parseExprAtom():null,this.semicolon()),this.finishNode(t,"ExportNamedDeclaration")},p.parseImport=function(){var t=this.startNode();if(this.next(),this.tok.type===e.tokTypes.string)t.specifiers=[],t.source=this.parseExprAtom(),t.kind="";else{var s;this.tok.type===e.tokTypes.name&&"from"!==this.tok.value&&(s=this.startNode(),s.local=this.parseIdent(),this.finishNode(s,"ImportDefaultSpecifier"),this.eat(e.tokTypes.comma)),t.specifiers=this.parseImportSpecifierList(),t.source=this.eatContextual("from")&&this.tok.type==e.tokTypes.string?this.parseExprAtom():this.dummyString(),s&&t.specifiers.unshift(s)}return this.semicolon(),this.finishNode(t,"ImportDeclaration")},p.parseImportSpecifierList=function(){var t=this,s=[];if(this.tok.type===e.tokTypes.star){var r=this.startNode();this.next(),r.local=this.eatContextual("as")?this.parseIdent():this.dummyIdent(),s.push(this.finishNode(r,"ImportNamespaceSpecifier"))}else{var o=this.curIndent,n=this.curLineStart,a=this.nextLineStart;for(this.pushCx(),this.eat(e.tokTypes.braceL),this.curLineStart>a&&(a=this.curLineStart);!this.closes(e.tokTypes.braceR,o+(this.curLineStart<=a?1:0),n);){var p=t.startNode();if(t.eat(e.tokTypes.star))p.local=t.eatContextual("as")?t.parseIdent():t.dummyIdent(),t.finishNode(p,"ImportNamespaceSpecifier");else{if(t.isContextual("from"))break;if(p.imported=t.parseIdent(),i(p.imported))break;p.local=t.eatContextual("as")?t.parseIdent():p.imported,t.finishNode(p,"ImportSpecifier")}s.push(p),t.eat(e.tokTypes.comma)}this.eat(e.tokTypes.braceR),this.popCx()}return s},p.parseExportSpecifierList=function(){var t=this,s=[],r=this.curIndent,o=this.curLineStart,n=this.nextLineStart;for(this.pushCx(),this.eat(e.tokTypes.braceL),this.curLineStart>n&&(n=this.curLineStart);!this.closes(e.tokTypes.braceR,r+(this.curLineStart<=n?1:0),o)&&!t.isContextual("from");){var a=t.startNode();if(a.local=t.parseIdent(),i(a.local))break;a.exported=t.eatContextual("as")?t.parseIdent():a.local,t.finishNode(a,"ExportSpecifier"),s.push(a),t.eat(e.tokTypes.comma)}return this.eat(e.tokTypes.braceR),this.popCx(),s};var h=n.prototype;h.checkLVal=function(t){if(!t)return t;switch(t.type){case"Identifier":case"MemberExpression":return t;case"ParenthesizedExpression":return t.expression=this.checkLVal(t.expression),t;default:return this.dummyIdent()}},h.parseExpression=function(t){var s=this,i=this.storeCurrentPos(),r=this.parseMaybeAssign(t);if(this.tok.type===e.tokTypes.comma){var o=this.startNodeAt(i);for(o.expressions=[r];this.eat(e.tokTypes.comma);)o.expressions.push(s.parseMaybeAssign(t));return this.finishNode(o,"SequenceExpression")}return r},h.parseParenExpression=function(){this.pushCx(),this.expect(e.tokTypes.parenL);var t=this.parseExpression();return this.popCx(),this.expect(e.tokTypes.parenR),t},h.parseMaybeAssign=function(t){if(this.toks.isContextual("yield")){var s=this.startNode();return this.next(),this.semicolon()||this.canInsertSemicolon()||this.tok.type!=e.tokTypes.star&&!this.tok.type.startsExpr?(s.delegate=!1,s.argument=null):(s.delegate=this.eat(e.tokTypes.star),s.argument=this.parseMaybeAssign()),this.finishNode(s,"YieldExpression")}var i=this.storeCurrentPos(),r=this.parseMaybeConditional(t);if(this.tok.type.isAssign){var o=this.startNodeAt(i);return o.operator=this.tok.value,o.left=this.tok.type===e.tokTypes.eq?this.toAssignable(r):this.checkLVal(r),this.next(),o.right=this.parseMaybeAssign(t),this.finishNode(o,"AssignmentExpression")}return r},h.parseMaybeConditional=function(t){var s=this.storeCurrentPos(),i=this.parseExprOps(t);if(this.eat(e.tokTypes.question)){var r=this.startNodeAt(s);return r.test=i,r.consequent=this.parseMaybeAssign(),r.alternate=this.expect(e.tokTypes.colon)?this.parseMaybeAssign(t):this.dummyIdent(),this.finishNode(r,"ConditionalExpression")}return i},h.parseExprOps=function(t){var e=this.storeCurrentPos(),s=this.curIndent,i=this.curLineStart;return this.parseExprOp(this.parseMaybeUnary(!1),e,-1,t,s,i)},h.parseExprOp=function(t,s,i,r,o,n){if(this.curLineStart!=n&&this.curIndent<o&&this.tokenStartsLine())return t;var a=this.tok.type.binop;if(null!=a&&(!r||this.tok.type!==e.tokTypes._in)&&a>i){var p=this.startNodeAt(s);if(p.left=t,p.operator=this.tok.value,this.next(),this.curLineStart!=n&&this.curIndent<o&&this.tokenStartsLine())p.right=this.dummyIdent();else{var h=this.storeCurrentPos();p.right=this.parseExprOp(this.parseMaybeUnary(!1),h,a,r,o,n)}return this.finishNode(p,/&&|\|\|/.test(p.operator)?"LogicalExpression":"BinaryExpression"),this.parseExprOp(p,s,i,r,o,n)}return t},h.parseMaybeUnary=function(t){var s,i=this,r=this.storeCurrentPos();if(this.options.ecmaVersion>=8&&this.inAsync&&this.toks.isContextual("await"))s=this.parseAwait(),t=!0;else if(this.tok.type.prefix){var o=this.startNode(),n=this.tok.type===e.tokTypes.incDec;n||(t=!0),o.operator=this.tok.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(!0),n&&(o.argument=this.checkLVal(o.argument)),s=this.finishNode(o,n?"UpdateExpression":"UnaryExpression")}else if(this.tok.type===e.tokTypes.ellipsis){var a=this.startNode();this.next(),a.argument=this.parseMaybeUnary(t),s=this.finishNode(a,"SpreadElement")}else for(s=this.parseExprSubscripts();this.tok.type.postfix&&!this.canInsertSemicolon();){var p=i.startNodeAt(r);p.operator=i.tok.value,p.prefix=!1,p.argument=i.checkLVal(s),i.next(),s=i.finishNode(p,"UpdateExpression")}if(!t&&this.eat(e.tokTypes.starstar)){var h=this.startNodeAt(r);return h.operator="**",h.left=s,h.right=this.parseMaybeUnary(!1),this.finishNode(h,"BinaryExpression")}return s},h.parseExprSubscripts=function(){var t=this.storeCurrentPos();return this.parseSubscripts(this.parseExprAtom(),t,!1,this.curIndent,this.curLineStart)},h.parseSubscripts=function(t,s,i,r,o){for(var n=this;;){if(n.curLineStart!=o&&n.curIndent<=r&&n.tokenStartsLine()){if(n.tok.type!=e.tokTypes.dot||n.curIndent!=r)return t;--r}var a="Identifier"===t.type&&"async"===t.name&&!n.canInsertSemicolon();if(n.eat(e.tokTypes.dot)){var p=n.startNodeAt(s);p.object=t,n.curLineStart!=o&&n.curIndent<=r&&n.tokenStartsLine()?p.property=n.dummyIdent():p.property=n.parsePropertyAccessor()||n.dummyIdent(),p.computed=!1,t=n.finishNode(p,"MemberExpression")}else if(n.tok.type==e.tokTypes.bracketL){n.pushCx(),n.next();var h=n.startNodeAt(s);h.object=t,h.property=n.parseExpression(),h.computed=!0,n.popCx(),n.expect(e.tokTypes.bracketR),t=n.finishNode(h,"MemberExpression")}else if(i||n.tok.type!=e.tokTypes.parenL){if(n.tok.type!=e.tokTypes.backQuote)return t;var c=n.startNodeAt(s);c.tag=t,c.quasi=n.parseTemplate(),t=n.finishNode(c,"TaggedTemplateExpression")}else{var u=n.parseExprList(e.tokTypes.parenR);if(a&&n.eat(e.tokTypes.arrow))return n.parseArrowExpression(n.startNodeAt(s),u,!0);var y=n.startNodeAt(s);y.callee=t,y.arguments=u,t=n.finishNode(y,"CallExpression")}}},h.parseExprAtom=function(){var t;switch(this.tok.type){case e.tokTypes._this:case e.tokTypes._super:var s=this.tok.type===e.tokTypes._this?"ThisExpression":"Super";return t=this.startNode(),this.next(),this.finishNode(t,s);case e.tokTypes.name:var r=this.storeCurrentPos(),o=this.parseIdent(),n=!1;if("async"===o.name&&!this.canInsertSemicolon()){if(this.eat(e.tokTypes._function))return this.parseFunction(this.startNodeAt(r),!1,!0);this.tok.type===e.tokTypes.name&&(o=this.parseIdent(),n=!0)}return this.eat(e.tokTypes.arrow)?this.parseArrowExpression(this.startNodeAt(r),[o],n):o;case e.tokTypes.regexp:t=this.startNode();var a=this.tok.value;return t.regex={pattern:a.pattern,flags:a.flags},t.value=a.value,t.raw=this.input.slice(this.tok.start,this.tok.end),this.next(),this.finishNode(t,"Literal");case e.tokTypes.num:case e.tokTypes.string:return t=this.startNode(),t.value=this.tok.value,t.raw=this.input.slice(this.tok.start,this.tok.end),this.next(),this.finishNode(t,"Literal");case e.tokTypes._null:case e.tokTypes._true:case e.tokTypes._false:return t=this.startNode(),t.value=this.tok.type===e.tokTypes._null?null:this.tok.type===e.tokTypes._true,t.raw=this.tok.type.keyword,this.next(),this.finishNode(t,"Literal");case e.tokTypes.parenL:var p=this.storeCurrentPos();this.next();var h=this.parseExpression();if(this.expect(e.tokTypes.parenR),this.eat(e.tokTypes.arrow)){var c=h.expressions||[h];return c.length&&i(c[c.length-1])&&c.pop(),this.parseArrowExpression(this.startNodeAt(p),c)}if(this.options.preserveParens){var u=this.startNodeAt(p);u.expression=h,h=this.finishNode(u,"ParenthesizedExpression")}return h;case e.tokTypes.bracketL:return t=this.startNode(),t.elements=this.parseExprList(e.tokTypes.bracketR,!0),this.finishNode(t,"ArrayExpression");case e.tokTypes.braceL:return this.parseObj();case e.tokTypes._class:return this.parseClass(!1);case e.tokTypes._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case e.tokTypes._new:return this.parseNew();case e.tokTypes.backQuote:return this.parseTemplate();default:return this.dummyIdent()}},h.parseNew=function(){var t=this.startNode(),s=this.curIndent,i=this.curLineStart,r=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(e.tokTypes.dot))return t.meta=r,t.property=this.parseIdent(!0),this.finishNode(t,"MetaProperty");var o=this.storeCurrentPos();return t.callee=this.parseSubscripts(this.parseExprAtom(),o,!0,s,i),this.tok.type==e.tokTypes.parenL?t.arguments=this.parseExprList(e.tokTypes.parenR):t.arguments=[],this.finishNode(t,"NewExpression")},h.parseTemplateElement=function(){var t=this.startNode();return t.value={raw:this.input.slice(this.tok.start,this.tok.end).replace(/\r\n?/g,"\n"),cooked:this.tok.value},this.next(),t.tail=this.tok.type===e.tokTypes.backQuote,this.finishNode(t,"TemplateElement")},h.parseTemplate=function(){var t=this,s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement();for(s.quasis=[i];!i.tail;)t.next(),s.expressions.push(t.parseExpression()),t.expect(e.tokTypes.braceR)?i=t.parseTemplateElement():(i=t.startNode(),i.value={cooked:"",raw:""},i.tail=!0,t.finishNode(i,"TemplateElement")),s.quasis.push(i);return this.expect(e.tokTypes.backQuote),this.finishNode(s,"TemplateLiteral")},h.parseObj=function(){var t=this,s=this.startNode();s.properties=[],this.pushCx();var r=this.curIndent+1,o=this.curLineStart;for(this.eat(e.tokTypes.braceL),this.curIndent+1<r&&(r=this.curIndent,o=this.curLineStart);!this.closes(e.tokTypes.braceR,r,o);){var n,a,p,h=t.startNode();if(t.options.ecmaVersion>=6&&(p=t.storeCurrentPos(),h.method=!1,h.shorthand=!1,n=t.eat(e.tokTypes.star)),t.parsePropertyName(h),h.computed||"Identifier"!==h.key.type||"async"!==h.key.name||t.tok.type===e.tokTypes.parenL||t.tok.type===e.tokTypes.colon||t.canInsertSemicolon()?a=!1:(t.parsePropertyName(h),a=!0),i(h.key))i(t.parseMaybeAssign())&&t.next(),t.eat(e.tokTypes.comma);else{if(t.eat(e.tokTypes.colon))h.kind="init",h.value=t.parseMaybeAssign();else if(t.options.ecmaVersion>=6&&(t.tok.type===e.tokTypes.parenL||t.tok.type===e.tokTypes.braceL))h.kind="init",h.method=!0,h.value=t.parseMethod(n,a);else if(t.options.ecmaVersion>=5&&"Identifier"===h.key.type&&!h.computed&&("get"===h.key.name||"set"===h.key.name)&&t.tok.type!=e.tokTypes.comma&&t.tok.type!=e.tokTypes.braceR)h.kind=h.key.name,t.parsePropertyName(h),h.value=t.parseMethod(!1);else{if(h.kind="init",t.options.ecmaVersion>=6)if(t.eat(e.tokTypes.eq)){var c=t.startNodeAt(p);c.operator="=",c.left=h.key,c.right=t.parseMaybeAssign(),h.value=t.finishNode(c,"AssignmentExpression")}else h.value=h.key;else h.value=t.dummyIdent();h.shorthand=!0}s.properties.push(t.finishNode(h,"Property")),t.eat(e.tokTypes.comma)}}return this.popCx(),this.eat(e.tokTypes.braceR)||(this.last.end=this.tok.start,this.options.locations&&(this.last.loc.end=this.tok.loc.start)),this.finishNode(s,"ObjectExpression")},h.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(e.tokTypes.bracketL))return t.computed=!0,t.key=this.parseExpression(),void this.expect(e.tokTypes.bracketR);t.computed=!1}var s=this.tok.type===e.tokTypes.num||this.tok.type===e.tokTypes.string?this.parseExprAtom():this.parseIdent();t.key=s||this.dummyIdent()},h.parsePropertyAccessor=function(){if(this.tok.type===e.tokTypes.name||this.tok.type.keyword)return this.parseIdent()},h.parseIdent=function(){var t=this.tok.type===e.tokTypes.name?this.tok.value:this.tok.type.keyword;if(!t)return this.dummyIdent();var s=this.startNode();return this.next(),s.name=t,this.finishNode(s,"Identifier")},h.initFunction=function(t){t.id=null,t.params=[],this.options.ecmaVersion>=6&&(t.generator=!1,t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},h.toAssignable=function(t,e){var s=this;if(!t||"Identifier"==t.type||"MemberExpression"==t.type&&!e);else if("ParenthesizedExpression"==t.type)t.expression=this.toAssignable(t.expression,e);else{if(this.options.ecmaVersion<6)return this.dummyIdent();if("ObjectExpression"==t.type){t.type="ObjectPattern";for(var i=t.properties,r=0;r<i.length;r++)i[r].value=s.toAssignable(i[r].value,e)}else if("ArrayExpression"==t.type)t.type="ArrayPattern",this.toAssignableList(t.elements,e);else if("SpreadElement"==t.type)t.type="RestElement",t.argument=this.toAssignable(t.argument,e);else{if("AssignmentExpression"!=t.type)return this.dummyIdent();t.type="AssignmentPattern",delete t.operator}}return t},h.toAssignableList=function(t,e){for(var s=this,i=0;i<t.length;i++)t[i]=s.toAssignable(t[i],e);return t},h.parseFunctionParams=function(t){return t=this.parseExprList(e.tokTypes.parenR),this.toAssignableList(t,!0)},h.parseMethod=function(t,s){var i=this.startNode(),r=this.inAsync;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=!!t),this.options.ecmaVersion>=8&&(i.async=!!s),this.inAsync=i.async,i.params=this.parseFunctionParams(),i.expression=this.options.ecmaVersion>=6&&this.tok.type!==e.tokTypes.braceL,i.body=i.expression?this.parseMaybeAssign():this.parseBlock(),this.inAsync=r,this.finishNode(i,"FunctionExpression")},h.parseArrowExpression=function(t,s,i){var r=this.inAsync;return this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!i),this.inAsync=t.async,t.params=this.toAssignableList(s,!0),t.expression=this.tok.type!==e.tokTypes.braceL,t.body=t.expression?this.parseMaybeAssign():this.parseBlock(),this.inAsync=r,this.finishNode(t,"ArrowFunctionExpression")},h.parseExprList=function(t,s){var r=this;this.pushCx();var o=this.curIndent,n=this.curLineStart,a=[];for(this.next();!this.closes(t,o+1,n);)if(r.eat(e.tokTypes.comma))a.push(s?null:r.dummyIdent());else{var p=r.parseMaybeAssign();if(i(p)){if(r.closes(t,o,n))break;r.next()}else a.push(p);r.eat(e.tokTypes.comma)}return this.popCx(),this.eat(t)||(this.last.end=this.tok.start,this.options.locations&&(this.last.loc.end=this.tok.loc.start)),a},h.parseAwait=function(){var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(),this.finishNode(t,"AwaitExpression")},e.defaultOptions.tabSize=4,e.addLooseExports(r,n,o),t.parse_dammit=r,t.LooseParser=n,t.pluginsLoose=o,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=acorn_loose.min.js.map