-
Notifications
You must be signed in to change notification settings - Fork 1
/
parcissus.min.js
2 lines (2 loc) · 46.2 KB
/
parcissus.min.js
1
2
!function t(e,i,s){function n(o,a){if(!i[o]){if(!e[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(r)return r(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[o]={exports:{}};e[o][0].call(c.exports,function(t){var i=e[o][1][t];return n(i?i:t)},c,c.exports,t,e,i,s)}return i[o].exports}for(var r="function"==typeof require&&require,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(require,module,exports){function defineGetter(t,e,i,s,n){Object.defineProperty(t,e,{get:i,configurable:!s,enumerable:!n})}function defineGetterSetter(t,e,i,s,n,r){Object.defineProperty(t,e,{get:i,set:s,configurable:!n,enumerable:!r})}function defineMemoGetter(t,e,i,s,n){Object.defineProperty(t,e,{get:function(){var r=i();return defineProperty(t,e,r,s,!0,n),r},configurable:!0,enumerable:!n})}function defineProperty(t,e,i,s,n,r){Object.defineProperty(t,e,{value:i,writable:!n,configurable:!s,enumerable:!r})}function isNativeCode(t){return"function"==typeof t&&t.toString().match(/\[native code\]/)}function apply(t,e,i){return Fpapply.call(t,[e].concat(i))}function getPropertyDescriptor(t,e){for(;t;){if({}.hasOwnProperty.call(t,e))return Object.getOwnPropertyDescriptor(t,e);t=Object.getPrototypeOf(t)}}function getPropertyNames(t){for(var e=Object.create(null,{});t;){for(var i=Object.getOwnPropertyNames(t),s=0,n=i.length;n>s;s++)e[i[s]]=!0;t=Object.getPrototypeOf(t)}return Object.keys(e)}function getOwnProperties(t){var e={};for(var i in Object.getOwnPropertyNames(t))e[i]=Object.getOwnPropertyDescriptor(t,i);return e}function blacklistHandler(t,e){var i=Object.create(null,{}),s=Dict.create(e).mapObject(function(){return i});return mixinHandler(s,t)}function whitelistHandler(t,e){var i=Object.create(null,{}),s=Dict.create(e).mapObject(function(){return t});return mixinHandler(s,i)}function mixinHandler(t,e){function i(i){return hasOwn(t,i)?t[i]:e}function s(t){var e=getPropertyDescriptor(i(t),t);return e&&(e.configurable=!0),e}function n(){var i=Object.getOwnPropertyNames(t).filter(function(e){return e in t[e]}),s=getPropertyNames(e).filter(function(e){return!hasOwn(t,e)});return i.concat(s)}function r(){var i=Object.getOwnPropertyNames(t).filter(function(e){return e in t[e]});for(name in e)hasOwn(t,name)||i.push(name);return i}function o(t){return t in i(t)}return{getOwnPropertyDescriptor:s,getPropertyDescriptor:s,getOwnPropertyNames:n,defineProperty:function(t,e){Object.defineProperty(i(t),t,e)},"delete":function(t){var e=i(t);return delete e[t]},fix:function(){},has:o,hasOwn:o,get:function(t,e){var s=i(e);return s[e]},set:function(t,e,s){var n=i(e);return n[e]=s,!0},enumerate:r,keys:r}}function makePassthruHandler(t){return{getOwnPropertyDescriptor:function(e){var i=Object.getOwnPropertyDescriptor(t,e);return i.configurable=!0,i},getPropertyDescriptor:function(e){var i=getPropertyDescriptor(t,e);return i.configurable=!0,i},getOwnPropertyNames:function(){return Object.getOwnPropertyNames(t)},defineProperty:function(e,i){Object.defineProperty(t,e,i)},"delete":function(e){return delete t[e]},fix:function(){return Object.isFrozen(t)?getOwnProperties(t):void 0},has:function(e){return e in t},hasOwn:function(e){return{}.hasOwnProperty.call(t,e)},get:function(e,i){return t[i]},set:function(e,i,s){return t[i]=s,!0},enumerate:function(){var e=[];for(name in t)e.push(name);return e},keys:function(){return Object.keys(t)}}}function hasOwn(t,e){return hasOwnProperty.call(t,e)}function Dict(t,e){this.table=t||Object.create(null,{}),this.size=e||0}function Stack(t){this.elts=t||null}for(var tokens=["END","\n",";",",","=","?",":","CONDITIONAL","||","&&","|","^","&","==","!=","===","!==","<","<=",">=",">","<<",">>",">>>","+","-","*","/","%","!","~","UNARY_PLUS","UNARY_MINUS","++","--",".","[","]","{","}","(",")","SCRIPT","BLOCK","LABEL","FOR_IN","CALL","NEW_WITH_ARGS","INDEX","ARRAY_INIT","OBJECT_INIT","PROPERTY_INIT","GETTER","SETTER","GROUP","LIST","LET_BLOCK","ARRAY_COMP","GENERATOR","COMP_TAIL","IMPLEMENTS","INTERFACE","LET","MODULE","PACKAGE","PRIVATE","PROTECTED","PUBLIC","STATIC","USE","YIELD","IDENTIFIER","NUMBER","STRING","REGEXP","break","case","catch","const","continue","debugger","default","delete","do","else","export","false","finally","for","function","if","import","in","instanceof","new","null","return","switch","this","throw","true","try","typeof","var","void","while","with"],strictKeywords={__proto__:null,"implements":!0,"interface":!0,let:!0,module:!0,"package":!0,"private":!0,"protected":!0,"public":!0,"static":!0,use:!0,"yield":!0},statementStartTokens=["break","const","continue","debugger","do","for","if","let","return","switch","throw","try","var","yield","while","with"],whitespaceChars=[" ","","\f"," "," ",""," ",""," "," "," "," "," "," "," "," "," "," "," "," "," "," "],whitespace={},i=0;i<whitespaceChars.length;i++)whitespace[whitespaceChars[i]]=!0;for(var opTypeNames={"\n":"NEWLINE",";":"SEMICOLON",",":"COMMA","?":"HOOK",":":"COLON","||":"OR","&&":"AND","|":"BITWISE_OR","^":"BITWISE_XOR","&":"BITWISE_AND","===":"STRICT_EQ","==":"EQ","=":"ASSIGN","!==":"STRICT_NE","!=":"NE","<<":"LSH","<=":"LE","<":"LT",">>>":"URSH",">>":"RSH",">=":"GE",">":"GT","++":"INCREMENT","--":"DECREMENT","+":"PLUS","-":"MINUS","*":"MUL","/":"DIV","%":"MOD","!":"NOT","~":"BITWISE_NOT",".":"DOT","[":"LEFT_BRACKET","]":"RIGHT_BRACKET","{":"LEFT_CURLY","}":"RIGHT_CURLY","(":"LEFT_PAREN",")":"RIGHT_PAREN"},keywords={__proto__:null},mozillaKeywords={__proto__:null},tokenIds={},hostSupportsEvalConst=function(){try{return eval("(function(s) { eval(s); return x })('const x = true;')")}catch(e){return!1}}(),consts=hostSupportsEvalConst?"const ":"var ",i=0,j=tokens.length;j>i;i++){i>0&&(consts+=", ");var t=tokens[i],name;/^[a-z]/.test(t)?(name=t.toUpperCase(),("LET"===name||"YIELD"===name)&&(mozillaKeywords[name]=i),strictKeywords[name]&&(strictKeywords[name]=i),keywords[t]=i):name=/^\W/.test(t)?opTypeNames[t]:t,consts+=name+" = "+i,tokenIds[name]=i,tokens[t]=i}consts+=";";var isStatementStartCode={__proto__:null};for(i=0,j=statementStartTokens.length;j>i;i++)isStatementStartCode[keywords[statementStartTokens[i]]]=!0;var assignOps=["|","^","&","<<",">>",">>>","+","-","*","/","%"];for(i=0,j=assignOps.length;j>i;i++)t=assignOps[i],assignOps[t]=tokens[t];var Fpapply=Function.prototype.apply,applyNew;applyNew=Function.prototype.bind?function(t,e){return new(t.bind.apply(t,[,].concat(Array.prototype.slice.call(e))))}:function applyNew(f,a){switch(a.length){case 0:return new f;case 1:return new f(a[0]);case 2:return new f(a[0],a[1]);case 3:return new f(a[0],a[1],a[2]);default:for(var argStr="a[0]",i=1,n=a.length;n>i;i++)argStr+=",a["+i+"]";return eval("new f("+argStr+")")}};var hasOwnProperty={}.hasOwnProperty;Dict.create=function(t){for(var e=Object.create(null,{}),i=0,s=Object.getOwnPropertyNames(t),n=0,r=s.length;r>n;n++){var o=s[n];e[o]=t[o],i++}return new Dict(e,i)},Dict.prototype={has:function(t){return hasOwnProperty.call(this.table,t)},set:function(t,e){hasOwnProperty.call(this.table,t)||this.size++,this.table[t]=e},get:function(t){return this.table[t]},getDef:function(t,e){return hasOwnProperty.call(this.table,t)||(this.size++,this.table[t]=e()),this.table[t]},forEach:function(t){var e=this.table;for(var i in e)t.call(this,i,e[i])},map:function(t){var e=(this.table,Object.create(null,{}));return this.forEach(function(i,s){e[i]=t.call(this,s,i)}),new Dict(e,this.size)},mapObject:function(t){var e=(this.table,Object.create(null,{}));return this.forEach(function(i,s){e[i]=t.call(this,s,i)}),e},toObject:function(){return this.mapObject(function(t){return t})},choose:function(){return Object.getOwnPropertyNames(this.table)[0]},remove:function(t){hasOwnProperty.call(this.table,t)&&(this.size--,delete this.table[t])},copy:function(){var t=Object.create(null,{});for(var e in this.table)t[e]=this.table[e];return new Dict(t,this.size)},keys:function(){return Object.keys(this.table)},toString:function(){return"[object Dict]"}};var _WeakMap="function"==typeof WeakMap?WeakMap:function(){function t(t){this.array=t||[]}function e(t,e,i,s){for(var n=t.array,r=0,o=n.length;o>r;r++){var a=n[r];if(a.key===e)return i(a,r)}return s()}return t.prototype={has:function(t){return e(this,t,function(){return!0},function(){return!1})},set:function(t,i){var s=this.array;e(this,t,function(t){t.value=i},function(){s.push({key:t,value:i})})},get:function(t){return e(this,t,function(t){return t.value},function(){return null})},"delete":function(t){var i=this.array;e(this,t,function(t,e){i.splice(e,1)},function(){})},toString:function(){return"[object WeakMap]"}},t}();Stack.prototype={push:function(t){return new Stack({top:t,rest:this.elts})},top:function(){if(!this.elts)throw new Error("empty stack");return this.elts.top},isEmpty:function(){return null===this.top},find:function(t){for(var e=this.elts;e;e=e.rest)if(t(e.top))return e.top;return null},has:function(t){return Boolean(this.find(function(e){return e===t}))},forEach:function(t){for(var e=this.elts;e;e=e.rest)t(e.top)}},Array.prototype.copy||defineProperty(Array.prototype,"copy",function(){for(var t=[],e=0,i=this.length;i>e;e++)t[e]=this[e];return t},!1,!1,!0),Array.prototype.top||defineProperty(Array.prototype,"top",function(){return this.length&&this[this.length-1]},!1,!1,!0),exports.tokens=tokens,exports.whitespace=whitespace,exports.opTypeNames=opTypeNames,exports.keywords=keywords,exports.mozillaKeywords=mozillaKeywords,exports.strictKeywords=strictKeywords,exports.isStatementStartCode=isStatementStartCode,exports.tokenIds=tokenIds,exports.consts=consts,exports.assignOps=assignOps,exports.defineGetter=defineGetter,exports.defineGetterSetter=defineGetterSetter,exports.defineMemoGetter=defineMemoGetter,exports.defineProperty=defineProperty,exports.isNativeCode=isNativeCode,exports.apply=apply,exports.applyNew=applyNew,exports.mixinHandler=mixinHandler,exports.whitelistHandler=whitelistHandler,exports.blacklistHandler=blacklistHandler,exports.makePassthruHandler=makePassthruHandler,exports.Dict=Dict,exports.WeakMap=_WeakMap,exports.Stack=Stack},{}],2:[function(require,module,exports){function isValidIdentifierChar(t,e){if("">=t)return t>="a"&&"z">=t||t>="A"&&"Z">=t||"$"===t||"_"===t||!e&&t>="0"&&"9">=t?!0:!1;var i={};i["x"+t]=!0,i[t]=!0;var s=!1;try{s=Function("x","return (x."+(e?"":"x")+t+");")(i)===!0}catch(n){}return s}function isIdentifier(t){if("string"!=typeof t)return!1;if(0===t.length)return!1;if(!isValidIdentifierChar(t[0],!0))return!1;for(var e=1;e<t.length;e++)if(!isValidIdentifierChar(t[e],!1))return!1;return!0}function Tokenizer(t,e,i,s){this.cursor=0,this.source=String(t),this.tokens=[],this.tokenIndex=0,this.lookahead=0,this.scanNewlines=!1,this.filename=e||"",this.lineno=i||1,this.allowHTMLComments=s,this.blockComments=null}var definitions=require("./definitions");eval(definitions.consts);var opTokens={};for(var op in definitions.opTypeNames)if("\n"!==op&&"."!==op)for(var node=opTokens,i=0;i<op.length;i++){var ch=op[i];ch in node||(node[ch]={}),node=node[ch],node.op=op}Tokenizer.prototype={get done(){return this.peek(!0)===END},get token(){return this.tokens[this.tokenIndex]},match:function(t,e,i){return this.get(e,i)===t||this.unget()},mustMatch:function(t,e){if(!this.match(t,!1,e))throw this.newSyntaxError("Missing "+definitions.tokens[t].toLowerCase());return this.token},peek:function(t){var e,i;return this.lookahead?(i=this.tokens[this.tokenIndex+this.lookahead&3],e=this.scanNewlines&&i.lineno!==this.lineno?NEWLINE:i.type):(e=this.get(t),this.unget()),e},peekOnSameLine:function(t){this.scanNewlines=!0;var e=this.peek(t);return this.scanNewlines=!1,e},lastBlockComment:function(){var t=this.blockComments.length;return t?this.blockComments[t-1]:null},skip:function(){var t=this.source;for(this.blockComments=[];;){var e=t[this.cursor++],i=t[this.cursor];if("\r"===e){if("\n"===i)continue;e="\n"}if("\n"!==e||this.scanNewlines){if("/"===e&&"*"===i){for(var s=++this.cursor;;){if(e=t[this.cursor++],void 0===e)throw this.newSyntaxError("Unterminated comment");if("*"===e){if(i=t[this.cursor],"/"===i){var n=this.cursor-1;this.cursor++;break}}else"\n"===e&&this.lineno++}this.blockComments.push(t.substring(s,n))}else if("/"===e&&"/"===i||this.allowHTMLComments&&"<"===e&&"!"===i&&"-"===t[this.cursor+1]&&"-"===t[this.cursor+2]&&(this.cursor+=2))for(this.cursor++;;){if(e=t[this.cursor++],i=t[this.cursor],void 0===e)return;if("\r"===e&&"\n"!==i&&(e="\n"),"\n"===e){this.scanNewlines?this.cursor--:this.lineno++;break}}else if(!(e in definitions.whitespace))return void this.cursor--}else this.lineno++}},lexExponent:function(){var t=this.source,e=t[this.cursor];if("e"===e||"E"===e){if(this.cursor++,ch=t[this.cursor++],("+"===ch||"-"===ch)&&(ch=t[this.cursor++]),"0">ch||ch>"9")throw this.newSyntaxError("Missing exponent");do ch=t[this.cursor++];while(ch>="0"&&"9">=ch);return this.cursor--,!0}return!1},lexZeroNumber:function(t){var e=this.token,i=this.source;if(e.type=NUMBER,t=i[this.cursor++],"."===t){do t=i[this.cursor++];while(t>="0"&&"9">=t);this.cursor--,this.lexExponent(),e.value=parseFloat(i.substring(e.start,this.cursor))}else if("x"===t||"X"===t){do t=i[this.cursor++];while(t>="0"&&"9">=t||t>="a"&&"f">=t||t>="A"&&"F">=t);this.cursor--,e.value=parseInt(i.substring(e.start,this.cursor))}else if(t>="0"&&"7">=t){do t=i[this.cursor++];while(t>="0"&&"7">=t);this.cursor--,e.value=parseInt(i.substring(e.start,this.cursor))}else this.cursor--,this.lexExponent(),e.value=0},lexNumber:function(t){var e=this.token,i=this.source;e.type=NUMBER;var s=!1;do t=i[this.cursor++],"."!==t||s||(s=!0,t=i[this.cursor++]);while(t>="0"&&"9">=t);this.cursor--;var n=this.lexExponent();s=s||n;var r=i.substring(e.start,this.cursor);e.value=s?parseFloat(r):parseInt(r)},lexDot:function(t){var e=this.token,i=this.source,s=i[this.cursor];if(s>="0"&&"9">=s){do t=i[this.cursor++];while(t>="0"&&"9">=t);this.cursor--,this.lexExponent(),e.type=NUMBER,e.value=parseFloat(i.substring(e.start,this.cursor))}else e.type=DOT,e.assignOp=null,e.value="."},lexString:function(ch){var token=this.token,input=this.source;token.type=STRING;var hasEscapes=!1,delim=ch;if(input.length<=this.cursor)throw this.newSyntaxError("Unterminated string literal");for(;(ch=input[this.cursor++])!==delim;){if(this.cursor==input.length)throw this.newSyntaxError("Unterminated string literal");if("\\"===ch&&(hasEscapes=!0,++this.cursor==input.length))throw this.newSyntaxError("Unterminated string literal")}token.value=hasEscapes?eval(input.substring(token.start,this.cursor)):input.substring(token.start+1,this.cursor-1)},lexRegExp:function(ch){var token=this.token,input=this.source;token.type=REGEXP;do if(ch=input[this.cursor++],"\\"===ch)this.cursor++;else if("["===ch){do{if(void 0===ch)throw this.newSyntaxError("Unterminated character class");"\\"===ch&&this.cursor++,ch=input[this.cursor++]}while("]"!==ch)}else if(void 0===ch)throw this.newSyntaxError("Unterminated regex");while("/"!==ch);do ch=input[this.cursor++];while(ch>="a"&&"z">=ch);this.cursor--,token.value=eval(input.substring(token.start,this.cursor))},lexOp:function(t){var e=this.token,i=this.source,s=opTokens[t],n=i[this.cursor];n in s&&(s=s[n],this.cursor++,n=i[this.cursor],n in s&&(s=s[n],this.cursor++,n=i[this.cursor]));var r=s.op;definitions.assignOps[r]&&"="===i[this.cursor]?(this.cursor++,e.type=ASSIGN,e.assignOp=definitions.tokenIds[definitions.opTypeNames[r]],r+="="):(e.type=definitions.tokenIds[definitions.opTypeNames[r]],e.assignOp=null),e.value=r},lexIdent:function(t,e){for(var i=this.token,s=t;null!==(t=this.getValidIdentifierChar(!1));)s+=t;if(i.type=IDENTIFIER,i.value=s,!e){var n;if(this.parser.mozillaMode&&(n=definitions.mozillaKeywords[s]))return void(i.type=n);if(this.parser.x.strictMode&&(n=definitions.strictKeywords[s]))return void(i.type=n);n=definitions.keywords[s],n&&(i.type=n)}},get:function(t,e){for(var i;this.lookahead;)if(--this.lookahead,this.tokenIndex=this.tokenIndex+1&3,i=this.tokens[this.tokenIndex],i.type!==NEWLINE||this.scanNewlines)return i.type;this.skip(),this.tokenIndex=this.tokenIndex+1&3,i=this.tokens[this.tokenIndex],i||(this.tokens[this.tokenIndex]=i={});var s=this.source;if(this.cursor>=s.length)return i.type=END;i.start=this.cursor,i.lineno=this.lineno;var n=this.getValidIdentifierChar(!0),r=null===n?s[this.cursor++]:null;if(null!==n)this.lexIdent(n,e);else if(t&&"/"===r)this.lexRegExp(r);else if(r in opTokens)this.lexOp(r);else if("."===r)this.lexDot(r);else if(r>="1"&&"9">=r)this.lexNumber(r);else if("0"===r)this.lexZeroNumber(r);else if('"'===r||"'"===r)this.lexString(r);else{if(!this.scanNewlines||"\n"!==r&&"\r"!==r)throw this.newSyntaxError("Illegal token");"\r"===r&&"\n"===s[this.cursor]&&this.cursor++,i.type=NEWLINE,i.value="\n",this.lineno++}return i.end=this.cursor,i.type},unget:function(){if(4===++this.lookahead)throw"PANIC: too much lookahead!";this.tokenIndex=this.tokenIndex-1&3},newSyntaxError:function(t){t=(this.filename?this.filename+":":"")+this.lineno+": "+t;var e=new SyntaxError(t,this.filename,this.lineno);return e.source=this.source,e.cursor=this.lookahead?this.tokens[this.tokenIndex+this.lookahead&3].start:this.cursor,e},getValidIdentifierChar:function(t){var e=this.source;if(this.cursor>=e.length)return null;var i=e[this.cursor];if("\\"===i&&"u"===e[this.cursor+1]){try{i=String.fromCharCode(parseInt(e.substring(this.cursor+2,this.cursor+6),16))}catch(s){return null}this.cursor+=5}var n=isValidIdentifierChar(i,t);return n&&this.cursor++,n?i:null}},exports.isIdentifier=isIdentifier,exports.Tokenizer=Tokenizer},{"./definitions":1}],3:[function(t){window.parcissus=t("./parser")},{"./parser":5}],4:[function(t,e,i){i.hiddenHostGlobals={Narcissus:!0},i.desugarExtensions=!1,i.allowHTMLComments=!1,i.mozillaMode=!0,i.parenFreeMode=!1},{}],5:[function(require,module,exports){function pushDestructuringVarDecls(t,e){for(var i in t){var s=t[i];s.type===IDENTIFIER?e.varDecls.push(s):pushDestructuringVarDecls(s,e)}}function Parser(t){t.parser=this,this.t=t,this.x=null,this.unexpectedEOF=!1,options.mozillaMode&&(this.mozillaMode=!0),options.parenFreeMode&&(this.parenFreeMode=!0)}function StaticContext(t,e,i,s,n){this.parentScript=t,this.parentBlock=e||t,this.inModule=i||!1,this.inFunction=s||!1,this.inForLoopInit=!1,this.topLevel=!0,this.allLabels=new Stack,this.currentLabels=new Stack,this.labeledTargets=new Stack,this.defaultLoopTarget=null,this.defaultTarget=null,this.strictMode=n}function Pragma(t){if(t.type===SEMICOLON){var e=t.expression;if(e.type===STRING&&"use strict"===e.value)return t.pragma="strict",!0}return!1}function Node(t,e){var i=t.token;i?(this.type=i.type,this.value=i.value,this.lineno=i.lineno,this.start=i.start,this.end=i.end):this.lineno=t.lineno,this.filename=t.filename,this.children=[];for(var s in e)this[s]=e[s]}function SyntheticNode(t){this.children=[];for(var e in t)this[e]=t[e];this.synthetic=!0}function unevalableConst(t){var e=definitions.tokens[t],i=definitions.opTypeNames.hasOwnProperty(e)?definitions.opTypeNames[e]:e in definitions.keywords?e.toUpperCase():e;return{toSource:function(){return i}}}function tokenString(t){var e=definitions.tokens[t];return/^\W/.test(e)?definitions.opTypeNames[e]:e.toUpperCase()}function blockInit(){return{type:BLOCK,varDecls:[]}}function scriptInit(){return{type:SCRIPT,funDecls:[],varDecls:[],modDefns:new Dict,modAssns:new Dict,modDecls:new Dict,modLoads:new Dict,impDecls:[],expDecls:[],exports:new Dict,hasEmptyReturn:!1,hasReturnWithValue:!1,hasYield:!1}}function Export(t,e){this.node=t,this.isDefinition=e,this.resolved=null}function registerExport(t,e){function i(e,i){if(t.has(e))throw new SyntaxError("multiple exports of "+e);t.set(e,i)}switch(e.type){case MODULE:case FUNCTION:i(e.name,new Export(e,!0));break;case VAR:for(var s=0;s<e.children.length;s++)i(e.children[s].name,new Export(e.children[s],!0));break;case LET:case CONST:throw new Error("NYI: "+definitions.tokens[e.type]);case EXPORT:for(var s=0;s<e.pathList.length;s++){var n=e.pathList[s];switch(n.type){case OBJECT_INIT:for(var r=0;r<n.children.length;r++){var o=n.children[r];o.type===IDENTIFIER?i(o.value,new Export(o,!1)):i(o.children[0].value,new Export(o.children[1],!1))}break;case DOT:i(n.children[1].value,new Export(n,!1));break;case IDENTIFIER:i(n.value,new Export(n,!1));break;default:throw new Error("unexpected export path: "+definitions.tokens[n.type])}}break;default:throw new Error("unexpected export decl: "+definitions.tokens[exp.type])}}function Module(t){var e=t.body.exports,i=t.body.modDefns,s=new Dict;e.forEach(function(t,e){var n=e.node;if(n.type===MODULE)s.set(t,n);else if(!e.isDefinition&&n.type===IDENTIFIER&&i.has(n.value)){var r=i.get(n.value);s.set(t,r)}}),this.node=t,this.exports=e,this.exportedModules=s}function isPragmaToken(t){switch(t){case IDENTIFIER:case STRING:case NUMBER:case NULL:case TRUE:case FALSE:return!0}return!1}function parse(t,e,i){var s=new Tokenizer(t,e,i,options.allowHTMLComments),n=new Parser(s);return n.Script(!1,!1,!0)}function parseFunction(t,e,i,s,n){var r=new Tokenizer(t,s,n),o=new Parser(r);return o.x=new StaticContext(null,null,!1,!1,!1),o.FunctionDefinition(e,i)}function parseStdin(t,e,i,s){if(t.match(/^[\s]*\.begin[\s]*$/))return++e.value,parseMultiline(e,i);for(s(t.trim())&&(t="");;)try{var n=new Tokenizer(t,"stdin",e.value,!1),r=new Parser(n),o=r.Script(!1,!1);return e.value=n.lineno,o}catch(a){if(!r.unexpectedEOF)throw a;var h;do if(i&&putstr(i),h=readline(),!h)throw a;while(s(h.trim()));t+="\n"+h}}function parseMultiline(t,e){for(var i="";;){e&&putstr(e);var s=readline();if(null===s)return null;if(s.match(/^[\s]*\.end[\s]*$/))break;i+="\n"+s}var n=new Tokenizer(i,"stdin",t.value,!1),r=new Parser(n),o=r.Script(!1,!1);return t.value=n.lineno,o}var lexer=require("./lexer"),definitions=require("./definitions"),options=require("./options"),Tokenizer=lexer.Tokenizer;const Dict=definitions.Dict,Stack=definitions.Stack;eval(definitions.consts),StaticContext.prototype={update:function(t){var e={};for(var i in t)e[i]={value:t[i],writable:!0,enumerable:!0,configurable:!0};return Object.create(this,e)},pushLabel:function(t){return this.update({currentLabels:this.currentLabels.push(t),allLabels:this.allLabels.push(t)})},pushTarget:function(t){var e=t.isLoop,i=e||t.type===SWITCH;return this.currentLabels.isEmpty()?(e&&this.update({defaultLoopTarget:t}),i&&this.update({defaultTarget:t}),this):(t.labels=new Dict,this.currentLabels.forEach(function(e){t.labels.set(e,!0)}),this.update({currentLabels:new Stack,labeledTargets:this.labeledTargets.push(t),defaultLoopTarget:e?t:this.defaultLoopTarget,defaultTarget:i?t:this.defaultTarget}))},nest:function(){return this.topLevel?this.update({topLevel:!1}):this},canImport:function(){return this.topLevel&&!this.inFunction},canExport:function(){return this.inModule&&this.topLevel&&!this.inFunction},banWith:function(){return this.strictMode||this.inModule},modulesAllowed:function(){return this.topLevel&&!this.inFunction}};var Pp=Parser.prototype;Pp.mozillaMode=!1,Pp.parenFreeMode=!1,Pp.withContext=function(t,e){var i=this.x;this.x=t;var s=e.call(this);return this.x=i,s},Pp.newNode=function(t){return new Node(this.t,t)},Pp.fail=function(t){throw this.t.newSyntaxError(t)},Pp.match=function(t,e,i){return this.t.match(t,e,i)},Pp.mustMatch=function(t,e){return this.t.mustMatch(t,e)},Pp.peek=function(t){return this.t.peek(t)},Pp.peekOnSameLine=function(t){return this.t.peekOnSameLine(t)},Pp.done=function(){return this.t.done},Pp.Script=function(t,e,i){var s=this.newNode(scriptInit()),n=new StaticContext(s,s,t,e);return this.withContext(n,function(){this.Statements(s,!0)}),i&&!this.done()&&this.fail("expected end of input"),s};var Np=Node.prototype=SyntheticNode.prototype={};Np.constructor=Node;const TO_SOURCE_SKIP={type:!0,value:!0,lineno:!0,start:!0,end:!0,tokenizer:!0,assignOp:!0};Np.toSource=function(){var t={};if(t.type=unevalableConst(this.type),this.generatingSource)return t.toSource();this.generatingSource=!0,"value"in this&&(t.value=this.value),"lineno"in this&&(t.lineno=this.lineno),"start"in this&&(t.start=this.start),"end"in this&&(t.end=this.end),this.assignOp&&(t.assignOp=unevalableConst(this.assignOp));for(var e in this)!this.hasOwnProperty(e)||e in TO_SOURCE_SKIP||(t[e]=this[e]);try{return t.toSource()}finally{delete this.generatingSource}},Np.push=function(t){return null!==t&&(t.start<this.start&&(this.start=t.start),this.end<t.end&&(this.end=t.end)),this.children.push(t)},Node.indentLevel=0,Np.toString=function(){var t=[];for(var e in this)this.hasOwnProperty(e)&&"type"!==e&&"target"!==e&&t.push({id:e,value:this[e]});t.sort(function(t,e){return t.id<e.id?-1:1});const i=" ";var s=++Node.indentLevel,n="{\n"+i.repeat(s)+"type: "+tokenString(this.type);for(e=0;e<t.length;e++)n+=",\n"+i.repeat(s)+t[e].id+": "+t[e].value;return s=--Node.indentLevel,n+="\n"+i.repeat(s)+"}"},Np.synth=function(t){var e=new SyntheticNode(t);return e.filename=this.filename,e.lineno=this.lineno,e.start=this.start,e.end=this.end,e};const LOOP_INIT={isLoop:!0};definitions.defineGetter(Np,"length",function(){throw new Error("Node.prototype.length is gone; use n.children.length instead")}),definitions.defineProperty(String.prototype,"repeat",function(t){for(var e="",i=this+e;--t>=0;)e+=i;return e},!1,!1,!0),Pp.MaybeLeftParen=function(){return this.parenFreeMode?this.match(LEFT_PAREN)?LEFT_PAREN:END:this.mustMatch(LEFT_PAREN).type},Pp.MaybeRightParen=function(t){t===LEFT_PAREN&&this.mustMatch(RIGHT_PAREN)},Pp.Statements=function(t,e){var i=!!e;try{for(;!this.done()&&this.peek(!0)!==RIGHT_CURLY;){var s=this.Statement();t.push(s),i&&Pragma(s)?(this.x.strictMode=!0,t.strict=!0):i=!1}}catch(n){throw this.done()&&(this.unexpectedEOF=!0),n}},Pp.Block=function(){this.mustMatch(LEFT_CURLY);var t=this.newNode(blockInit()),e=this.x.update({parentBlock:t}).pushTarget(t);return this.withContext(e,function(){this.Statements(t)}),this.mustMatch(RIGHT_CURLY),t};const DECLARED_FORM=0,EXPRESSED_FORM=1,STATEMENT_FORM=2;Pp.Statement=function(){var t,e,i,s,n,r,o,a,h=this.t.get(!0),u=this.t.blockComments;switch(h){case IMPORT:this.x.canImport()||this.fail("illegal context for import statement"),e=this.newNode(),e.pathList=this.ImportPathList(),this.x.parentScript.impDecls.push(e);break;case EXPORT:switch(this.x.canExport()||this.fail("export statement not in module top level"),this.peek()){case MODULE:case FUNCTION:case LET:case VAR:case CONST:return e=this.Statement(),e.blockComments=u,e.exported=!0,this.x.parentScript.expDecls.push(e),registerExport(this.x.parentScript.exports,e),e}e=this.newNode(),e.pathList=this.ExportPathList(),this.x.parentScript.expDecls.push(e),registerExport(this.x.parentScript.exports,e);break;case FUNCTION:return this.FunctionDefinition(!0,this.x.topLevel?DECLARED_FORM:STATEMENT_FORM,u);case LEFT_CURLY:return e=this.newNode(blockInit()),o=this.x.update({parentBlock:e}).pushTarget(e).nest(),this.withContext(o,function(){this.Statements(e)}),this.mustMatch(RIGHT_CURLY),e;case IF:return e=this.newNode(),e.condition=this.HeadExpression(),o=this.x.pushTarget(e).nest(),this.withContext(o,function(){e.thenPart=this.Statement(),e.elsePart=this.match(ELSE,!0)?this.Statement():null}),e;case SWITCH:return e=this.newNode({cases:[],defaultIndex:-1}),e.discriminant=this.HeadExpression(),o=this.x.pushTarget(e).nest(),this.withContext(o,function(){for(this.mustMatch(LEFT_CURLY);(h=this.t.get())!==RIGHT_CURLY;){switch(h){case DEFAULT:e.defaultIndex>=0&&this.fail("More than one switch default");case CASE:i=this.newNode(),h===DEFAULT?e.defaultIndex=e.cases.length:i.caseLabel=this.Expression(COLON);break;default:this.fail("Invalid switch case")}for(this.mustMatch(COLON),i.statements=this.newNode(blockInit());(h=this.peek(!0))!==CASE&&h!==DEFAULT&&h!==RIGHT_CURLY;)i.statements.push(this.Statement());e.cases.push(i)}}),e;case FOR:return e=this.newNode(LOOP_INIT),e.blockComments=u,this.match(IDENTIFIER)&&("each"===this.t.token.value?e.isEach=!0:this.t.unget()),this.parenFreeMode||this.mustMatch(LEFT_PAREN),o=this.x.pushTarget(e).nest(),a=this.x.update({inForLoopInit:!0}),i=null,(h=this.peek(!0))!==SEMICOLON&&this.withContext(a,function(){h===VAR||h===CONST?(this.t.get(),i=this.Variables()):h===LET?(this.t.get(),this.peek()===LEFT_PAREN?i=this.LetBlock(!1):(this.x.parentBlock=e,e.varDecls=[],i=this.Variables())):i=this.Expression()}),i&&this.match(IN)?(e.type=FOR_IN,this.withContext(a,function(){if(e.object=this.Expression(),i.type===VAR||i.type===LET){if(n=i.children,1!==n.length&&1!==i.destructurings.length)throw new SyntaxError("Invalid for..in left-hand side",this.filename,i.lineno);e.iterator=i.destructurings.length>0?i.destructurings[0]:n[0],e.varDecl=i}else(i.type===ARRAY_INIT||i.type===OBJECT_INIT)&&(i.destructuredNames=this.checkDestructuring(i)),e.iterator=i})):(a.inForLoopInit=!1,e.setup=i,this.mustMatch(SEMICOLON),e.isEach&&this.fail("Invalid for each..in loop"),this.withContext(a,function(){e.condition=this.peek(!0)===SEMICOLON?null:this.Expression(),this.mustMatch(SEMICOLON),r=this.peek(!0),e.update=(this.parenFreeMode?r===LEFT_CURLY||definitions.isStatementStartCode[r]:r===RIGHT_PAREN)?null:this.Expression()})),this.parenFreeMode||this.mustMatch(RIGHT_PAREN),this.withContext(o,function(){e.body=this.Statement()}),e;case WHILE:return e=this.newNode({isLoop:!0}),e.blockComments=u,e.condition=this.HeadExpression(),o=this.x.pushTarget(e).nest(),this.withContext(o,function(){e.body=this.Statement()}),e;case DO:return e=this.newNode({isLoop:!0}),e.blockComments=u,o=this.x.pushTarget(e).next(),this.withContext(o,function(){e.body=this.Statement()}),this.mustMatch(WHILE),e.condition=this.HeadExpression(),this.match(SEMICOLON),e;case BREAK:case CONTINUE:e=this.newNode(),e.blockComments=u,o=this.x.pushTarget(e),this.peekOnSameLine()===IDENTIFIER&&(this.t.get(),e.label=this.t.token.value),e.target=e.label?o.labeledTargets.find(function(t){return t.labels.has(e.label)}):h===CONTINUE?o.defaultLoopTarget:o.defaultTarget,e.target||this.fail("Invalid "+(h===BREAK?"break":"continue")),e.target.isLoop||h!==CONTINUE||this.fail("Invalid continue");break;case TRY:for(e=this.newNode({catchClauses:[]}),e.blockComments=u,e.tryBlock=this.Block();this.match(CATCH);){switch(i=this.newNode(),s=this.MaybeLeftParen(),this.t.get()){case LEFT_BRACKET:case LEFT_CURLY:this.t.unget(),i.varName=this.DestructuringExpression(!0);break;case IDENTIFIER:i.varName=this.t.token.value;break;default:this.fail("missing identifier in catch")}this.match(IF)&&(this.mozillaMode||this.fail("Illegal catch guard"),e.catchClauses.length&&!e.catchClauses.top().guard&&this.fail("Guarded catch after unguarded"),i.guard=this.Expression()),this.MaybeRightParen(s),i.block=this.Block(),e.catchClauses.push(i)}return this.match(FINALLY)&&(e.finallyBlock=this.Block()),e.catchClauses.length||e.finallyBlock||this.fail("Invalid try statement"),e;case CATCH:case FINALLY:this.fail(definitions.tokens[h]+" without preceding try");case THROW:e=this.newNode(),e.exception=this.Expression();break;case RETURN:e=this.ReturnOrYield();break;case WITH:return this.x.banWith()&&this.fail("with statements not allowed in strict code or modules"),e=this.newNode(),e.blockComments=u,e.object=this.HeadExpression(),o=this.x.pushTarget(e).next(),this.withContext(o,function(){e.body=this.Statement()}),e;case VAR:case CONST:e=this.Variables();break;case LET:if(this.peek()===LEFT_PAREN)return e=this.LetBlock(!0);e=this.Variables();break;case DEBUGGER:e=this.newNode();break;case NEWLINE:case SEMICOLON:return e=this.newNode({type:SEMICOLON}),e.blockComments=u,e.expression=null,e;case IDENTIFIER:case USE:case MODULE:switch(this.t.token.value){case"use":if(!isPragmaToken(this.peekOnSameLine())){this.t.unget();break}return this.newNode({type:USE,params:this.Pragmas()});case"module":if(this.x.modulesAllowed()||this.fail("module declaration not at top level"),this.x.parentScript.hasModules=!0,h=this.peekOnSameLine(),h!==IDENTIFIER&&h!==LEFT_CURLY){this.t.unget();break}return e=this.newNode({type:MODULE}),e.blockComments=u,this.mustMatch(IDENTIFIER),t=this.t.token.value,this.match(LEFT_CURLY)?(e.name=t,e.body=this.Script(!0,!1),e.module=new Module(e),this.mustMatch(RIGHT_CURLY),this.x.parentScript.modDefns.set(e.name,e),e):(this.t.unget(),this.ModuleVariables(e),e);
default:if(h=this.peek(),h===COLON)return t=this.t.token.value,this.x.allLabels.has(t)&&this.fail("Duplicate label: "+t),this.t.get(),e=this.newNode({type:LABEL,label:t}),e.blockComments=u,o=this.x.pushLabel(t).nest(),this.withContext(o,function(){e.statement=this.Statement()}),e.target=e.statement.type===LABEL?e.statement.target:e.statement,e}default:e=this.newNode({type:SEMICOLON}),this.t.unget(),e.blockComments=u,e.expression=this.Expression(),e.end=e.expression.end}return e.blockComments=u,this.MagicalSemicolon(),e},Pp.Pragmas=function(){var t=[];do t.push(this.Pragma());while(this.match(COMMA));return this.MagicalSemicolon(),t},Pp.Pragma=function(){var t,e=[];do t=this.t.get(!0),e.push(this.t.token);while(isPragmaToken(this.peek()));return e},Pp.MagicalSemicolon=function(){var t;this.t.lineno===this.t.token.lineno&&(t=this.peekOnSameLine(),t!==END&&t!==NEWLINE&&t!==SEMICOLON&&t!==RIGHT_CURLY&&this.fail("missing ; before statement")),this.match(SEMICOLON)},Pp.ReturnOrYield=function(){var t,e,i=this.t.token.type,s=this.x.parentScript;return i===RETURN?this.x.inFunction||this.fail("Return not in function"):(this.x.inFunction||this.fail("Yield not in function"),s.hasYield=!0),t=this.newNode({value:void 0}),e=i===RETURN?this.peekOnSameLine(!0):this.peek(!0),e!==END&&e!==NEWLINE&&e!==SEMICOLON&&e!==RIGHT_CURLY&&(i!==YIELD||e!==i&&e!==RIGHT_BRACKET&&e!==RIGHT_PAREN&&e!==COLON&&e!==COMMA)?i===RETURN?(t.value=this.Expression(),s.hasReturnWithValue=!0):t.value=this.AssignExpression():i===RETURN&&(s.hasEmptyReturn=!0),t},Pp.ModuleExpression=function(){return this.match(STRING)?this.newNode():this.QualifiedPath()},Pp.ImportPathList=function(){var t=[];do t.push(this.ImportPath());while(this.match(COMMA));return t},Pp.ImportPath=function(){var t=this.QualifiedPath();if(!this.match(DOT))return t.type===IDENTIFIER&&this.fail("cannot import local variable"),t;var e=this.newNode();return e.push(t),e.push(this.ImportSpecifierSet()),e},Pp.ExplicitSpecifierSet=function(t){var e,i,s;if(e=this.newNode({type:OBJECT_INIT}),this.mustMatch(LEFT_CURLY),!this.match(RIGHT_CURLY))do s=this.Identifier(),this.match(COLON)?(i=this.newNode({type:PROPERTY_INIT}),i.push(s),i.push(t()),e.push(i)):e.push(s);while(!this.match(RIGHT_CURLY)&&this.mustMatch(COMMA));return e},Pp.ImportSpecifierSet=function(){var t=this;return this.match(MUL)?this.newNode({type:IDENTIFIER,name:"*"}):ExplicitSpecifierSet(function(){return t.Identifier()})},Pp.Identifier=function(){return this.mustMatch(IDENTIFIER),this.newNode({type:IDENTIFIER})},Pp.IdentifierName=function(){return this.mustMatch(IDENTIFIER,!0),this.newNode({type:IDENTIFIER})},Pp.QualifiedPath=function(){var t,e;for(t=this.Identifier();this.match(DOT);){if(this.peek()!==IDENTIFIER){this.t.unget();break}e=this.newNode(),e.push(t),e.push(this.Identifier()),t=e}return t},Pp.ExportPath=function(){var t=this;return this.peek()===LEFT_CURLY?this.ExplicitSpecifierSet(function(){return t.QualifiedPath()}):this.QualifiedPath()},Pp.ExportPathList=function(){var t=[];do t.push(this.ExportPath());while(this.match(COMMA));return t},Pp.FunctionDefinition=function(t,e,i){var s,n=this.newNode({params:[],paramComments:[]});"undefined"==typeof i&&(i=null),n.blockComments=i,n.type!==FUNCTION&&(n.type="get"===n.value?GETTER:SETTER),this.match(MUL)&&(n.isExplicitGenerator=!0),this.match(IDENTIFIER,!1,!0)?n.name=this.t.token.value:t&&this.fail("missing function identifier");var r=this.x.inModule;return x2=new StaticContext(null,null,r,!0,this.x.strictMode),this.withContext(x2,function(){if(this.mustMatch(LEFT_PAREN),!this.match(RIGHT_PAREN)){do switch(s=this.t.get(),n.paramComments.push(this.t.lastBlockComment()),s){case LEFT_BRACKET:case LEFT_CURLY:this.t.unget(),n.params.push(this.DestructuringExpression());break;case IDENTIFIER:n.params.push(this.t.token.value);break;default:this.fail("missing formal parameter")}while(this.match(COMMA));this.mustMatch(RIGHT_PAREN)}s=this.t.get(!0),s!==LEFT_CURLY&&this.t.unget(),n.body=s!==LEFT_CURLY?this.AssignExpression():this.Script(r,!0)}),s===LEFT_CURLY&&this.mustMatch(RIGHT_CURLY),n.end=this.t.token.end,n.functionForm=e,e===DECLARED_FORM&&this.x.parentScript.funDecls.push(n),this.x.inModule&&!n.isExplicitGenerator&&n.body.hasYield&&this.fail("yield in non-generator function"),(n.isExplicitGenerator||n.body.hasYield)&&(n.body=this.newNode({type:GENERATOR,body:n.body})),n},Pp.ModuleVariables=function(t){var e,i;do e=this.Identifier(),this.match(ASSIGN)&&(i=this.ModuleExpression(),e.initializer=i,i.type===STRING?this.x.parentScript.modLoads.set(e.value,i.value):this.x.parentScript.modAssns.set(e.value,e)),t.push(e);while(this.match(COMMA))},Pp.Variables=function(t){var e,i,s,n;switch(n=this.t.token.type){case VAR:case CONST:s=this.x.parentScript;break;case LET:s=this.x.parentBlock;break;case LEFT_PAREN:n=LET,s=t}e=this.newNode({type:n,destructurings:[]});do if(n=this.t.get(),n!==LEFT_BRACKET&&n!==LEFT_CURLY){if(n!==IDENTIFIER&&this.fail("missing variable name"),i=this.newNode({type:IDENTIFIER,name:this.t.token.value,readOnly:e.type===CONST}),e.push(i),s.varDecls.push(i),this.match(ASSIGN)){var r=this.t.lastBlockComment();this.t.token.assignOp&&this.fail("Invalid variable initialization"),i.initializer=this.AssignExpression()}else var r=this.t.lastBlockComment();i.blockComment=r}else{this.t.unget();var o=this.DestructuringExpression(!0);if(i=this.newNode({type:IDENTIFIER,name:o,readOnly:e.type===CONST}),e.push(i),pushDestructuringVarDecls(i.name.destructuredNames,s),e.destructurings.push({exp:o,decl:i}),this.x.inForLoopInit&&this.peek()===IN)continue;this.mustMatch(ASSIGN),this.t.token.assignOp&&this.fail("Invalid variable initialization"),i.blockComment=this.t.lastBlockComment(),i.initializer=this.AssignExpression()}while(this.match(COMMA));return e},Pp.LetBlock=function(t){var e,i;return e=this.newNode({type:LET_BLOCK,varDecls:[]}),this.mustMatch(LEFT_PAREN),e.variables=this.Variables(e),this.mustMatch(RIGHT_PAREN),t&&this.peek()!==LEFT_CURLY&&(i=this.newNode({type:SEMICOLON,expression:e}),t=!1),t?e.block=this.Block():e.expression=this.AssignExpression(),e},Pp.checkDestructuring=function(t,e){if(t.type===ARRAY_COMP&&this.fail("Invalid array comprehension left-hand side"),t.type===ARRAY_INIT||t.type===OBJECT_INIT){for(var i,s,n,r,o={},a=t.children,h=0,u=a.length;u>h;h++)(i=a[h])&&(i.type===PROPERTY_INIT?(r=i.children,n=r[1],s=r[0].value):t.type===OBJECT_INIT?(n=i,s=i.value):(n=i,s=h),n.type===ARRAY_INIT||n.type===OBJECT_INIT?o[s]=this.checkDestructuring(n,e):(e&&n.type!==IDENTIFIER&&this.fail("missing name in pattern"),o[s]=n));return o}},Pp.DestructuringExpression=function(t){var e=this.PrimaryExpression();return e.destructuredNames=this.checkDestructuring(e,t),e},Pp.GeneratorExpression=function(t){return this.newNode({type:GENERATOR,expression:t,tail:this.ComprehensionTail()})},Pp.ComprehensionTail=function(){var t,e,i,s,n;t=this.newNode({type:COMP_TAIL});do{switch(e=this.newNode({type:FOR_IN,isLoop:!0}),this.match(IDENTIFIER)&&(this.mozillaMode&&"each"===this.t.token.value?e.isEach=!0:this.t.unget()),n=this.MaybeLeftParen(),this.t.get()){case LEFT_BRACKET:case LEFT_CURLY:this.t.unget(),e.iterator=this.DestructuringExpression();break;case IDENTIFIER:e.iterator=s=this.newNode({type:IDENTIFIER}),s.name=s.value,e.varDecl=i=this.newNode({type:VAR}),i.push(s),this.x.parentScript.varDecls.push(s);break;default:this.fail("missing identifier")}this.mustMatch(IN),e.object=this.Expression(),this.MaybeRightParen(n),t.push(e)}while(this.match(FOR));return this.match(IF)&&(t.guard=this.HeadExpression()),t},Pp.HeadExpression=function(){var t=this.MaybeLeftParen(),e=this.ParenExpression();if(this.MaybeRightParen(t),t===END&&!e.parenthesized){var i=this.peek();i===LEFT_CURLY||definitions.isStatementStartCode[i]||this.fail("Unparenthesized head followed by unbraced body")}return e},Pp.ParenExpression=function(){var t=this.x.update({inForLoopInit:this.x.inForLoopInit&&this.t.token.type===LEFT_PAREN}),e=this.withContext(t,function(){return this.Expression()});return this.match(FOR)&&(e.type!==YIELD||e.parenthesized||this.fail("Yield expression must be parenthesized"),e.type!==COMMA||e.parenthesized||this.fail("Generator expression must be parenthesized"),e=this.GeneratorExpression(e)),e},Pp.Expression=function(){var t,e;if(t=this.AssignExpression(),this.match(COMMA)){e=this.newNode({type:COMMA}),e.push(t),t=e;do e=t.children[t.children.length-1],e.type!==YIELD||e.parenthesized||this.fail("Yield expression must be parenthesized"),t.push(this.AssignExpression());while(this.match(COMMA))}return t},Pp.AssignExpression=function(){var t,e;if(this.match(YIELD,!0))return this.ReturnOrYield();if(t=this.newNode({type:ASSIGN}),e=this.ConditionalExpression(),!this.match(ASSIGN))return e;switch(t.blockComment=this.t.lastBlockComment(),e.type){case OBJECT_INIT:case ARRAY_INIT:e.destructuredNames=this.checkDestructuring(e);case IDENTIFIER:case DOT:case INDEX:case CALL:break;default:this.fail("Bad left-hand side of assignment")}return t.assignOp=e.assignOp=this.t.token.assignOp,t.push(e),t.push(this.AssignExpression()),t},Pp.ConditionalExpression=function(){var t,e;if(t=this.OrExpression(),this.match(HOOK)){e=t,t=this.newNode({type:HOOK}),t.push(e);var i=this.x.update({inForLoopInit:!1});this.withContext(i,function(){t.push(this.AssignExpression())}),this.match(COLON)||this.fail("missing : after ?"),t.push(this.AssignExpression())}return t},Pp.OrExpression=function(){var t,e;for(t=this.AndExpression();this.match(OR);)e=this.newNode(),e.push(t),e.push(this.AndExpression()),t=e;return t},Pp.AndExpression=function(){var t,e;for(t=this.BitwiseOrExpression();this.match(AND);)e=this.newNode(),e.push(t),e.push(this.BitwiseOrExpression()),t=e;return t},Pp.BitwiseOrExpression=function(){var t,e;for(t=this.BitwiseXorExpression();this.match(BITWISE_OR);)e=this.newNode(),e.push(t),e.push(this.BitwiseXorExpression()),t=e;return t},Pp.BitwiseXorExpression=function(){var t,e;for(t=this.BitwiseAndExpression();this.match(BITWISE_XOR);)e=this.newNode(),e.push(t),e.push(this.BitwiseAndExpression()),t=e;return t},Pp.BitwiseAndExpression=function(){var t,e;for(t=this.EqualityExpression();this.match(BITWISE_AND);)e=this.newNode(),e.push(t),e.push(this.EqualityExpression()),t=e;return t},Pp.EqualityExpression=function(){var t,e;for(t=this.RelationalExpression();this.match(EQ)||this.match(NE)||this.match(STRICT_EQ)||this.match(STRICT_NE);)e=this.newNode(),e.push(t),e.push(this.RelationalExpression()),t=e;return t},Pp.RelationalExpression=function(){var t,e,i=this.x.update({inForLoopInit:!1});return this.withContext(i,function(){for(t=this.ShiftExpression();this.match(LT)||this.match(LE)||this.match(GE)||this.match(GT)||!this.x.inForLoopInit&&this.match(IN)||this.match(INSTANCEOF);)e=this.newNode(),e.push(t),e.push(this.ShiftExpression()),t=e}),t},Pp.ShiftExpression=function(){var t,e;for(t=this.AddExpression();this.match(LSH)||this.match(RSH)||this.match(URSH);)e=this.newNode(),e.push(t),e.push(this.AddExpression()),t=e;return t},Pp.AddExpression=function(){var t,e;for(t=this.MultiplyExpression();this.match(PLUS)||this.match(MINUS);)e=this.newNode(),e.push(t),e.push(this.MultiplyExpression()),t=e;return t},Pp.MultiplyExpression=function(){var t,e;for(t=this.UnaryExpression();this.match(MUL)||this.match(DIV)||this.match(MOD);)e=this.newNode(),e.push(t),e.push(this.UnaryExpression()),t=e;return t},Pp.UnaryExpression=function(){var t,e,i;switch(i=this.t.get(!0)){case DELETE:case VOID:case TYPEOF:case NOT:case BITWISE_NOT:case PLUS:case MINUS:t=i===PLUS?this.newNode({type:UNARY_PLUS}):i===MINUS?this.newNode({type:UNARY_MINUS}):this.newNode(),t.push(this.UnaryExpression());break;case INCREMENT:case DECREMENT:t=this.newNode(),t.push(this.MemberExpression(!0));break;default:this.t.unget(),t=this.MemberExpression(!0),this.t.tokens[this.t.tokenIndex+this.t.lookahead-1&3].lineno===this.t.lineno&&(this.match(INCREMENT)||this.match(DECREMENT))&&(e=this.newNode({postfix:!0}),e.push(t),t=e)}return t},Pp.MemberExpression=function(t){var e,i,s;for(this.match(NEW)?(e=this.newNode(),e.push(this.MemberExpression(!1)),this.match(LEFT_PAREN)&&(e.type=NEW_WITH_ARGS,e.push(this.ArgumentList()))):e=this.PrimaryExpression();(s=this.t.get())!==END;){switch(s){case DOT:i=this.newNode(),i.push(e),i.push(this.IdentifierName());break;case LEFT_BRACKET:i=this.newNode({type:INDEX}),i.push(e),i.push(this.Expression()),this.mustMatch(RIGHT_BRACKET);break;case LEFT_PAREN:if(t){i=this.newNode({type:CALL}),i.push(e),i.push(this.ArgumentList());break}default:return this.t.unget(),e}e=i}return e},Pp.ArgumentList=function(){var t,e;if(t=this.newNode({type:LIST}),this.match(RIGHT_PAREN,!0))return t;do e=this.AssignExpression(),e.type!==YIELD||e.parenthesized||this.peek()!==COMMA||this.fail("Yield expression must be parenthesized"),this.match(FOR)&&(e=this.GeneratorExpression(e),(t.children.length>1||this.peek(!0)===COMMA)&&this.fail("Generator expression must be parenthesized")),t.push(e);while(this.match(COMMA));return this.mustMatch(RIGHT_PAREN),t},Pp.PrimaryExpression=function(){var t,e,i=this.t.get(!0);switch(i){case FUNCTION:t=this.FunctionDefinition(!1,EXPRESSED_FORM);break;case LEFT_BRACKET:for(t=this.newNode({type:ARRAY_INIT});(i=this.peek(!0))!==RIGHT_BRACKET;)if(i!==COMMA){if(t.push(this.AssignExpression()),i!==COMMA&&!this.match(COMMA))break}else this.t.get(),t.push(null);1===t.children.length&&this.match(FOR)&&(e=this.newNode({type:ARRAY_COMP,expression:t.children[0],tail:this.ComprehensionTail()}),t=e),this.mustMatch(RIGHT_BRACKET);break;case LEFT_CURLY:var s;t=this.newNode({type:OBJECT_INIT});t:if(!this.match(RIGHT_CURLY)){do if(i=this.t.get(),"get"!==this.t.token.value&&"set"!==this.t.token.value||this.peek()!==IDENTIFIER){var n=this.t.blockComments;switch(i){case IDENTIFIER:case NUMBER:case STRING:s=this.newNode({type:IDENTIFIER});break;case RIGHT_CURLY:break t;default:if(this.t.token.value in definitions.keywords){s=this.newNode({type:IDENTIFIER});break}this.fail("Invalid property name")}this.match(COLON)?(e=this.newNode({type:PROPERTY_INIT}),e.push(s),e.push(this.AssignExpression()),e.blockComments=n,t.push(e)):(this.peek()!==COMMA&&this.peek()!==RIGHT_CURLY&&this.fail("missing : after property"),t.push(s))}else t.push(this.FunctionDefinition(!0,EXPRESSED_FORM));while(this.match(COMMA));this.mustMatch(RIGHT_CURLY)}break;case LEFT_PAREN:t=this.ParenExpression(),this.mustMatch(RIGHT_PAREN),t.parenthesized=!0;break;case LET:t=this.LetBlock(!1);break;case NULL:case THIS:case TRUE:case FALSE:case IDENTIFIER:case NUMBER:case STRING:case REGEXP:t=this.newNode();break;default:this.fail("missing operand; found "+definitions.tokens[i])}return t},exports.parse=parse,exports.parseStdin=parseStdin,exports.parseFunction=parseFunction,exports.Node=Node,exports.DECLARED_FORM=DECLARED_FORM,exports.EXPRESSED_FORM=EXPRESSED_FORM,exports.STATEMENT_FORM=STATEMENT_FORM,exports.Tokenizer=Tokenizer,exports.Parser=Parser,exports.Module=Module,exports.Export=Export},{"./definitions":1,"./lexer":2,"./options":4}]},{},[3]);