pegjs-coffee-plugin
Version:
A plugin for PEG.js to use CoffeeScript in your actions.
2 lines • 204 kB
JavaScript
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.PEGjsCoffeePlugin=e()}}(function(){var define,module,exports;return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var s=typeof require=="function"&&require;for(var o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){function i(e){var t={bare:!0};try{return r.compile(e,t)}catch(n){var i="In: \n"+e+"\n was the following error:"+n.message;throw new SyntaxError(i,n.fileName,n.lineNumber)}}function s(e){return["__initializer = ( ->"," ",e," return this",").call({})"].join("\n")}function o(e){return["return ( -> ",e," ).apply(__initializer)"].join("")}function u(e){return e.code=i(o(e.code)),e}function a(e){return e=e||{},function(t){var n=e[t.type]||function(){};return n.call(null,t)}}function f(e){return c(e.expression),e}function l(e){return function(t){for(var n=0;n<t[e].length;n++)c(t[e][n]);return t}}function c(e){a({grammar:l("rules"),choice:l("alternatives"),sequence:l("elements"),action:u,semantic_not:u,semantic_and:u,rule:f,named:f,labeled:f,text:f,simple_and:f,simple_not:f,optional:f,zero_or_more:f,one_or_more:f})(e)}function h(e){e.initializer||(e.initializer={type:"initializer",code:""}),e.initializer.code=i(s(e.initializer.code)),c(e)}var r=e("coffee-script");t.exports={use:function(e,t){e.passes.transform.unshift(h)}}},{"coffee-script":7}],2:[function(e,t,n){},{}],3:[function(e,t,n){var r=t.exports={};r.nextTick=function(){var e=typeof window!="undefined"&&window.setImmediate,t=typeof window!="undefined"&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||t===null)&&e.data==="process-tick"){e.stopPropagation();if(n.length>0){var r=n.shift();r()}}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")}},{}],4:[function(e,t,n){function i(e,t){var n=0;for(var r=e.length-1;r>=0;r--){var i=e[r];i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function u(e,t){if(e.filter)return e.filter(t);var n=[];for(var r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var r=e("__browserify_process"),s=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(e){return s.exec(e).slice(1)};n.resolve=function(){var e="",t=!1;for(var n=arguments.length-1;n>=-1&&!t;n--){var s=n>=0?arguments[n]:r.cwd();if(typeof s!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!s)continue;e=s+"/"+e,t=s.charAt(0)==="/"}return e=i(u(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."},n.normalize=function(e){var t=n.isAbsolute(e),r=a(e,-1)==="/";return e=i(u(e.split("/"),function(e){return!!e}),!t).join("/"),!e&&!t&&(e="."),e&&r&&(e+="/"),(t?"/":"")+e},n.isAbsolute=function(e){return e.charAt(0)==="/"},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(u(e,function(e,t){if(typeof e!="string")throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){var t=0;for(;t<e.length;t++)if(e[t]!=="")break;var n=e.length-1;for(;n>=0;n--)if(e[n]!=="")break;return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),u=o;for(var a=0;a<o;a++)if(i[a]!==s[a]){u=a;break}var f=[];for(var a=u;a<i.length;a++)f.push("..");return f=f.concat(s.slice(u)),f.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=o(e),n=t[0],r=t[1];return!n&&!r?".":(r&&(r=r.substr(0,r.length-1)),n+r)},n.basename=function(e,t){var n=o(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return o(e)[3]};var a="ab".substr(-1)==="b"?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}},{__browserify_process:3}],5:[function(require,module,exports){var indexOf=require("indexof"),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)t.push(n);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)},Script=exports.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInNewContext=function(e){e||(e={});var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var n=t.contentWindow;forEach(Object_keys(e),function(t){n[t]=e[t]}),!n.eval&&n.execScript&&n.execScript("null");var r=Object_keys(n),i=n.eval(this.code);return forEach(Object_keys(n),function(t){if(t in e||indexOf(r,t)===-1)e[t]=n[t]}),document.body.removeChild(t),i},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInContext=function(e){return this.runInNewContext(e)},forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var n=Script(t);return n[e].apply(n,[].slice.call(arguments,1))}}),exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t={};return typeof e=="object"&&forEach(Object_keys(e),function(n){t[n]=e[n]}),t}},{indexof:6}],6:[function(e,t,n){var r=[].indexOf;t.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},{}],7:[function(e,t,n){var r=e("__browserify_process"),i=typeof self!="undefined"?self:typeof window!="undefined"?window:{};(function(){var t,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C={}.hasOwnProperty;p=e("fs"),S=e("vm"),w=e("path"),u=e("child_process"),t=e("./lexer").Lexer,g=e("./parser").parser,d=e("./helpers"),o=e("./sourcemap"),n.VERSION="1.6.3",n.helpers=d,n.compile=a=function(e,t){var n,r,i,s,u,a,f,l,c,h,p,m;t==null&&(t={}),c=d.merge,t.sourceMap&&(l=new o),u=g.parse(v.tokenize(e,t)).compileToFragments(t),i=0,t.header&&(i+=1),t.shiftLine&&(i+=1),r=0,f="";for(p=0,m=u.length;p<m;p++)s=u[p],t.sourceMap&&(s.locationData&&l.add([s.locationData.first_line,s.locationData.first_column],[i,r],{noReplace:!0}),h=d.count(s.code,"\n"),i+=h,r=s.code.length-(h?s.code.lastIndexOf("\n"):0)),f+=s.code;return t.header&&(a="Generated by CoffeeScript "+this.VERSION,f="// "+a+"\n"+f),t.sourceMap?(n={js:f},n.sourceMap=l,n.v3SourceMap=l.generate(t,e),n):f},n.tokens=function(e,t){return v.tokenize(e,t)},n.nodes=function(e,t){return typeof e=="string"?g.parse(v.tokenize(e,t)):g.parse(e)},n.run=function(t,n){var i,s;return n==null&&(n={}),s=e.main,n.sourceMap==null&&(n.sourceMap=!0),s.filename=r.argv[1]=n.filename?p.realpathSync(n.filename):".",s.moduleCache&&(s.moduleCache={}),s.paths=e("module")._nodeModulePaths(w.dirname(p.realpathSync(n.filename||"."))),!d.isCoffee(s.filename)||e.extensions?(i=a(t,n),y(),E[s.filename]=i.sourceMap,s._compile(i.js,s.filename)):s._compile(t,s.filename)},n.eval=function(t,n){var s,o,u,f,l,c,h,p,d,v,m,g,y,b;n==null&&(n={});if(!(t=t.trim()))return;o=S.Script;if(o){if(n.sandbox!=null){if(n.sandbox instanceof o.createContext().constructor)h=n.sandbox;else{h=o.createContext(),g=n.sandbox;for(f in g){if(!C.call(g,f))continue;p=g[f],h[f]=p}}h.global=h.root=h.GLOBAL=h}else h=i;h.__filename=n.filename||"eval",h.__dirname=w.dirname(h.__filename);if(h===i&&!h.module&&!h.require){s=e("module"),h.module=m=new s(n.modulename||"eval"),h.require=b=function(e){return s._load(e,m,!0)},m.filename=h.__filename,y=Object.getOwnPropertyNames(e);for(d=0,v=y.length;d<v;d++)c=y[d],c!=="paths"&&(b[c]=e[c]);b.paths=m.paths=s._nodeModulePaths(r.cwd()),b.resolve=function(e){return s._resolveFilename(e,m)}}}l={};for(f in n){if(!C.call(n,f))continue;p=n[f],l[f]=p}return l.bare=!0,u=a(t,l),h===i?S.runInThisContext(u):S.runInContext(u,h)},m=function(e,t){var n,r,i;return r=p.readFileSync(t,"utf8"),i=r.charCodeAt(0)===65279?r.substring(1):r,n=a(i,{filename:t,sourceMap:!0,literate:d.isLiterate(t)}),E[t]=n.sourceMap,e._compile(n.js,t)};if(e.extensions){N=[".coffee",".litcoffee",".coffee.md"];for(x=0,T=N.length;x<T;x++)f=N[x],e.extensions[f]=m;s=e("module"),l=function(e){var t,n;n=w.basename(e).split("."),n[0]===""&&n.shift();while(n.shift()){t="."+n.join(".");if(s._extensions[t])return t}return".js"},s.prototype.load=function(e){var t;return this.filename=e,this.paths=s._nodeModulePaths(w.dirname(e)),t=l(e),s._extensions[t](this,e),this.loaded=!0}}u&&(c=u.fork,u.fork=function(e,t,n){var r;return t==null&&(t=[]),n==null&&(n={}),r=d.isCoffee(e)?"coffee":null,Array.isArray(t)||(t=[],n=t||{}),n.execPath||(n.execPath=r),c(e,t,n)}),v=new t,g.lexer={lex:function(){var e,t;return t=this.tokens[this.pos++],t?(e=t[0],this.yytext=t[1],this.yylloc=t[2],this.yylineno=this.yylloc.first_line):e="",e},setInput:function(e){return this.tokens=e,this.pos=0},upcomingInput:function(){return""}},g.yy=e("./nodes"),g.yy.parseError=function(e,t){var n;return n=t.token,e="unexpected "+(n===1?"end of input":n),d.throwSyntaxError(e,g.lexer.yylloc)},b=!1,E={},y=function(){var t;if(b)return;return b=!0,t=e.main,Error.prepareStackTrace=function(e,t){var r,i,s,o,u;return o={},s=function(e,t,n){var r,i;return i=E[e],i&&(r=i.sourceLocation([t-1,n-1])),r?[r[0]+1,r[1]+1]:null},i=function(){var e,i,o;o=[];for(e=0,i=t.length;e<i;e++){r=t[e];if(r.getFunction()===n.run)break;o.push(" at "+h(r,s))}return o}(),""+e.name+": "+((u=e.message)!=null?u:"")+"\n"+i.join("\n")+"\n"}},h=function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p;return s=void 0,i="",e.isNative()?i="native":(e.isEval()?(s=e.getScriptNameOrSourceURL(),s||(i=""+e.getEvalOrigin()+", ")):s=e.getFileName(),s||(s="<anonymous>"),f=e.getLineNumber(),r=e.getColumnNumber(),c=t(s,f,r),i=c?""+s+":"+c[0]+":"+c[1]+", <js>:"+f+":"+r:""+s+":"+f+":"+r),o=e.getFunctionName(),u=e.isConstructor(),a=!e.isToplevel()&&!u,a?(l=e.getMethodName(),p=e.getTypeName(),o?(h=n="",p&&o.indexOf(p)&&(h=""+p+"."),l&&o.indexOf("."+l)!==o.length-l.length-1&&(n=" [as "+l+"]"),""+h+o+n+" ("+i+")"):""+p+"."+(l||"<anonymous>")+" ("+i+")"):u?"new "+(o||"<anonymous>")+" ("+i+")":o?""+o+" ("+i+")":i}}).call(this)},{"./helpers":8,"./lexer":9,"./nodes":10,"./parser":11,"./sourcemap":14,__browserify_process:3,child_process:2,fs:2,module:2,path:4,vm:5}],8:[function(e,t,n){(function(){var e,t,r,i,s,o;n.starts=function(e,t,n){return t===e.substr(n,t.length)},n.ends=function(e,t,n){var r;return r=t.length,t===e.substr(e.length-r-(n||0),r)},n.repeat=s=function(e,t){var n;n="";while(t>0)t&1&&(n+=e),t>>>=1,e+=e;return n},n.compact=function(e){var t,n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],t&&i.push(t);return i},n.count=function(e,t){var n,r;n=r=0;if(!t.length)return 1/0;while(r=1+e.indexOf(t,r))n++;return n},n.merge=function(e,n){return t(t({},e),n)},t=n.extend=function(e,t){var n,r;for(n in t)r=t[n],e[n]=r;return e},n.flatten=r=function(e){var t,n,i,s;n=[];for(i=0,s=e.length;i<s;i++)t=e[i],t instanceof Array?n=n.concat(r(t)):n.push(t);return n},n.del=function(e,t){var n;return n=e[t],delete e[t],n},n.last=i=function(e,t){return e[e.length-(t||0)-1]},n.some=(o=Array.prototype.some)!=null?o:function(e){var t,n,r;for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))return!0}return!1},n.invertLiterate=function(e){var t,n,r;return r=!0,n=function(){var n,i,s,o;s=e.split("\n"),o=[];for(n=0,i=s.length;n<i;n++)t=s[n],r&&/^([ ]{4}|[ ]{0,3}\t)/.test(t)?o.push(t):(r=/^\s*$/.test(t))?o.push(t):o.push("# "+t);return o}(),n.join("\n")},e=function(e,t){return t?{first_line:e.first_line,first_column:e.first_column,last_line:t.last_line,last_column:t.last_column}:e},n.addLocationDataFn=function(t,n){return function(r){return typeof r=="object"&&!!r.updateLocationDataIfMissing&&r.updateLocationDataIfMissing(e(t,n)),r}},n.locationDataToString=function(e){var t;return"2"in e&&"first_line"in e[2]?t=e[2]:"first_line"in e&&(t=e),t?""+(t.first_line+1)+":"+(t.first_column+1)+"-"+(""+(t.last_line+1)+":"+(t.last_column+1)):"No location data"},n.baseFileName=function(e,t,n){var r,i;return t==null&&(t=!1),n==null&&(n=!1),i=n?/\\|\//:/\//,r=e.split(i),e=r[r.length-1],t?(r=e.split("."),r.pop(),r[r.length-1]==="coffee"&&r.length>1&&r.pop(),r.join(".")):e},n.isCoffee=function(e){return/\.((lit)?coffee|coffee\.md)$/.test(e)},n.isLiterate=function(e){return/\.(litcoffee|coffee\.md)$/.test(e)},n.throwSyntaxError=function(e,t){var n;throw t.last_line==null&&(t.last_line=t.first_line),t.last_column==null&&(t.last_column=t.first_column),n=new SyntaxError(e),n.location=t,n},n.prettyErrorMessage=function(e,t,n,r){var i,o,u,a,f,l,c,h,p,d,v;return e.location?(v=e.location,f=v.first_line,a=v.first_column,c=v.last_line,l=v.last_column,i=n.split("\n")[f],d=a,u=f===c?l+1:i.length,h=s(" ",d)+s("^",u-d),r&&(o=function(e){return"[1;31m"+e+"[0m"},i=i.slice(0,d)+o(i.slice(d,u))+i.slice(u),h=o(h)),p=""+t+":"+(f+1)+":"+(a+1)+": error: "+e.message+"\n"+i+"\n"+h,p):e.stack||""+e}}).call(this)},{}],9:[function(e,t,n){(function(){var t,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K,Q,G,Y,Z,et,tt=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};Z=e("./rewriter"),j=Z.Rewriter,b=Z.INVERSES,et=e("./helpers"),X=et.count,G=et.starts,W=et.compact,J=et.last,Q=et.repeat,V=et.invertLiterate,K=et.locationDataToString,Y=et.throwSyntaxError,n.Lexer=C=function(){function e(){}return e.prototype.tokenize=function(e,t){var n,r,i,s;t==null&&(t={}),this.literate=t.literate,this.indent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.ends=[],this.tokens=[],this.chunkLine=t.line||0,this.chunkColumn=t.column||0,e=this.clean(e),r=0;while(this.chunk=e.slice(r))n=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.heredocToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken(),s=this.getLineAndColumnFromChunk(n),this.chunkLine=s[0],this.chunkColumn=s[1],r+=n;return this.closeIndentation(),(i=this.ends.pop())&&this.error("missing "+i),t.rewrite===!1?this.tokens:(new j).rewrite(this.tokens)},e.prototype.clean=function(e){return e.charCodeAt(0)===t&&(e=e.slice(1)),e=e.replace(/\r/g,"").replace(R,""),z.test(e)&&(e="\n"+e,this.chunkLine--),this.literate&&(e=V(e)),e},e.prototype.identifierToken=function(){var e,t,n,r,i,s,f,l,c,h,p,d,v,m;return(f=g.exec(this.chunk))?(s=f[0],r=f[1],e=f[2],i=r.length,l=void 0,r==="own"&&this.tag()==="FOR"?(this.token("OWN",r),r.length):(n=e||(c=J(this.tokens))&&((d=c[0])==="."||d==="?."||d==="::"||d==="?::"||!c.spaced&&c[0]==="@"),h="IDENTIFIER",!n&&(tt.call(S,r)>=0||tt.call(a,r)>=0)&&(h=r.toUpperCase(),h==="WHEN"&&(v=this.tag(),tt.call(x,v)>=0)?h="LEADING_WHEN":h==="FOR"?this.seenFor=!0:h==="UNLESS"?h="IF":tt.call(U,h)>=0?h="UNARY":tt.call(H,h)>=0&&(h!=="INSTANCEOF"&&this.seenFor?(h="FOR"+h,this.seenFor=!1):(h="RELATION",this.value()==="!"&&(l=this.tokens.pop(),r="!"+r)))),tt.call(E,r)>=0&&(n?(h="IDENTIFIER",r=new String(r),r.reserved=!0):tt.call(B,r)>=0&&this.error('reserved word "'+r+'"')),n||(tt.call(o,r)>=0&&(r=u[r]),h=function(){switch(r){case"!":return"UNARY";case"==":case"!=":return"COMPARE";case"&&":case"||":return"LOGIC";case"true":case"false":return"BOOL";case"break":case"continue":return"STATEMENT";default:return h}}()),p=this.token(h,r,0,i),l&&(m=[l[2].first_line,l[2].first_column],p[2].first_line=m[0],p[2].first_column=m[1]),e&&(t=s.lastIndexOf(":"),this.token(":",":",t,e.length)),s.length)):0},e.prototype.numberToken=function(){var e,t,n,r,i;if(!(n=_.exec(this.chunk)))return 0;r=n[0],/^0[BOX]/.test(r)?this.error("radix prefix '"+r+"' must be lowercase"):/E/.test(r)&&!/^0x/.test(r)?this.error("exponential notation '"+r+"' must be indicated with a lowercase 'e'"):/^0\d*[89]/.test(r)?this.error("decimal literal '"+r+"' must not be prefixed with '0'"):/^0\d+/.test(r)&&this.error("octal literal '"+r+"' must be prefixed with '0o'"),t=r.length;if(i=/^0o([0-7]+)/.exec(r))r="0x"+parseInt(i[1],8).toString(16);if(e=/^0b([01]+)/.exec(r))r="0x"+parseInt(e[1],2).toString(16);return this.token("NUMBER",r,0,t),t},e.prototype.stringToken=function(){var e,t,n;switch(this.chunk.charAt(0)){case"'":if(!(e=I.exec(this.chunk)))return 0;n=e[0],this.token("STRING",n.replace(L,"\\\n"),0,n.length);break;case'"':if(!(n=this.balancedString(this.chunk,'"')))return 0;0<n.indexOf("#{",1)?this.interpolateString(n.slice(1,-1),{strOffset:1,lexedLength:n.length}):this.token("STRING",this.escapeLines(n,0,n.length));break;default:return 0}return(t=/^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(n))&&this.error("octal escape sequences "+n+" are not allowed"),n.length},e.prototype.heredocToken=function(){var e,t,n,r;return(n=h.exec(this.chunk))?(t=n[0],r=t.charAt(0),e=this.sanitizeHeredoc(n[2],{quote:r,indent:null}),r==='"'&&0<=e.indexOf("#{")?this.interpolateString(e,{heredoc:!0,strOffset:3,lexedLength:t.length}):this.token("STRING",this.makeString(e,r,!0),0,t.length),t.length):0},e.prototype.commentToken=function(){var e,t,n;return(n=this.chunk.match(f))?(e=n[0],t=n[1],t&&this.token("HERECOMMENT",this.sanitizeHeredoc(t,{herecomment:!0,indent:Q(" ",this.indent)}),0,e.length),e.length):0},e.prototype.jsToken=function(){var e,t;return this.chunk.charAt(0)!=="`"||!(e=w.exec(this.chunk))?0:(this.token("JS",(t=e[0]).slice(1,-1),0,t.length),t.length)},e.prototype.regexToken=function(){var e,t,n,r,i,s,o;return this.chunk.charAt(0)!=="/"?0:(n=v.exec(this.chunk))?(t=this.heregexToken(n),t):(r=J(this.tokens),r&&(s=r[0],tt.call(r.spaced?O:M,s)>=0)?0:(n=P.exec(this.chunk))?(o=n,n=o[0],i=o[1],e=o[2],i.slice(0,2)==="/*"&&this.error("regular expressions cannot begin with `*`"),i==="//"&&(i="/(?:)/"),this.token("REGEX",""+i+e,0,n.length),n.length):0)},e.prototype.heregexToken=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,g;i=e[0],t=e[1],n=e[2];if(0>t.indexOf("#{"))return u=t.replace(m,"").replace(/\//g,"\\/"),u.match(/^\*/)&&this.error("regular expressions cannot begin with `*`"),this.token("REGEX","/"+(u||"(?:)")+"/"+n,0,i.length),i.length;this.token("IDENTIFIER","RegExp",0,0),this.token("CALL_START","(",0,0),l=[],d=this.interpolateString(t,{regex:!0});for(h=0,p=d.length;h<p;h++){f=d[h],a=f[0],c=f[1];if(a==="TOKENS")l.push.apply(l,c);else if(a==="NEOSTRING"){if(!(c=c.replace(m,"")))continue;c=c.replace(/\\/g,"\\\\"),f[0]="STRING",f[1]=this.makeString(c,'"',!0),l.push(f)}else this.error("Unexpected "+a);o=J(this.tokens),s=["+","+"],s[2]=o[2],l.push(s)}return l.pop(),((v=l[0])!=null?v[0]:void 0)!=="STRING"&&(this.token("STRING",'""',0,0),this.token("+","+",0,0)),(g=this.tokens).push.apply(g,l),n&&(r=i.lastIndexOf(n),this.token(",",",",r,0),this.token("STRING",'"'+n+'"',r,n.length)),this.token(")",")",i.length-1,0),i.length},e.prototype.lineToken=function(){var e,t,n,r,i;if(!(n=A.exec(this.chunk)))return 0;t=n[0],this.seenFor=!1,i=t.length-1-t.lastIndexOf("\n"),r=this.unfinished();if(i-this.indebt===this.indent)return r?this.suppressNewlines():this.newlineToken(0),t.length;if(i>this.indent){if(r)return this.indebt=i-this.indent,this.suppressNewlines(),t.length;e=i-this.indent+this.outdebt,this.token("INDENT",e,t.length-i,i),this.indents.push(e),this.ends.push("OUTDENT"),this.outdebt=this.indebt=0}else this.indebt=0,this.outdentToken(this.indent-i,r,t.length);return this.indent=i,t.length},e.prototype.outdentToken=function(e,t,n){var r,i;while(e>0)i=this.indents.length-1,this.indents[i]===void 0?e=0:this.indents[i]===this.outdebt?(e-=this.outdebt,this.outdebt=0):this.indents[i]<this.outdebt?(this.outdebt-=this.indents[i],e-=this.indents[i]):(r=this.indents.pop()+this.outdebt,e-=r,this.outdebt=0,this.pair("OUTDENT"),this.token("OUTDENT",r,0,n));r&&(this.outdebt-=e);while(this.value()===";")this.tokens.pop();return this.tag()!=="TERMINATOR"&&!t&&this.token("TERMINATOR","\n",n,0),this},e.prototype.whitespaceToken=function(){var e,t,n;return!(e=z.exec(this.chunk))&&!(t=this.chunk.charAt(0)==="\n")?0:(n=J(this.tokens),n&&(n[e?"spaced":"newLine"]=!0),e?e[0].length:0)},e.prototype.newlineToken=function(e){while(this.value()===";")this.tokens.pop();return this.tag()!=="TERMINATOR"&&this.token("TERMINATOR","\n",e,0),this},e.prototype.suppressNewlines=function(){return this.value()==="\\"&&this.tokens.pop(),this},e.prototype.literalToken=function(){var e,t,n,r,o,u,a,f;(e=D.exec(this.chunk))?(r=e[0],s.test(r)&&this.tagParameters()):r=this.chunk.charAt(0),n=r,t=J(this.tokens);if(r==="="&&t){!t[1].reserved&&(o=t[1],tt.call(E,o)>=0)&&this.error('reserved word "'+this.value()+"\" can't be assigned");if((u=t[1])==="||"||u==="&&")return t[0]="COMPOUND_ASSIGN",t[1]+="=",r.length}if(r===";")this.seenFor=!1,n="TERMINATOR";else if(tt.call(k,r)>=0)n="MATH";else if(tt.call(l,r)>=0)n="COMPARE";else if(tt.call(c,r)>=0)n="COMPOUND_ASSIGN";else if(tt.call(U,r)>=0)n="UNARY";else if(tt.call(F,r)>=0)n="SHIFT";else if(tt.call(N,r)>=0||r==="?"&&(t!=null?t.spaced:void 0))n="LOGIC";else if(t&&!t.spaced)if(r==="("&&(a=t[0],tt.call(i,a)>=0))t[0]==="?"&&(t[0]="FUNC_EXIST"),n="CALL_START";else if(r==="["&&(f=t[0],tt.call(y,f)>=0)){n="INDEX_START";switch(t[0]){case"?":t[0]="INDEX_SOAK"}}switch(r){case"(":case"{":case"[":this.ends.push(b[r]);break;case")":case"}":case"]":this.pair(r)}return this.token(n,r),r.length},e.prototype.sanitizeHeredoc=function(e,t){var n,r,i,s,o;i=t.indent,r=t.herecomment;if(r){p.test(e)&&this.error('block comment cannot contain "*/", starting');if(e.indexOf("\n")<0)return e}else while(s=d.exec(e)){n=s[1];if(i===null||0<(o=n.length)&&o<i.length)i=n}return i&&(e=e.replace(RegExp("\\n"+i,"g"),"\n")),r||(e=e.replace(/^\n/,"")),e},e.prototype.tagParameters=function(){var e,t,n,r;if(this.tag()!==")")return this;t=[],r=this.tokens,e=r.length,r[--e][0]="PARAM_END";while(n=r[--e])switch(n[0]){case")":t.push(n);break;case"(":case"CALL_START":if(!t.length)return n[0]==="("?(n[0]="PARAM_START",this):this;t.pop()}return this},e.prototype.closeIndentation=function(){return this.outdentToken(this.indent)},e.prototype.balancedString=function(e,t){var n,r,i,s,o,u,a,f;n=0,u=[t];for(r=a=1,f=e.length;1<=f?a<f:a>f;r=1<=f?++a:--a){if(n){--n;continue}switch(i=e.charAt(r)){case"\\":++n;continue;case t:u.pop();if(!u.length)return e.slice(0,+r+1||9e9);t=u[u.length-1];continue}t!=="}"||i!=='"'&&i!=="'"?t==="}"&&i==="/"&&(s=v.exec(e.slice(r))||P.exec(e.slice(r)))?n+=s[0].length-1:t==="}"&&i==="{"?u.push(t="}"):t==='"'&&o==="#"&&i==="{"&&u.push(t="}"):u.push(t=i),o=i}return this.error("missing "+u.pop()+", starting")},e.prototype.interpolateString=function(t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O;n==null&&(n={}),s=n.heredoc,b=n.regex,v=n.offsetInChunk,E=n.strOffset,c=n.lexedLength,v=v||0,E=E||0,c=c||t.length,s&&t.length>0&&t[0]==="\n"&&(t=t.slice(1),E++),T=[],m=0,o=-1;while(l=t.charAt(o+=1)){if(l==="\\"){o+=1;continue}if(l!=="#"||t.charAt(o+1)!=="{"||!(i=this.balancedString(t.slice(o+1),"}")))continue;m<o&&T.push(this.makeToken("NEOSTRING",t.slice(m,o),E+m)),u=i.slice(1,-1);if(u.length){L=this.getLineAndColumnFromChunk(E+o+1),h=L[0],r=L[1],d=(new e).tokenize(u,{line:h,column:r,rewrite:!1}),y=d.pop(),((A=d[0])!=null?A[0]:void 0)==="TERMINATOR"&&(y=d.shift());if(f=d.length)f>1&&(d.unshift(this.makeToken("(","(",E+o+1,0)),d.push(this.makeToken(")",")",E+o+1+u.length,0))),T.push(["TOKENS",d])}o+=i.length,m=o+1}o>m&&m<t.length&&T.push(this.makeToken("NEOSTRING",t.slice(m),E+m));if(b)return T;if(!T.length)return this.token("STRING",'""',v,c);T[0][0]!=="NEOSTRING"&&T.unshift(this.makeToken("NEOSTRING","",v)),(a=T.length>1)&&this.token("(","(",v,0);for(o=C=0,k=T.length;C<k;o=++C)x=T[o],S=x[0],N=x[1],o&&(o&&(g=this.token("+","+")),p=S==="TOKENS"?N[0]:x,g[2]={first_line:p[2].first_line,first_column:p[2].first_column,last_line:p[2].first_line,last_column:p[2].first_column}),S==="TOKENS"?(O=this.tokens).push.apply(O,N):S==="NEOSTRING"?(x[0]="STRING",x[1]=this.makeString(N,'"',s),this.tokens.push(x)):this.error("Unexpected "+S);return a&&(w=this.makeToken(")",")",v+c,0),w.stringEnd=!0,this.tokens.push(w)),T},e.prototype.pair=function(e){var t,n;return e!==(n=J(this.ends))?("OUTDENT"!==n&&this.error("unmatched "+e),this.indent-=t=J(this.indents),this.outdentToken(t,!0),this.pair(e)):this.ends.pop()},e.prototype.getLineAndColumnFromChunk=function(e){var t,n,r,i;return e===0?[this.chunkLine,this.chunkColumn]:(e>=this.chunk.length?i=this.chunk:i=this.chunk.slice(0,+(e-1)+1||9e9),n=X(i,"\n"),t=this.chunkColumn,n>0?(r=i.split("\n"),t=J(r).length):t+=i.length,[this.chunkLine+n,t])},e.prototype.makeToken=function(e,t,n,r){var i,s,o,u,a;return n==null&&(n=0),r==null&&(r=t.length),s={},u=this.getLineAndColumnFromChunk(n),s.first_line=u[0],s.first_column=u[1],i=Math.max(0,r-1),a=this.getLineAndColumnFromChunk(n+i),s.last_line=a[0],s.last_column=a[1],o=[e,t,s],o},e.prototype.token=function(e,t,n,r){var i;return i=this.makeToken(e,t,n,r),this.tokens.push(i),i},e.prototype.tag=function(e,t){var n;return(n=J(this.tokens,e))&&(t?n[0]=t:n[0])},e.prototype.value=function(e,t){var n;return(n=J(this.tokens,e))&&(t?n[1]=t:n[1])},e.prototype.unfinished=function(){var e;return T.test(this.chunk)||(e=this.tag())==="\\"||e==="."||e==="?."||e==="?::"||e==="UNARY"||e==="MATH"||e==="+"||e==="-"||e==="SHIFT"||e==="RELATION"||e==="COMPARE"||e==="LOGIC"||e==="THROW"||e==="EXTENDS"},e.prototype.escapeLines=function(e,t){return e.replace(L,t?"\\n":"")},e.prototype.makeString=function(e,t,n){return e?(e=e.replace(/\\([\s\S])/g,function(e,n){return n==="\n"||n===t?n:e}),e=e.replace(RegExp(""+t,"g"),"\\$&"),t+this.escapeLines(e,n)+t):t+t},e.prototype.error=function(e){return Y(e,{first_line:this.chunkLine,first_column:this.chunkColumn})},e}(),S=["true","false","null","this","new","delete","typeof","in","instanceof","return","throw","break","continue","debugger","if","else","switch","for","while","do","try","catch","finally","class","extends","super"],a=["undefined","then","unless","until","loop","of","by","when"],u={and:"&&",or:"||",is:"==",isnt:"!=",not:"!",yes:"true",no:"false",on:"true",off:"false"},o=function(){var e;e=[];for($ in u)e.push($);return e}(),a=a.concat(o),B=["case","default","function","var","void","with","const","let","enum","export","import","native","__hasProp","__extends","__slice","__bind","__indexOf","implements","interface","package","private","protected","public","static","yield"],q=["arguments","eval"],E=S.concat(B).concat(q),n.RESERVED=B.concat(S).concat(a).concat(q),n.STRICT_PROSCRIBED=q,t=65279,g=/^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/,_=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i,h=/^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/,D=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/,z=/^[^\n\S]+/,f=/^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/,s=/^[-=]>/,A=/^(?:\n[^\n\S]*)+/,I=/^'[^\\']*(?:\\.[^\\']*)*'/,w=/^`[^\\`]*(?:\\.[^\\`]*)*`/,P=/^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/,v=/^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/,m=/\s+(?:#.*)?/g,L=/\n/g,d=/\n+([^\n\S]*)/g,p=/\*\//,T=/^\s*(?:,|\??\.(?![.\d])|::)/,R=/\s+$/,c=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|="],U=["!","~","NEW","TYPEOF","DELETE","DO"],N=["&&","||","&","|","^"],F=["<<",">>",">>>"],l=["==","!=","<",">","<=",">="],k=["*","/","%"],H=["IN","OF","INSTANCEOF"],r=["TRUE","FALSE"],O=["NUMBER","REGEX","BOOL","NULL","UNDEFINED","++","--"],M=O.concat(")","}","THIS","IDENTIFIER","STRING","]"),i=["IDENTIFIER","STRING","REGEX",")","]","}","?","::","@","THIS","SUPER"],y=i.concat("NUMBER","BOOL","NULL","UNDEFINED"),x=["INDENT","OUTDENT","TERMINATOR"]}).call(this)},{"./helpers":8,"./rewriter":12}],10:[function(e,t,n){(function(){var t,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K,Q,G,Y,Z,et,tt,nt,rt,it,st,ot,ut,at,ft,lt,ct,ht,pt,dt,vt,mt,gt,yt,bt={}.hasOwnProperty,wt=function(e,t){function r(){this.constructor=e}for(var n in t)bt.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},Et=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},St=[].slice;Error.stackTraceLimit=Infinity,R=e("./scope").Scope,vt=e("./lexer"),B=vt.RESERVED,q=vt.STRICT_PROSCRIBED,mt=e("./helpers"),et=mt.compact,it=mt.flatten,rt=mt.extend,at=mt.merge,tt=mt.del,ct=mt.starts,nt=mt.ends,ot=mt.last,lt=mt.some,Z=mt.addLocationDataFn,ut=mt.locationDataToString,ht=mt.throwSyntaxError,n.extend=rt,n.addLocationDataFn=Z,Y=function(){return!0},M=function(){return!1},V=function(){return this},O=function(){return this.negated=!this.negated,this},n.CodeFragment=c=function(){function e(e,t){var n;this.code=""+t,this.locationData=e!=null?e.locationData:void 0,this.type=(e!=null?(n=e.constructor)!=null?n.name:void 0:void 0)||"unknown"}return e.prototype.toString=function(){return""+this.code+(this.locationData?": "+ut(this.locationData):"")},e}(),st=function(e){var t;return function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(t.code);return i}().join("")},n.Base=s=function(){function e(){}return e.prototype.compile=function(e,t){return st(this.compileToFragments(e,t))},e.prototype.compileToFragments=function(e,t){var n;return e=rt({},e),t&&(e.level=t),n=this.unfoldSoak(e)||this,n.tab=e.indent,e.level===k||!n.isStatement(e)?n.compileNode(e):n.compileClosure(e)},e.prototype.compileClosure=function(e){var t;return(t=this.jumps())&&t.error("cannot use a pure statement in an expression"),e.sharedScope=!0,f.wrap(this).compileNode(e)},e.prototype.cache=function(e,t,n){var r,s;return this.isComplex()?(r=new L(n||e.scope.freeVariable("ref")),s=new i(r,this),t?[s.compileToFragments(e,t),[this.makeCode(r.value)]]:[s,r]):(r=t?this.compileToFragments(e,t):this,[r,r])},e.prototype.cacheToCodeFragments=function(e){return[st(e[0]),st(e[1])]},e.prototype.makeReturn=function(e){var t;return t=this.unwrapAll(),e?new u(new L(""+e+".push"),[t]):new F(t)},e.prototype.contains=function(e){var t;return t=void 0,this.traverseChildren(!1,function(n){if(e(n))return t=n,!1}),t},e.prototype.lastNonComment=function(e){var t;t=e.length;while(t--)if(!(e[t]instanceof h))return e[t];return null},e.prototype.toString=function(e,t){var n;return e==null&&(e=""),t==null&&(t=this.constructor.name),n="\n"+e+t,this.soak&&(n+="?"),this.eachChild(function(t){return n+=t.toString(e+X)}),n},e.prototype.eachChild=function(e){var t,n,r,i,s,o,u,a;if(!this.children)return this;u=this.children;for(r=0,s=u.length;r<s;r++){t=u[r];if(this[t]){a=it([this[t]]);for(i=0,o=a.length;i<o;i++){n=a[i];if(e(n)===!1)return this}}}return this},e.prototype.traverseChildren=function(e,t){return this.eachChild(function(n){var r;r=t(n);if(r!==!1)return n.traverseChildren(e,t)})},e.prototype.invert=function(){return new D("!",this)},e.prototype.unwrapAll=function(){var e;e=this;while(e!==(e=e.unwrap()))continue;return e},e.prototype.children=[],e.prototype.isStatement=M,e.prototype.jumps=M,e.prototype.isComplex=Y,e.prototype.isChainable=M,e.prototype.isAssignable=M,e.prototype.unwrap=V,e.prototype.unfoldSoak=M,e.prototype.assigns=M,e.prototype.updateLocationDataIfMissing=function(e){return this.locationData||(this.locationData=e),this.eachChild(function(t){return t.updateLocationDataIfMissing(e)})},e.prototype.error=function(e){return ht(e,this.locationData)},e.prototype.makeCode=function(e){return new c(this,e)},e.prototype.wrapInBraces=function(e){return[].concat(this.makeCode("("),e,this.makeCode(")"))},e.prototype.joinFragmentArrays=function(e,t){var n,r,i,s,o;n=[];for(i=s=0,o=e.length;s<o;i=++s)r=e[i],i&&n.push(this.makeCode(t)),n=n.concat(r);return n},e}(),n.Block=o=function(e){function t(e){this.expressions=et(it(e||[]))}return wt(t,e),t.prototype.children=["expressions"],t.prototype.push=function(e){return this.expressions.push(e),this},t.prototype.pop=function(){return this.expressions.pop()},t.prototype.unshift=function(e){return this.expressions.unshift(e),this},t.prototype.unwrap=function(){return this.expressions.length===1?this.expressions[0]:this},t.prototype.isEmpty=function(){return!this.expressions.length},t.prototype.isStatement=function(e){var t,n,r,i;i=this.expressions;for(
n=0,r=i.length;n<r;n++){t=i[n];if(t.isStatement(e))return!0}return!1},t.prototype.jumps=function(e){var t,n,r,i;i=this.expressions;for(n=0,r=i.length;n<r;n++){t=i[n];if(t.jumps(e))return t}},t.prototype.makeReturn=function(e){var t,n;n=this.expressions.length;while(n--){t=this.expressions[n];if(!(t instanceof h)){this.expressions[n]=t.makeReturn(e),t instanceof F&&!t.expression&&this.expressions.splice(n,1);break}}return this},t.prototype.compileToFragments=function(e,n){return e==null&&(e={}),e.scope?t.__super__.compileToFragments.call(this,e,n):this.compileRoot(e)},t.prototype.compileNode=function(e){var n,r,i,s,o,u,a,f,l;this.tab=e.indent,u=e.level===k,r=[],l=this.expressions;for(s=a=0,f=l.length;a<f;s=++a)o=l[s],o=o.unwrapAll(),o=o.unfoldSoak(e)||o,o instanceof t?r.push(o.compileNode(e)):u?(o.front=!0,i=o.compileToFragments(e),o.isStatement(e)||(i.unshift(this.makeCode(""+this.tab)),i.push(this.makeCode(";"))),r.push(i)):r.push(o.compileToFragments(e,T));return u?this.spaced?[].concat(this.joinFragmentArrays(r,"\n\n"),this.makeCode("\n")):this.joinFragmentArrays(r,"\n"):(r.length?n=this.joinFragmentArrays(r,", "):n=[this.makeCode("void 0")],r.length>1&&e.level>=T?this.wrapInBraces(n):n)},t.prototype.compileRoot=function(e){var t,n,r,i,s,o,u,a,f,l;e.indent=e.bare?"":X,e.level=k,this.spaced=!0,e.scope=new R(null,this,null),l=e.locals||[];for(a=0,f=l.length;a<f;a++)i=l[a],e.scope.parameter(i);return s=[],e.bare||(o=function(){var e,n,i,s;i=this.expressions,s=[];for(r=e=0,n=i.length;e<n;r=++e){t=i[r];if(!(t.unwrap()instanceof h))break;s.push(t)}return s}.call(this),u=this.expressions.slice(o.length),this.expressions=o,o.length&&(s=this.compileNode(at(e,{indent:""})),s.push(this.makeCode("\n"))),this.expressions=u),n=this.compileWithDeclarations(e),e.bare?n:[].concat(s,this.makeCode("(function() {\n"),n,this.makeCode("\n}).call(this);\n"))},t.prototype.compileWithDeclarations=function(e){var t,n,r,i,s,o,u,a,f,l,c,p,d,v;i=[],o=[],p=this.expressions;for(s=l=0,c=p.length;l<c;s=++l){r=p[s],r=r.unwrap();if(!(r instanceof h||r instanceof L))break}return e=at(e,{level:k}),s&&(u=this.expressions.splice(s,9e9),d=[this.spaced,!1],f=d[0],this.spaced=d[1],v=[this.compileNode(e),f],i=v[0],this.spaced=v[1],this.expressions=u),o=this.compileNode(e),a=e.scope,a.expressions===this&&(n=e.scope.hasDeclarations(),t=a.hasAssignments,n||t?(s&&i.push(this.makeCode("\n")),i.push(this.makeCode(""+this.tab+"var ")),n&&i.push(this.makeCode(a.declaredVariables().join(", "))),t&&(n&&i.push(this.makeCode(",\n"+(this.tab+X))),i.push(this.makeCode(a.assignedVariables().join(",\n"+(this.tab+X))))),i.push(this.makeCode(";\n"+(this.spaced?"\n":"")))):i.length&&o.length&&i.push(this.makeCode("\n"))),i.concat(o)},t.wrap=function(e){return e.length===1&&e[0]instanceof t?e[0]:new t(e)},t}(s),n.Literal=L=function(e){function t(e){this.value=e}return wt(t,e),t.prototype.makeReturn=function(){return this.isStatement()?this:t.__super__.makeReturn.apply(this,arguments)},t.prototype.isAssignable=function(){return m.test(this.value)},t.prototype.isStatement=function(){var e;return(e=this.value)==="break"||e==="continue"||e==="debugger"},t.prototype.isComplex=M,t.prototype.assigns=function(e){return e===this.value},t.prototype.jumps=function(e){if(this.value==="break"&&!((e!=null?e.loop:void 0)||(e!=null?e.block:void 0)))return this;if(this.value==="continue"&&(e!=null?!e.loop:!void 0))return this},t.prototype.compileNode=function(e){var t,n,r;return n=this.value==="this"?((r=e.scope.method)!=null?r.bound:void 0)?e.scope.method.context:this.value:this.value.reserved?'"'+this.value+'"':this.value,t=this.isStatement()?""+this.tab+n+";":n,[this.makeCode(t)]},t.prototype.toString=function(){return' "'+this.value+'"'},t}(s),n.Undefined=function(e){function t(){return gt=t.__super__.constructor.apply(this,arguments),gt}return wt(t,e),t.prototype.isAssignable=M,t.prototype.isComplex=M,t.prototype.compileNode=function(e){return[this.makeCode(e.level>=S?"(void 0)":"void 0")]},t}(s),n.Null=function(e){function t(){return yt=t.__super__.constructor.apply(this,arguments),yt}return wt(t,e),t.prototype.isAssignable=M,t.prototype.isComplex=M,t.prototype.compileNode=function(){return[this.makeCode("null")]},t}(s),n.Bool=function(e){function t(e){this.val=e}return wt(t,e),t.prototype.isAssignable=M,t.prototype.isComplex=M,t.prototype.compileNode=function(){return[this.makeCode(this.val)]},t}(s),n.Return=F=function(e){function t(e){e&&!e.unwrap().isUndefined&&(this.expression=e)}return wt(t,e),t.prototype.children=["expression"],t.prototype.isStatement=Y,t.prototype.makeReturn=V,t.prototype.jumps=V,t.prototype.compileToFragments=function(e,n){var r,i;return r=(i=this.expression)!=null?i.makeReturn():void 0,!r||r instanceof t?t.__super__.compileToFragments.call(this,e,n):r.compileToFragments(e,n)},t.prototype.compileNode=function(e){var t;return t=[],t.push(this.makeCode(this.tab+("return"+(this.expression?" ":"")))),this.expression&&(t=t.concat(this.expression.compileToFragments(e,C))),t.push(this.makeCode(";")),t},t}(s),n.Value=Q=function(e){function t(e,n,r){return!n&&e instanceof t?e:(this.base=e,this.properties=n||[],r&&(this[r]=!0),this)}return wt(t,e),t.prototype.children=["base","properties"],t.prototype.add=function(e){return this.properties=this.properties.concat(e),this},t.prototype.hasProperties=function(){return!!this.properties.length},t.prototype.isArray=function(){return!this.properties.length&&this.base instanceof r},t.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()},t.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()},t.prototype.isSimpleNumber=function(){return this.base instanceof L&&I.test(this.base.value)},t.prototype.isString=function(){return this.base instanceof L&&y.test(this.base.value)},t.prototype.isAtomic=function(){var e,t,n,r;r=this.properties.concat(this.base);for(t=0,n=r.length;t<n;t++){e=r[t];if(e.soak||e instanceof u)return!1}return!0},t.prototype.isStatement=function(e){return!this.properties.length&&this.base.isStatement(e)},t.prototype.assigns=function(e){return!this.properties.length&&this.base.assigns(e)},t.prototype.jumps=function(e){return!this.properties.length&&this.base.jumps(e)},t.prototype.isObject=function(e){return this.properties.length?!1:this.base instanceof _&&(!e||this.base.generated)},t.prototype.isSplice=function(){return ot(this.properties)instanceof U},t.prototype.unwrap=function(){return this.properties.length?this:this.base},t.prototype.cacheReference=function(e){var n,r,s,o;return s=ot(this.properties),this.properties.length<2&&!this.base.isComplex()&&(s!=null?!s.isComplex():!void 0)?[this,this]:(n=new t(this.base,this.properties.slice(0,-1)),n.isComplex()&&(r=new L(e.scope.freeVariable("base")),n=new t(new H(new i(r,n)))),s?(s.isComplex()&&(o=new L(e.scope.freeVariable("name")),s=new E(new i(o,s.index)),o=new E(o)),[n.add(s),new t(r||n.base,[o||s])]):[n,r])},t.prototype.compileNode=function(e){var t,n,r,i,s;this.base.front=this.front,r=this.properties,t=this.base.compileToFragments(e,r.length?S:null),(this.base instanceof H||r.length)&&I.test(st(t))&&t.push(this.makeCode("."));for(i=0,s=r.length;i<s;i++)n=r[i],t.push.apply(t,n.compileToFragments(e));return t},t.prototype.unfoldSoak=function(e){var n=this;return this.unfoldedSoak!=null?this.unfoldedSoak:this.unfoldedSoak=function(){var r,s,o,u,a,f,l,c,h,d;if(o=n.base.unfoldSoak(e))return(h=o.body.properties).push.apply(h,n.properties),o;d=n.properties;for(s=l=0,c=d.length;l<c;s=++l){u=d[s];if(!u.soak)continue;return u.soak=!1,r=new t(n.base,n.properties.slice(0,s)),f=new t(n.base,n.properties.slice(s)),r.isComplex()&&(a=new L(e.scope.freeVariable("ref")),r=new H(new i(a,r)),f.base=a),new b(new p(r),f,{soak:!0})}return!1}()},t}(s),n.Comment=h=function(e){function t(e){this.comment=e}return wt(t,e),t.prototype.isStatement=Y,t.prototype.makeReturn=V,t.prototype.compileNode=function(e,t){var n;return n="/*"+ft(this.comment,this.tab)+(Et.call(this.comment,"\n")>=0?"\n"+this.tab:"")+"*/\n",(t||e.level)===k&&(n=e.indent+n),[this.makeCode(n)]},t}(s),n.Call=u=function(e){function n(e,t,n){this.args=t!=null?t:[],this.soak=n,this.isNew=!1,this.isSuper=e==="super",this.variable=this.isSuper?null:e}return wt(n,e),n.prototype.children=["variable","args"],n.prototype.newInstance=function(){var e,t;return e=((t=this.variable)!=null?t.base:void 0)||this.variable,e instanceof n&&!e.isNew?e.newInstance():this.isNew=!0,this},n.prototype.superReference=function(e){var n,r;return r=e.scope.namedMethod(),(r!=null?r.klass:void 0)?(n=[new t(new L("__super__"))],r["static"]&&n.push(new t(new L("constructor"))),n.push(new t(new L(r.name))),(new Q(new L(r.klass),n)).compile(e)):(r!=null?r.ctor:void 0)?""+r.name+".__super__.constructor":this.error("cannot call super outside of an instance method.")},n.prototype.superThis=function(e){var t;return t=e.scope.method,t&&!t.klass&&t.context||"this"},n.prototype.unfoldSoak=function(e){var t,r,i,s,o,u,a,f,l;if(this.soak){if(this.variable){if(r=pt(e,this,"variable"))return r;f=(new Q(this.variable)).cacheReference(e),i=f[0],o=f[1]}else i=new L(this.superReference(e)),o=new Q(i);return o=new n(o,this.args),o.isNew=this.isNew,i=new L("typeof "+i.compile(e)+' === "function"'),new b(i,new Q(o),{soak:!0})}t=this,s=[];for(;;){if(t.variable instanceof n){s.push(t),t=t.variable;continue}if(!(t.variable instanceof Q))break;s.push(t);if(!((t=t.variable.base)instanceof n))break}l=s.reverse();for(u=0,a=l.length;u<a;u++)t=l[u],r&&(t.variable instanceof n?t.variable=r:t.variable.base=r),r=pt(e,t,"variable");return r},n.prototype.compileNode=function(e){var t,n,r,i,s,o,u,a,f,l;(f=this.variable)!=null&&(f.front=this.front),i=z.compileSplattedArray(e,this.args,!0);if(i.length)return this.compileSplat(e,i);r=[],l=this.args;for(n=u=0,a=l.length;u<a;n=++u)t=l[n],n&&r.push(this.makeCode(", ")),r.push.apply(r,t.compileToFragments(e,T));return s=[],this.isSuper?(o=this.superReference(e)+(".call("+this.superThis(e)),r.length&&(o+=", "),s.push(this.makeCode(o))):(this.isNew&&s.push(this.makeCode("new ")),s.push.apply(s,this.variable.compileToFragments(e,S)),s.push(this.makeCode("("))),s.push.apply(s,r),s.push(this.makeCode(")")),s},n.prototype.compileSplat=function(e,t){var n,r,i,s,o,u;return this.isSuper?[].concat(this.makeCode(""+this.superReference(e)+".apply("+this.superThis(e)+", "),t,this.makeCode(")")):this.isNew?(s=this.tab+X,[].concat(this.makeCode("(function(func, args, ctor) {\n"+s+"ctor.prototype = func.prototype;\n"+s+"var child = new ctor, result = func.apply(child, args);\n"+s+"return Object(result) === result ? result : child;\n"+this.tab+"})("),this.variable.compileToFragments(e,T),this.makeCode(", "),t,this.makeCode(", function(){})"))):(n=[],r=new Q(this.variable),(o=r.properties.pop())&&r.isComplex()?(u=e.scope.freeVariable("ref"),n=n.concat(this.makeCode("("+u+" = "),r.compileToFragments(e,T),this.makeCode(")"),o.compileToFragments(e))):(i=r.compileToFragments(e,S),I.test(st(i))&&(i=this.wrapInBraces(i)),o?(u=st(i),i.push.apply(i,o.compileToFragments(e))):u="null",n=n.concat(i)),n=n.concat(this.makeCode(".apply("+u+", "),t,this.makeCode(")")))},n}(s),n.Extends=d=function(e){function t(e,t){this.child=e,this.parent=t}return wt(t,e),t.prototype.children=["child","parent"],t.prototype.compileToFragments=function(e){return(new u(new Q(new L(dt("extends"))),[this.child,this.parent])).compileToFragments(e)},t}(s),n.Access=t=function(e){function t(e,t){this.name=e,this.name.asKey=!0,this.soak=t==="soak"}return wt(t,e),t.prototype.children=["name"],t.prototype.compileToFragments=function(e){var t;return t=this.name.compileToFragments(e),m.test(st(t))?t.unshift(this.makeCode(".")):(t.unshift(this.makeCode("[")),t.push(this.makeCode("]"))),t},t.prototype.isComplex=M,t}(s),n.Index=E=function(e){function t(e){this.index=e}return wt(t,e),t.prototype.children=["index"],t.prototype.compileToFragments=function(e){return[].concat(this.makeCode("["),this.index.compileToFragments(e,C),this.makeCode("]"))},t.prototype.isComplex=function(){return this.index.isComplex()},t}(s),n.Range=j=function(e){function t(e,t,n){this.from=e,this.to=t,this.exclusive=n==="exclusive",this.equals=this.exclusive?"":"="}return wt(t,e),t.prototype.children=["from","to"],t.prototype.compileVariables=function(e){var t,n,r,i,s;e=at(e,{top:!0}),n=this.cacheToCodeFragments(this.from.cache(e,T)),this.fromC=n[0],this.fromVar=n[1],r=this.cacheToCodeFragments(this.to.cache(e,T)),this.toC=r[0],this.toVar=r[1];if(t=tt(e,"step"))i=this.cacheToCodeFragments(t.cache(e,T)),this.step=i[0],this.stepVar=i[1];s=[this.fromVar.match(I),this.toVar.match(I)],this.fromNum=s[0],this.toNum=s[1];if(this.stepVar)return this.stepNum=this.stepVar.match(I)},t.prototype.compileNode=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d;return this.fromVar||this.compileVariables(e),e.index?(u=this.fromNum&&this.toNum,s=tt(e,"index"),o=tt(e,"name"),f=o&&o!==s,h=""+s+" = "+this.fromC,this.toC!==this.toVar&&(h+=", "+this.toC),this.step!==this.stepVar&&(h+=", "+this.step),p=[""+s+" <"+this.equals,""+s+" >"+this.equals],a=p[0],i=p[1],n=this.stepNum?+this.stepNum>0?""+a+" "+this.toVar:""+i+" "+this.toVar:u?(d=[+this.fromNum,+this.toNum],r=d[0],c=d[1],d,r<=c?""+a+" "+c:""+i+" "+c):(t=this.stepVar?""+this.stepVar+" > 0":""+this.fromVar+" <= "+this.toVar,""+t+" ? "+a+" "+this.toVar+" : "+i+" "+this.toVar),l=this.stepVar?""+s+" += "+this.stepVar:u?f?r<=c?"++"+s:"--"+s:r<=c?""+s+"++":""+s+"--":f?""+t+" ? ++"+s+" : --"+s:""+t+" ? "+s+"++ : "+s+"--",f&&(h=""+o+" = "+h),f&&(l=""+o+" = "+l),[this.makeCode(""+h+"; "+n+"; "+l)]):this.compileArray(e)},t.prototype.compileArray=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v;if(this.fromNum&&this.toNum&&Math.abs(this.fromNum-this.toNum)<=20)return f=function(){v=[];for(var e=p=+this.fromNum,t=+this.toNum;p<=t?e<=t:e>=t;p<=t?e++:e--)v.push(e);return v}.apply(this),this.exclusive&&f.pop(),[this.makeCode("["+f.join(", ")+"]")];o=this.tab+X,s=e.scope.freeVariable("i"),l=e.scope.freeVariable("results"),a="\n"+o+l+" = [];",this.fromNum&&this.toNum?(e.index=s,n=st(this.compileNode(e))):(c=""+s+" = "+this.fromC+(this.toC!==this.toVar?", "+this.toC:""),r=""+this.fromVar+" <= "+this.toVar,n="var "+c+"; "+r+" ? "+s+" <"+this.equals+" "+this.toVar+" : "+s+" >"+this.equals+" "+this.toVar+"; "+r+" ? "+s+"++ : "+s+"--"),u="{ "+l+".push("+s+"); }\n"+o+"return "+l+";\n"+e.indent,i=function(e){return e!=null?e.contains(function(e){return e instanceof L&&e.value==="arguments"&&!e.asKey}):void 0};if(i(this.from)||i(this.to))t=", arguments";return[this.makeCode("(function() {"+a+"\n"+o+"for ("+n+")"+u+"}).apply(this"+(t!=null?t:"")+")")]},t}(s),n.Slice=U=function(e){function t(e){this.range=e,t.__super__.constructor.call(this)}return wt(t,e),t.prototype.children=["range"],t.prototype.compileNode=function(e){var t,n,r,i,s,o,u;u=this.range,s=u.to,r=u.from,i=r&&r.compileToFragments(e,C)||[this.makeCode("0")];if(s){t=s.compileToFragments(e,C),n=st(t);if(!!this.range.exclusive||+n!==-1)o=", "+(this.range.exclusive?n:I.test(n)?""+(+n+1):(t=s.compileToFragments(e,S),"+"+st(t)+" + 1 || 9e9"))}return[this.makeCode(".slice("+st(i)+(o||"")+")")]},t}(s),n.Obj=_=function(e){function t(e,t){this.generated=t!=null?t:!1,this.objects=this.properties=e||[]}return wt(t,e),t.prototype.children=["properties"],t.prototype.compileNode=function(e){var t,n,r,s,o,u,a,f,l,c,p,d,v;l=this.properties;if(!l.length)return[this.makeCode(this.front?"({})":"{}")];if(this.generated)for(c=0,d=l.length;c<d;c++)a=l[c],a instanceof Q&&a.error("cannot have an implicit value in an implicit object");r=e.indent+=X,u=this.lastNonComment(this.properties),t=[];for(n=p=0,v=l.length;p<v;n=++p)f=l[n],o=n===l.length-1?"":f===u||f instanceof h?"\n":",\n",s=f instanceof h?"":r,f instanceof i&&f.variable instanceof Q&&f.variable.hasProperties()&&f.variable.error("Invalid object key"),f instanceof Q&&f["this"]&&(f=new i(f.properties[0].name,f,"object")),f instanceof h||(f instanceof i||(f=new i(f,f,"object")),(f.variable.base||f.variable).asKey=!0),s&&t.push(this.makeCode(s)),t.push.apply(t,f.compileToFragments(e,k)),o&&t.push(this.makeCode(o));return t.unshift(this.makeCode("{"+(l.length&&"\n"))),t.push(this.makeCode(""+(l.length&&"\n"+this.tab)+"}")),this.front?this.wrapInBraces(t):t},t.prototype.assigns=function(e){var t,n,r,i;i=this.properties;for(n=0,r=i.length;n<r;n++){t=i[n];if(t.assigns(e))return!0}return!1},t}(s),n.Arr=r=function(e){function t(e){this.objects=e||[]}return wt(t,e),t.prototype.children=["objects"],t.prototype.compileNode=function(e){var t,n,r,i,s,o,u;if(!this.objects.length)return[this.makeCode("[]")];e.indent+=X,t=z.compileSplattedArray(e,this.objects);if(t.length)return t;t=[],n=function(){var t,n,r,i;r=this.objects,i=[];for(t=0,n=r.length;t<n;t++)s=r[t],i.push(s.compileToFragments(e,T));return i}.call(this);for(i=o=0,u=n.length;o<u;i=++o)r=n[i],i&&t.push(this.makeCode(", ")),t.push.apply(t,r);return st(t).indexOf("\n")>=0?(t.unshift(this.makeCode("[\n"+e.indent)),t.push(this.makeCode("\n"+this.tab+"]"))):(t.unshift(this.makeCode("[")),t.push(this.makeCode("]"))),t},t.prototype.assigns=function(e){var t,n,r,i;i=this.objects;for(n=0,r=i.length;n<r;n++){t=i[n];if(t.assigns(e))ret