Add missing function to parse-js.

This commit is contained in:
Jürg Lehni 2011-03-04 00:44:15 +00:00
parent 6619447aa1
commit b6d1be14ca
2 changed files with 45 additions and 41 deletions

82
lib/parse-js-min.js vendored
View file

@ -1,44 +1,44 @@
var parse_js=new (function(){function $(g){g=g.charCodeAt(0);return g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122}function ha(g){return $(g)||g=="$"||g=="_"}function ia(g){g=g.charCodeAt(0);return g>=48&&g<=57}function va(g){if(wa.test(g))return parseInt(g.substr(2),16);else if(xa.test(g))return parseInt(g.substr(1),8);else if(ya.test(g))return parseFloat(g)}function ja(g,d,l,j){this.message=g;this.line=d;this.col=l;this.pos=j;try{({})()}catch(r){this.stack=r.stack}}function ka(g,d,l,j){throw new ja(g,
d,l,j);}function aa(g,d,l){return g.type==d&&(l==null||g.value==l)}function la(g){function d(){return o.text.charAt(o.pos)}function l(a){var b=o.text.charAt(o.pos++);if(a&&!b)throw ba;if(b=="\n"){o.newline_before=true;++o.line;o.col=0}else++o.col;return b}function j(a,b){a=o.text.indexOf(a,o.pos);if(b&&a==-1)throw ba;return a}function r(){o.tokline=o.line;o.tokcol=o.col;o.tokpos=o.pos}function i(a,b,c){o.regex_allowed=a=="operator"&&!x(ma,b)||a=="keyword"&&x(za,b)||a=="punc"&&x(Aa,b);a={type:a,value:b,
line:o.tokline,col:o.tokcol,pos:o.tokpos,nlb:o.newline_before};if(!c){a.comments_before=o.comments_before;o.comments_before=[]}o.newline_before=false;return a}function f(){for(;x(Ba,d());)l()}function k(a){for(var b="",c=d(),n=0;c&&a(c,n++);){b+=l();c=d()}return b}function p(a){ka(a,o.tokline,o.tokcol,o.tokpos)}function s(a){var b=false,c=false,n=false,u=a==".",B=k(function(I,S){if(I=="x"||I=="X"){if(n)return false;return n=true}if(!n&&(I=="E"||I=="e")){if(b)return false;return b=c=true}if(I=="-"){if(c||
S==0&&!a)return true;return false}if(I=="+")return c;c=false;if(I=="."){if(!u)return u=true;return false}return $(I)});if(a)B=a+B;var X=va(B);if(isNaN(X))p("Invalid syntax: "+B);else return i("num",X)}function R(){var a=l(true);switch(a){case "n":return"\n";case "r":return"\r";case "t":return"\t";case "b":return"\u0008";case "v":return"\u000b";case "f":return"\u000c";case "0":return"\u0000";case "x":return String.fromCharCode(w(2));case "u":return String.fromCharCode(w(4));default:return a}}function w(a){for(var b=
var parse_js=new (function(){function aa(f){f=f.charCodeAt(0);return f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122}function ia(f){return aa(f)||f=="$"||f=="_"}function ja(f){f=f.charCodeAt(0);return f>=48&&f<=57}function wa(f){if(xa.test(f))return parseInt(f.substr(2),16);else if(ya.test(f))return parseInt(f.substr(1),8);else if(za.test(f))return parseFloat(f)}function ka(f,d,l,j){this.message=f;this.line=d;this.col=l;this.pos=j;try{({})()}catch(r){this.stack=r.stack}}function la(f,d,l,j){throw new ka(f,
d,l,j);}function ba(f,d,l){return f.type==d&&(l==null||f.value==l)}function ma(f){function d(){return o.text.charAt(o.pos)}function l(a){var b=o.text.charAt(o.pos++);if(a&&!b)throw ca;if(b=="\n"){o.newline_before=true;++o.line;o.col=0}else++o.col;return b}function j(a,b){a=o.text.indexOf(a,o.pos);if(b&&a==-1)throw ca;return a}function r(){o.tokline=o.line;o.tokcol=o.col;o.tokpos=o.pos}function i(a,b,c){o.regex_allowed=a=="operator"&&!x(na,b)||a=="keyword"&&x(Aa,b)||a=="punc"&&x(Ba,b);a={type:a,value:b,
line:o.tokline,col:o.tokcol,pos:o.tokpos,nlb:o.newline_before};if(!c){a.comments_before=o.comments_before;o.comments_before=[]}o.newline_before=false;return a}function g(){for(;x(Ca,d());)l()}function k(a){for(var b="",c=d(),n=0;c&&a(c,n++);){b+=l();c=d()}return b}function p(a){la(a,o.tokline,o.tokcol,o.tokpos)}function s(a){var b=false,c=false,n=false,u=a==".",B=k(function(I,S){if(I=="x"||I=="X"){if(n)return false;return n=true}if(!n&&(I=="E"||I=="e")){if(b)return false;return b=c=true}if(I=="-"){if(c||
S==0&&!a)return true;return false}if(I=="+")return c;c=false;if(I=="."){if(!u)return u=true;return false}return aa(I)});if(a)B=a+B;var X=wa(B);if(isNaN(X))p("Invalid syntax: "+B);else return i("num",X)}function R(){var a=l(true);switch(a){case "n":return"\n";case "r":return"\r";case "t":return"\t";case "b":return"\u0008";case "v":return"\u000b";case "f":return"\u000c";case "0":return"\u0000";case "x":return String.fromCharCode(w(2));case "u":return String.fromCharCode(w(4));default:return a}}function w(a){for(var b=
0;a>0;--a){var c=parseInt(l(true),16);isNaN(c)&&p("Invalid hex-character pattern in string");b=b<<4|c}return b}function F(){return K("Unterminated string constant",function(){for(var a=l(),b="";;){var c=l(true);if(c=="\\")c=R();else if(c==a)break;b+=c}return i("string",b)})}function G(){l();var a=j("\n"),b;if(a==-1){b=o.text.substr(o.pos);o.pos=o.text.length}else{b=o.text.substring(o.pos,a);o.pos=a}return i("comment1",b,true)}function t(){l();return K("Unterminated multiline comment",function(){var a=
j("*/",true),b=o.text.substring(o.pos,a),c=i("comment2",b,true);o.pos=a+2;o.line+=b.split("\n").length-1;o.newline_before=b.indexOf("\n")>=0;return c})}function H(){return K("Unterminated regular expression",function(){for(var a=false,b="",c,n=false;c=l(true);)if(a){b+="\\"+c;a=false}else if(c=="["){n=true;b+=c}else if(c=="]"&&n){n=false;b+=c}else if(c=="/"&&!n)break;else if(c=="\\")a=true;else b+=c;a=k(function(u){return x(Ca,u)});return i("regexp",[b,a])})}function M(a){function b(c){if(!d())return c;
var n=c+d();if(x(Y,n)){l();return b(n)}else return c}return i("operator",b(a||l()))}function q(){l();var a=o.regex_allowed;switch(d()){case "/":o.comments_before.push(G());o.regex_allowed=a;return N();case "*":o.comments_before.push(t());o.regex_allowed=a;return N()}return o.regex_allowed?H():M("/")}function P(){l();return ia(d())?s("."):i("punc",".")}function A(){var a=k(ha);return!x(na,a)?i("name",a):x(Y,a)?i("operator",a):x(oa,a)?i("atom",a):i("keyword",a)}function K(a,b){try{return b()}catch(c){if(c===
ba)p(a);else throw c;}}function N(a){if(a)return H();f();r();a=d();if(!a)return i("eof");if(ia(a))return s();if(a=='"'||a=="'")return F();if(x(Da,a))return i("punc",l());if(a==".")return P();if(a=="/")return q();if(x(Ea,a))return M();if(ha(a))return A();p("Unexpected character '"+a+"'")}var o={text:g.replace(/\r\n?|[\n\u2028\u2029]/g,"\n").replace(/^\uFEFF/,""),pos:0,tokpos:0,line:0,tokline:0,col:0,tokcol:0,newline_before:false,regex_allowed:false,comments_before:[]};N.context=function(a){if(a)o=
a;return o};return N}function ca(g,d,l){this.name=g;this.start=d;this.end=l}function Fa(g,d,l){function j(e,h){return aa(m.token,e,h)}function r(){return m.peeked||(m.peeked=m.input())}function i(){m.prev=m.token;if(m.peeked){m.token=m.peeked;m.peeked=null}else m.token=m.input();return m.token}function f(){return m.prev}function k(e,h,v,z){var Q=m.input.context();ka(e,h!=null?h:Q.tokline,v!=null?v:Q.tokcol,z!=null?z:Q.tokpos)}function p(e,h){k(h,e.line,e.col)}function s(e){if(e==null)e=m.token;p(e,
"Unexpected token: "+e.type+" ("+e.value+")")}function R(e,h){if(j(e,h))return i();p(m.token,"Unexpected token "+m.token.type+", expected "+e)}function w(e){return R("punc",e)}function F(){return!d&&(m.token.nlb||j("eof")||j("punc","}"))}function G(){if(j("punc",";"))i();else F()||s()}function t(){return O(arguments)}function H(){w("(");var e=C();w(")");return e}function M(e,h,v){return e instanceof ca?e:new ca(e,h,v)}function q(){if(j("operator","/")){m.peeked=null;m.token=m.input(true)}switch(m.token.type){case "num":case "string":case "regexp":case "operator":case "atom":return A();
case "name":return aa(r(),"punc",":")?P(D(m.token.value,i,i)):A();case "punc":switch(m.token.value){case "{":return t("block",b());case "[":case "(":return A();case ";":i();return t("block");default:s()}case "keyword":switch(D(m.token.value,i)){case "break":return K("break");case "continue":return K("continue");case "debugger":G();return t("debugger");case "do":return function(e){R("keyword","while");return t("do",D(H,G),e)}(T(J));case "for":return N();case "function":return da(true);case "if":return a();
case "return":m.in_function==0&&k("'return' outside of function");return t("return",j("punc",";")?(i(),null):F()?null:D(C,G));case "switch":return t("switch",H(),Ga());case "throw":return t("throw",D(C,G));case "try":return c();case "var":return D(u,G);case "const":return D(B,G);case "while":return t("while",H(),T(J));case "with":return t("with",H(),J());default:s()}}}function P(e){m.labels.push(e);var h=m.token,v=J();d&&!x(Ha,v[0])&&s(h);m.labels.pop();return t("label",e,v)}function A(){return t("stat",
D(C,G))}function K(e){var h=j("name")?m.token.value:null;if(h!=null){i();U(h,m.labels)||k("Label "+h+" without matching loop or statement")}else m.in_loop==0&&k(e+" not inside a loop or switch");G();return t(e,h)}function N(){w("(");var e=j("keyword","var");e&&i();if(j("name")&&aa(r(),"operator","in")){var h=m.token.value;i();i();var v=C();w(")");return t("for-in",e,h,v,T(J))}else{e=j("punc",";")?null:e?u():C();w(";");h=j("punc",";")?null:C();w(";");v=j("punc",")")?null:C();w(")");return t("for",
j("*/",true),b=o.text.substring(o.pos,a),c=i("comment2",b,true);o.pos=a+2;o.line+=b.split("\n").length-1;o.newline_before=b.indexOf("\n")>=0;return c})}function H(){return K("Unterminated regular expression",function(){for(var a=false,b="",c,n=false;c=l(true);)if(a){b+="\\"+c;a=false}else if(c=="["){n=true;b+=c}else if(c=="]"&&n){n=false;b+=c}else if(c=="/"&&!n)break;else if(c=="\\")a=true;else b+=c;a=k(function(u){return x(Da,u)});return i("regexp",[b,a])})}function M(a){function b(c){if(!d())return c;
var n=c+d();if(x(Y,n)){l();return b(n)}else return c}return i("operator",b(a||l()))}function q(){l();var a=o.regex_allowed;switch(d()){case "/":o.comments_before.push(G());o.regex_allowed=a;return N();case "*":o.comments_before.push(t());o.regex_allowed=a;return N()}return o.regex_allowed?H():M("/")}function P(){l();return ja(d())?s("."):i("punc",".")}function A(){var a=k(ia);return!x(oa,a)?i("name",a):x(Y,a)?i("operator",a):x(pa,a)?i("atom",a):i("keyword",a)}function K(a,b){try{return b()}catch(c){if(c===
ca)p(a);else throw c;}}function N(a){if(a)return H();g();r();a=d();if(!a)return i("eof");if(ja(a))return s();if(a=='"'||a=="'")return F();if(x(Ea,a))return i("punc",l());if(a==".")return P();if(a=="/")return q();if(x(Fa,a))return M();if(ia(a))return A();p("Unexpected character '"+a+"'")}var o={text:f.replace(/\r\n?|[\n\u2028\u2029]/g,"\n").replace(/^\uFEFF/,""),pos:0,tokpos:0,line:0,tokline:0,col:0,tokcol:0,newline_before:false,regex_allowed:false,comments_before:[]};N.context=function(a){if(a)o=
a;return o};return N}function da(f,d,l){this.name=f;this.start=d;this.end=l}function Ga(f,d,l){function j(e,h){return ba(m.token,e,h)}function r(){return m.peeked||(m.peeked=m.input())}function i(){m.prev=m.token;if(m.peeked){m.token=m.peeked;m.peeked=null}else m.token=m.input();return m.token}function g(){return m.prev}function k(e,h,v,z){var Q=m.input.context();la(e,h!=null?h:Q.tokline,v!=null?v:Q.tokcol,z!=null?z:Q.tokpos)}function p(e,h){k(h,e.line,e.col)}function s(e){if(e==null)e=m.token;p(e,
"Unexpected token: "+e.type+" ("+e.value+")")}function R(e,h){if(j(e,h))return i();p(m.token,"Unexpected token "+m.token.type+", expected "+e)}function w(e){return R("punc",e)}function F(){return!d&&(m.token.nlb||j("eof")||j("punc","}"))}function G(){if(j("punc",";"))i();else F()||s()}function t(){return O(arguments)}function H(){w("(");var e=C();w(")");return e}function M(e,h,v){return e instanceof da?e:new da(e,h,v)}function q(){if(j("operator","/")){m.peeked=null;m.token=m.input(true)}switch(m.token.type){case "num":case "string":case "regexp":case "operator":case "atom":return A();
case "name":return ba(r(),"punc",":")?P(D(m.token.value,i,i)):A();case "punc":switch(m.token.value){case "{":return t("block",b());case "[":case "(":return A();case ";":i();return t("block");default:s()}case "keyword":switch(D(m.token.value,i)){case "break":return K("break");case "continue":return K("continue");case "debugger":G();return t("debugger");case "do":return function(e){R("keyword","while");return t("do",D(H,G),e)}(T(J));case "for":return N();case "function":return ea(true);case "if":return a();
case "return":m.in_function==0&&k("'return' outside of function");return t("return",j("punc",";")?(i(),null):F()?null:D(C,G));case "switch":return t("switch",H(),Ha());case "throw":return t("throw",D(C,G));case "try":return c();case "var":return D(u,G);case "const":return D(B,G);case "while":return t("while",H(),T(J));case "with":return t("with",H(),J());default:s()}}}function P(e){m.labels.push(e);var h=m.token,v=J();d&&!x(Ia,v[0])&&s(h);m.labels.pop();return t("label",e,v)}function A(){return t("stat",
D(C,G))}function K(e){var h=j("name")?m.token.value:null;if(h!=null){i();U(h,m.labels)||k("Label "+h+" without matching loop or statement")}else m.in_loop==0&&k(e+" not inside a loop or switch");G();return t(e,h)}function N(){w("(");var e=j("keyword","var");e&&i();if(j("name")&&ba(r(),"operator","in")){var h=m.token.value;i();i();var v=C();w(")");return t("for-in",e,h,v,T(J))}else{e=j("punc",";")?null:e?u():C();w(";");h=j("punc",";")?null:C();w(";");v=j("punc",")")?null:C();w(")");return t("for",
e,h,v,T(J))}}function o(e){var h=j("name")?D(m.token.value,i):null;e&&!h&&s();w("(");return t(e?"defun":"function",h,function(v,z){for(;!j("punc",")");){if(v)v=false;else w(",");j("name")||s();z.push(m.token.value);i()}i();return z}(true,[]),function(){++m.in_function;var v=m.in_loop;m.in_loop=0;var z=b();--m.in_function;m.in_loop=v;return z}())}function a(){var e=H(),h=J(),v;if(j("keyword","else")){i();v=J()}return t("if",e,h,v)}function b(){w("{");for(var e=[];!j("punc","}");){j("eof")&&s();e.push(J())}i();
return e}function c(){var e=b(),h,v;if(j("keyword","catch")){i();w("(");j("name")||k("Name expected");h=m.token.value;i();w(")");h=[h,b()]}if(j("keyword","finally")){i();v=b()}!h&&!v&&k("Missing catch/finally blocks");return t("try",e,h,v)}function n(){for(var e=[];;){j("name")||s();var h=m.token.value;i();if(j("operator","=")){i();e.push([h,C(false)])}else e.push([h]);if(!j("punc",","))break;i()}return e}function u(){return t("var",n())}function B(){return t("const",n())}function X(){var e=I(false),
h;if(j("punc","(")){i();h=S(")")}else h=[];return L(t("new",e,h),true)}function I(e){if(j("operator","new")){i();return X()}if(j("operator")&&x(Ia,m.token.value))return pa("unary-prefix",D(m.token.value,i),I(e));if(j("punc")){switch(m.token.value){case "(":i();return L(D(C,Z(w,")")),e);case "[":i();return L(Ja(),e);case "{":i();return L(Ka(),e)}s()}if(j("keyword","function")){i();return L(da(false),e)}if(x(La,m.token.type)){var h=m.token.type=="regexp"?t("regexp",m.token.value[0],m.token.value[1]):
t(m.token.type,m.token.value);return L(D(h,i),e)}s()}function S(e,h,v){for(var z=true,Q=[];!j("punc",e);){if(z)z=false;else w(",");if(h&&j("punc",e))break;j("punc",",")&&v?Q.push(["atom","undefined"]):Q.push(C(false))}i();return Q}function Ja(){return t("array",S("]",!d,true))}function Ka(){for(var e=true,h=[];!j("punc","}");){if(e)e=false;else w(",");if(!d&&j("punc","}"))break;var v=m.token.type,z=Ma();if(v=="name"&&(z=="get"||z=="set")&&!j("punc",":"))h.push([ea(),da(false),z]);else{w(":");h.push([z,
C(false)])}}i();return t("object",h)}function Ma(){switch(m.token.type){case "num":case "string":return D(m.token.value,i)}return ea()}function ea(){switch(m.token.type){case "name":case "operator":case "keyword":case "atom":return D(m.token.value,i);default:s()}}function L(e,h){if(j("punc",".")){i();return L(t("dot",e,ea()),h)}if(j("punc","[")){i();return L(t("sub",e,D(C,Z(w,"]"))),h)}if(h&&j("punc","(")){i();return L(t("call",e,S(")")),true)}if(h&&j("operator")&&x(ma,m.token.value))return D(Z(pa,
"unary-postfix",m.token.value,e),i);return e}function pa(e,h,v){if((h=="++"||h=="--")&&!qa(v))k("Invalid use of "+h+" operator");return t(e,h,v)}function fa(e,h){var v=j("operator")?m.token.value:null,z=v!=null?V[v]:null;if(z!=null&&z>h){i();z=fa(I(true),z);return fa(t("binary",v,e,z),h)}return e}function Na(){return fa(I(true),0)}function Oa(){var e=Na();if(j("operator","?")){i();var h=C(false);w(":");return t("conditional",e,h,C(false))}return e}function qa(e){switch(e[0]){case "dot":case "sub":return true;
case "name":return e[1]!="this"}}function ra(){var e=Oa(),h=m.token.value;if(j("operator")&&x(sa,h)){if(qa(e)){i();return t("assign",sa[h],e,ra())}k("Invalid assignment")}return e}function C(e){if(arguments.length==0)e=true;var h=ra();if(e&&j("punc",",")){i();return t("seq",h,C())}return h}function T(e){try{++m.in_loop;return e()}finally{--m.in_loop}}var m={input:typeof g=="string"?la(g,true):g,token:null,prev:null,peeked:null,in_function:0,in_loop:0,labels:[]};m.token=i();var J=l?function(){var e=
m.token,h=q.apply(this,arguments);h[0]=M(h[0],e,f());return h}:q,da=l?function(){var e=f(),h=o.apply(this,arguments);h[0]=M(h[0],e,f());return h}:o,Ga=Z(T,function(){w("{");for(var e=[],h=null;!j("punc","}");){j("eof")&&s();if(j("keyword","case")){i();h=[];e.push([C(),h]);w(":")}else if(j("keyword","default")){i();w(":");h=[];e.push([null,h])}else{h||s();h.push(J())}}i();return e});return t("toplevel",function(e){for(;!j("eof");)e.push(J());return e}([]))}function ta(){function g(f){return[this[0],
y(f,function(k){var p=[k[0]];if(k.length>1)p[1]=d(k[1]);return p})]}function d(f){if(f==null)return null;try{i.push(f);var k=f[0],p=r[k];if(p){var s=p.apply(f,f.slice(1));if(s!=null)return s}p=j[k];return p.apply(f,f.slice(1))}finally{i.pop()}}function l(f,k){var p={},s;for(s in f)if(x(f,s)){p[s]=r[s];r[s]=f[s]}f=k();for(s in p)if(x(p,s))if(p[s])r[s]=p[s];else delete r[s];return f}var j={string:function(f){return[this[0],f]},num:function(f){return[this[0],f]},name:function(f){return[this[0],f]},toplevel:function(f){return[this[0],
y(f,d)]},block:function(f){var k=[this[0]];f!=null&&k.push(y(f,d));return k},"var":g,"const":g,"try":function(f,k,p){return[this[0],y(f,d),k!=null?[k[0],y(k[1],d)]:null,p!=null?y(p,d):null]},"throw":function(f){return[this[0],d(f)]},"new":function(f,k){return[this[0],d(f),y(k,d)]},"switch":function(f,k){return[this[0],d(f),y(k,function(p){return[p[0]?d(p[0]):null,y(p[1],d)]})]},"break":function(f){return[this[0],f]},"continue":function(f){return[this[0],f]},conditional:function(f,k,p){return[this[0],
d(f),d(k),d(p)]},assign:function(f,k,p){return[this[0],f,d(k),d(p)]},dot:function(f){return[this[0],d(f)].concat(O(arguments,1))},call:function(f,k){return[this[0],d(f),y(k,d)]},"function":function(f,k,p){return[this[0],f,k.slice(),y(p,d)]},defun:function(f,k,p){return[this[0],f,k.slice(),y(p,d)]},"if":function(f,k,p){return[this[0],d(f),d(k),d(p)]},"for":function(f,k,p,s){return[this[0],d(f),d(k),d(p),d(s)]},"for-in":function(f,k,p,s){return[this[0],f,k,d(p),d(s)]},"while":function(f,k){return[this[0],
d(f),d(k)]},"do":function(f,k){return[this[0],d(f),d(k)]},"return":function(f){return[this[0],d(f)]},binary:function(f,k,p){return[this[0],f,d(k),d(p)]},"unary-prefix":function(f,k){return[this[0],f,d(k)]},"unary-postfix":function(f,k){return[this[0],f,d(k)]},sub:function(f,k){return[this[0],d(f),d(k)]},object:function(f){return[this[0],y(f,function(k){return k.length==2?[k[0],d(k[1])]:[k[0],d(k[1]),k[2]]})]},regexp:function(f,k){return[this[0],f,k]},array:function(f){return[this[0],y(f,d)]},stat:function(f){return[this[0],
d(f)]},seq:function(){return[this[0]].concat(y(O(arguments),d))},label:function(f,k){return[this[0],f,d(k)]},"with":function(f,k){return[this[0],d(f),d(k)]},atom:function(f){return[this[0],f]}},r={},i=[];return{walk:d,with_walkers:l,parent:function(){return i[i.length-2]},stack:function(){return i}}}function ga(g){var d=0,l=0;g=g.replace(/[\\\b\f\n\r\t\x22\x27]/g,function(j){switch(j){case "\\":return"\\\\";case "\u0008":return"\\b";case "\u000c":return"\\f";case "\n":return"\\n";case "\r":return"\\r";
case "\t":return"\\t";case '"':++d;return'"';case "'":++l;return"'"}return j});return d>l?"'"+g.replace(/\x27/g,"\\'")+"'":'"'+g.replace(/\x22/g,'\\"')+'"'}function Pa(g,d){function l(a){if(a==null)a="";if(d)a=ua(" ",d.indent_start+P*d.indent_level)+a;return a}function j(a,b){if(b==null)b=1;P+=b;try{return a.apply(null,O(arguments,1))}finally{P-=b}}function r(a){if(d)return a.join(" ");for(var b=[],c=0;c<a.length;++c){var n=a[c+1];b.push(a[c]);if(n&&(/[a-z0-9_\x24]$/i.test(a[c].toString())&&/^[a-z0-9_\x24]/i.test(n.toString())||
/[\+\-]$/.test(a[c].toString())&&/^[\+\-]/.test(n.toString())))b.push(" ")}return b.join("")}function i(a){return a.join(","+K)}function f(a){for(var b=q(a),c=1;c<arguments.length;++c){var n=arguments[c];if(n instanceof Function&&n(a)||a[0]==n)return"("+b+")"}return b}function k(a){if(a.length==1)return a[0];if(a.length==2){var b=a[1];a=a[0];return a.length<=b.length?a:b}return k([a[0],k(a.slice(1))])}function p(a){if(a[0]=="function")for(var b=O(o),c=b.pop(),n=b.pop();n;){if(n[0]=="stat")return true;
if(n[0]=="seq"&&n[1]===c||n[0]=="call"&&n[1]===c||n[0]=="binary"&&n[2]===c){c=n;n=b.pop()}else return false}return!x(Qa,a[0])}function s(a){var b=a.toString(10),c=[b.replace(/^0\./,".")];if(Math.floor(a)===a){c.push("0x"+a.toString(16).toLowerCase(),"0"+a.toString(8));if(a=/^(.*?)(0+)$/.exec(a))c.push(a[1]+"e"+a[2].length)}else if(a=/^0?\.(0+)(.*)$/.exec(a))c.push(a[2]+"e-"+(a[1].length+a[2].length),b.substr(b.indexOf(".")));return k(c)}function R(a){if(a[0]=="do")return q(["block",[a]]);for(var b=
a;;){var c=b[0];if(c=="if"){if(!b[3])return q(["block",[a]]);b=b[3]}else if(c=="while"||c=="do")b=b[2];else if(c=="for"||c=="for-in")b=b[4];else break}return q(a)}function w(a,b,c,n){n=n||"function";if(a)n+=" "+F(a);n+="("+i(y(b,F))+")";return r([n,H(c)])}function F(a){return a.toString()}function G(a){for(var b=[],c=a.length-1,n=0;n<=c;++n){var u=a[n],B=q(u);if(B!=";"){if(!d&&n==c)B=u[0]=="while"&&empty(u[2])||U(u[0],["for","for-in"])&&empty(u[4])||u[0]=="if"&&empty(u[2])&&!u[3]||u[0]=="if"&&u[3]&&
empty(u[3])?B.replace(/;*\s*$/,";"):B.replace(/;+\s*$/,"");b.push(B)}}return y(b,l)}function t(a){var b=a.length;if(b==0)return"{}";return"{"+A+y(a,function(c,n){var u=c[1].length>0,B=j(function(){return l(c[0]?r(["case",q(c[0])+":"]):"default:")},0.5)+(u?A+j(function(){return G(c[1]).join(A)}):"");if(!d&&u&&n<b-1)B+=";";return B}).join(A)+A+l("}")}function H(a){if(!a)return";";if(a.length==0)return"{}";return"{"+A+j(function(){return G(a).join(A)})+A+l("}")}function M(a){var b=a[0];a=a[1];if(a!=
null)b=r([b,"=",q(a)]);return b}function q(a){var b=a[0],c=N[b];if(!c)throw new Error("Can't find generator for \""+b+'"');o.push(a);a=c.apply(b,a.slice(1));o.pop();return a}if(d)d=Ra(d,{indent_start:0,indent_level:4,quote_keys:false,space_colon:false});var P=0,A=d?"\n":"",K=d?" ":"",N={string:ga,num:s,name:F,toplevel:function(a){return G(a).join(A+A)},block:H,"var":function(a){return"var "+i(y(a,M))+";"},"const":function(a){return"const "+i(y(a,M))+";"},"try":function(a,b,c){a=["try",H(a)];b&&a.push("catch",
"("+b[0]+")",H(b[1]));c&&a.push("finally",H(c));return r(a)},"throw":function(a){return r(["throw",q(a)])+";"},"new":function(a,b){b=b.length>0?"("+i(y(b,q))+")":"";return r(["new",f(a,"seq","binary","conditional","assign",function(c){var n=ta(),u={};try{n.with_walkers({call:function(){throw u;},"function":function(){return this}},function(){n.walk(c)})}catch(B){if(B===u)return true;throw B;}})+b])},"switch":function(a,b){return r(["switch","("+q(a)+")",t(b)])},"break":function(a){var b="break";if(a!=
null)b+=" "+F(a);return b+";"},"continue":function(a){var b="continue";if(a!=null)b+=" "+F(a);return b+";"},conditional:function(a,b,c){return r([f(a,"assign","seq","conditional"),"?",f(b,"seq"),":",f(c,"seq")])},assign:function(a,b,c){if(a&&a!==true)a+="=";else a="=";return r([q(b),a,f(c,"seq")])},dot:function(a){var b=q(a),c=1;if(a[0]=="num")b+=".";else if(p(a))b="("+b+")";for(;c<arguments.length;)b+="."+F(arguments[c++]);return b},call:function(a,b){var c=q(a);if(p(a))c="("+c+")";return c+"("+
i(y(b,function(n){return f(n,"seq")}))+")"},"function":w,defun:w,"if":function(a,b,c){a=["if","("+q(a)+")",c?R(b):q(b)];c&&a.push("else",q(c));return r(a)},"for":function(a,b,c,n){var u=["for"];a=(a!=null?q(a):"").replace(/;*\s*$/,";"+K);b=(b!=null?q(b):"").replace(/;*\s*$/,";"+K);c=(c!=null?q(c):"").replace(/;*\s*$/,"");a=a+b+c;if(a=="; ; ")a=";;";u.push("("+a+")",q(n));return r(u)},"for-in":function(a,b,c,n){var u=r(["for","("]);if(a)u+="var ";u+=r([F(b)+" in "+q(c)+")",q(n)]);return u},"while":function(a,
b){return r(["while","("+q(a)+")",q(b)])},"do":function(a,b){return r(["do",q(b),"while","("+q(a)+")"])+";"},"return":function(a){var b=["return"];a!=null&&b.push(q(a));return r(b)+";"},binary:function(a,b,c){var n=q(b),u=q(c);if(U(b[0],["assign","conditional","seq"])||b[0]=="binary"&&V[a]>V[b[1]])n="("+n+")";if(U(c[0],["assign","conditional","seq"])||c[0]=="binary"&&V[a]>=V[c[1]]&&!(c[1]==a&&U(a,["&&","||","*"])))u="("+u+")";return r([n,a,u])},"unary-prefix":function(a,b){var c=q(b);b[0]=="num"||
b[0]=="unary-prefix"&&!x(Y,a+b[1])||!p(b)||(c="("+c+")");return a+($(a.charAt(0))?" ":"")+c},"unary-postfix":function(a,b){var c=q(b);b[0]=="num"||b[0]=="unary-postfix"&&!x(Y,a+b[1])||!p(b)||(c="("+c+")");return c+a},sub:function(a,b){var c=q(a);if(p(a))c="("+c+")";return c+"["+q(b)+"]"},object:function(a){if(a.length==0)return"{}";return"{"+A+j(function(){return y(a,function(b){if(b.length==3)return l(w(b[0],b[1][2],b[1][3],b[2]));var c=b[0];b=q(b[1]);if(d&&d.quote_keys)c=ga(c);else if((typeof c==
"number"||!d&&+c+""==c)&&parseFloat(c)>=0)c=s(+c);else Sa(c)||(c=ga(c));return l(r(d&&d.space_colon?[c,":",b]:[c+":",b]))}).join(","+A)})+A+l("}")},regexp:function(a,b){return"/"+a+"/"+b},array:function(a){if(a.length==0)return"[]";return r(["[",i(y(a,function(b){if(!d&&b[0]=="atom"&&b[1]=="undefined")return"";return f(b,"seq")})),"]"])},stat:function(a){return q(a).replace(/;*\s*$/,";")},seq:function(){return i(y(O(arguments),q))},label:function(a,b){return r([F(a),":",q(b)])},"with":function(a,
b){return r(["with","("+q(a)+")",q(b)])},atom:function(a){return F(a)}},o=[];return q(g)}function Z(g){var d=O(arguments,1);return function(){return g.apply(this,d.concat(O(arguments)))}}function D(g){if(g instanceof Function)g=g();for(var d=1,l=arguments.length;--l>0;++d)arguments[d]();return g}function E(g){for(var d={},l=0;l<g.length;++l)d[g[l]]=true;return d}function O(g,d){return Array.prototype.slice.call(g,d==null?0:d)}function W(g){return g.split("")}function U(g,d){for(var l=d.length;--l>=
0;)if(d[l]===g)return true;return false}function ua(g,d){if(d<=0)return"";if(d==1)return g;var l=ua(g,d>>1);l+=l;if(d&1)l+=g;return l}function Ra(g,d){var l={};if(g===true)g={};for(var j in d)if(x(d,j))l[j]=g&&x(g,j)?g[j]:d[j];return l}function Sa(g){return/^[a-z_$][a-z0-9_$]*$/i.test(g)&&g!="this"&&!x(oa,g)&&!x(Ta,g)&&!x(na,g)}function x(g,d){return Object.prototype.hasOwnProperty.call(g,d)}function y(g,d,l){for(var j=[],r=0;r<g.length;++r)j.push(d.call(l,g[r],r));return j}var na=E(["break","case",
"catch","const","continue","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","throw","try","typeof","var","void","while","with"]),Ta=E(["abstract","boolean","byte","char","class","debugger","double","enum","export","extends","final","float","goto","implements","import","int","interface","long","native","package","private","protected","public","short","static","super","synchronized","throws","transient","volatile"]),za=E(["return","new","delete",
"throw","else","case"]),oa=E(["false","null","true","undefined"]),Ea=E(W("+-*&%=<>!?|~^")),wa=/^0x[0-9a-f]+$/i,xa=/^0[0-7]+$/,ya=/^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i,Y=E(["in","instanceof","typeof","new","void","delete","++","--","+","-","!","~","&","|","^","*","/","%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","=","+=","-=","/=","*=","%=",">>=","<<=",">>>=","%=","|=","^=","&=","&&","||"]),Ba=E(W(" \n\r\t")),Aa=E(W("[{}(,.;:")),Da=E(W("[]{}(),;:")),Ca=E(W("gmsiy"));ja.prototype.toString=
function(){return this.message+" (line: "+this.line+", col: "+this.col+", pos: "+this.pos+")\n\n"+this.stack};var ba={},Ia=E(["typeof","void","delete","--","++","!","~","-","+"]),ma=E(["--","++"]),sa=function(g,d,l){for(;l<g.length;){d[g[l]]=g[l].substr(0,g[l].length-1);l++}return d}(["+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&="],{"=":true},0),V=function(g,d){for(var l=0,j=1;l<g.length;++l,++j)for(var r=g[l],i=0;i<r.length;++i)d[r[i]]=j;return d}([["||"],["&&"],["|"],["^"],["&"],["==",
"===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],{}),Ha=E(["for","do","while","switch"]),La=E(["atom","num","string","regexp","name"]);ca.prototype.toString=function(){return this.name};var Qa=E(["name","array","string","dot","sub","call","regexp"]);return{parse:Fa,stringify:Pa,tokenizer:la,walker:ta}});
h;if(j("punc","(")){i();h=S(")")}else h=[];return L(t("new",e,h),true)}function I(e){if(j("operator","new")){i();return X()}if(j("operator")&&x(Ja,m.token.value))return qa("unary-prefix",D(m.token.value,i),I(e));if(j("punc")){switch(m.token.value){case "(":i();return L(D(C,Z(w,")")),e);case "[":i();return L(Ka(),e);case "{":i();return L(La(),e)}s()}if(j("keyword","function")){i();return L(ea(false),e)}if(x(Ma,m.token.type)){var h=m.token.type=="regexp"?t("regexp",m.token.value[0],m.token.value[1]):
t(m.token.type,m.token.value);return L(D(h,i),e)}s()}function S(e,h,v){for(var z=true,Q=[];!j("punc",e);){if(z)z=false;else w(",");if(h&&j("punc",e))break;j("punc",",")&&v?Q.push(["atom","undefined"]):Q.push(C(false))}i();return Q}function Ka(){return t("array",S("]",!d,true))}function La(){for(var e=true,h=[];!j("punc","}");){if(e)e=false;else w(",");if(!d&&j("punc","}"))break;var v=m.token.type,z=Na();if(v=="name"&&(z=="get"||z=="set")&&!j("punc",":"))h.push([fa(),ea(false),z]);else{w(":");h.push([z,
C(false)])}}i();return t("object",h)}function Na(){switch(m.token.type){case "num":case "string":return D(m.token.value,i)}return fa()}function fa(){switch(m.token.type){case "name":case "operator":case "keyword":case "atom":return D(m.token.value,i);default:s()}}function L(e,h){if(j("punc",".")){i();return L(t("dot",e,fa()),h)}if(j("punc","[")){i();return L(t("sub",e,D(C,Z(w,"]"))),h)}if(h&&j("punc","(")){i();return L(t("call",e,S(")")),true)}if(h&&j("operator")&&x(na,m.token.value))return D(Z(qa,
"unary-postfix",m.token.value,e),i);return e}function qa(e,h,v){if((h=="++"||h=="--")&&!ra(v))k("Invalid use of "+h+" operator");return t(e,h,v)}function ga(e,h){var v=j("operator")?m.token.value:null,z=v!=null?V[v]:null;if(z!=null&&z>h){i();z=ga(I(true),z);return ga(t("binary",v,e,z),h)}return e}function Oa(){return ga(I(true),0)}function Pa(){var e=Oa();if(j("operator","?")){i();var h=C(false);w(":");return t("conditional",e,h,C(false))}return e}function ra(e){switch(e[0]){case "dot":case "sub":return true;
case "name":return e[1]!="this"}}function sa(){var e=Pa(),h=m.token.value;if(j("operator")&&x(ta,h)){if(ra(e)){i();return t("assign",ta[h],e,sa())}k("Invalid assignment")}return e}function C(e){if(arguments.length==0)e=true;var h=sa();if(e&&j("punc",",")){i();return t("seq",h,C())}return h}function T(e){try{++m.in_loop;return e()}finally{--m.in_loop}}var m={input:typeof f=="string"?ma(f,true):f,token:null,prev:null,peeked:null,in_function:0,in_loop:0,labels:[]};m.token=i();var J=l?function(){var e=
m.token,h=q.apply(this,arguments);h[0]=M(h[0],e,g());return h}:q,ea=l?function(){var e=g(),h=o.apply(this,arguments);h[0]=M(h[0],e,g());return h}:o,Ha=Z(T,function(){w("{");for(var e=[],h=null;!j("punc","}");){j("eof")&&s();if(j("keyword","case")){i();h=[];e.push([C(),h]);w(":")}else if(j("keyword","default")){i();w(":");h=[];e.push([null,h])}else{h||s();h.push(J())}}i();return e});return t("toplevel",function(e){for(;!j("eof");)e.push(J());return e}([]))}function ua(){function f(g){return[this[0],
y(g,function(k){var p=[k[0]];if(k.length>1)p[1]=d(k[1]);return p})]}function d(g){if(g==null)return null;try{i.push(g);var k=g[0],p=r[k];if(p){var s=p.apply(g,g.slice(1));if(s!=null)return s}p=j[k];return p.apply(g,g.slice(1))}finally{i.pop()}}function l(g,k){var p={},s;for(s in g)if(x(g,s)){p[s]=r[s];r[s]=g[s]}g=k();for(s in p)if(x(p,s))if(p[s])r[s]=p[s];else delete r[s];return g}var j={string:function(g){return[this[0],g]},num:function(g){return[this[0],g]},name:function(g){return[this[0],g]},toplevel:function(g){return[this[0],
y(g,d)]},block:function(g){var k=[this[0]];g!=null&&k.push(y(g,d));return k},"var":f,"const":f,"try":function(g,k,p){return[this[0],y(g,d),k!=null?[k[0],y(k[1],d)]:null,p!=null?y(p,d):null]},"throw":function(g){return[this[0],d(g)]},"new":function(g,k){return[this[0],d(g),y(k,d)]},"switch":function(g,k){return[this[0],d(g),y(k,function(p){return[p[0]?d(p[0]):null,y(p[1],d)]})]},"break":function(g){return[this[0],g]},"continue":function(g){return[this[0],g]},conditional:function(g,k,p){return[this[0],
d(g),d(k),d(p)]},assign:function(g,k,p){return[this[0],g,d(k),d(p)]},dot:function(g){return[this[0],d(g)].concat(O(arguments,1))},call:function(g,k){return[this[0],d(g),y(k,d)]},"function":function(g,k,p){return[this[0],g,k.slice(),y(p,d)]},defun:function(g,k,p){return[this[0],g,k.slice(),y(p,d)]},"if":function(g,k,p){return[this[0],d(g),d(k),d(p)]},"for":function(g,k,p,s){return[this[0],d(g),d(k),d(p),d(s)]},"for-in":function(g,k,p,s){return[this[0],g,k,d(p),d(s)]},"while":function(g,k){return[this[0],
d(g),d(k)]},"do":function(g,k){return[this[0],d(g),d(k)]},"return":function(g){return[this[0],d(g)]},binary:function(g,k,p){return[this[0],g,d(k),d(p)]},"unary-prefix":function(g,k){return[this[0],g,d(k)]},"unary-postfix":function(g,k){return[this[0],g,d(k)]},sub:function(g,k){return[this[0],d(g),d(k)]},object:function(g){return[this[0],y(g,function(k){return k.length==2?[k[0],d(k[1])]:[k[0],d(k[1]),k[2]]})]},regexp:function(g,k){return[this[0],g,k]},array:function(g){return[this[0],y(g,d)]},stat:function(g){return[this[0],
d(g)]},seq:function(){return[this[0]].concat(y(O(arguments),d))},label:function(g,k){return[this[0],g,d(k)]},"with":function(g,k){return[this[0],d(g),d(k)]},atom:function(g){return[this[0],g]}},r={},i=[];return{walk:d,with_walkers:l,parent:function(){return i[i.length-2]},stack:function(){return i}}}function $(f){return!f||f[0]=="block"&&(!f[1]||f[1].length==0)}function ha(f){var d=0,l=0;f=f.replace(/[\\\b\f\n\r\t\x22\x27]/g,function(j){switch(j){case "\\":return"\\\\";case "\u0008":return"\\b";case "\u000c":return"\\f";
case "\n":return"\\n";case "\r":return"\\r";case "\t":return"\\t";case '"':++d;return'"';case "'":++l;return"'"}return j});return d>l?"'"+f.replace(/\x27/g,"\\'")+"'":'"'+f.replace(/\x22/g,'\\"')+'"'}function Qa(f,d){function l(a){if(a==null)a="";if(d)a=va(" ",d.indent_start+P*d.indent_level)+a;return a}function j(a,b){if(b==null)b=1;P+=b;try{return a.apply(null,O(arguments,1))}finally{P-=b}}function r(a){if(d)return a.join(" ");for(var b=[],c=0;c<a.length;++c){var n=a[c+1];b.push(a[c]);if(n&&(/[a-z0-9_\x24]$/i.test(a[c].toString())&&
/^[a-z0-9_\x24]/i.test(n.toString())||/[\+\-]$/.test(a[c].toString())&&/^[\+\-]/.test(n.toString())))b.push(" ")}return b.join("")}function i(a){return a.join(","+K)}function g(a){for(var b=q(a),c=1;c<arguments.length;++c){var n=arguments[c];if(n instanceof Function&&n(a)||a[0]==n)return"("+b+")"}return b}function k(a){if(a.length==1)return a[0];if(a.length==2){var b=a[1];a=a[0];return a.length<=b.length?a:b}return k([a[0],k(a.slice(1))])}function p(a){if(a[0]=="function")for(var b=O(o),c=b.pop(),
n=b.pop();n;){if(n[0]=="stat")return true;if(n[0]=="seq"&&n[1]===c||n[0]=="call"&&n[1]===c||n[0]=="binary"&&n[2]===c){c=n;n=b.pop()}else return false}return!x(Ra,a[0])}function s(a){var b=a.toString(10),c=[b.replace(/^0\./,".")];if(Math.floor(a)===a){c.push("0x"+a.toString(16).toLowerCase(),"0"+a.toString(8));if(a=/^(.*?)(0+)$/.exec(a))c.push(a[1]+"e"+a[2].length)}else if(a=/^0?\.(0+)(.*)$/.exec(a))c.push(a[2]+"e-"+(a[1].length+a[2].length),b.substr(b.indexOf(".")));return k(c)}function R(a){if(a[0]==
"do")return q(["block",[a]]);for(var b=a;;){var c=b[0];if(c=="if"){if(!b[3])return q(["block",[a]]);b=b[3]}else if(c=="while"||c=="do")b=b[2];else if(c=="for"||c=="for-in")b=b[4];else break}return q(a)}function w(a,b,c,n){n=n||"function";if(a)n+=" "+F(a);n+="("+i(y(b,F))+")";return r([n,H(c)])}function F(a){return a.toString()}function G(a){for(var b=[],c=a.length-1,n=0;n<=c;++n){var u=a[n],B=q(u);if(B!=";"){if(!d&&n==c)B=u[0]=="while"&&$(u[2])||U(u[0],["for","for-in"])&&$(u[4])||u[0]=="if"&&$(u[2])&&
!u[3]||u[0]=="if"&&u[3]&&$(u[3])?B.replace(/;*\s*$/,";"):B.replace(/;+\s*$/,"");b.push(B)}}return y(b,l)}function t(a){var b=a.length;if(b==0)return"{}";return"{"+A+y(a,function(c,n){var u=c[1].length>0,B=j(function(){return l(c[0]?r(["case",q(c[0])+":"]):"default:")},0.5)+(u?A+j(function(){return G(c[1]).join(A)}):"");if(!d&&u&&n<b-1)B+=";";return B}).join(A)+A+l("}")}function H(a){if(!a)return";";if(a.length==0)return"{}";return"{"+A+j(function(){return G(a).join(A)})+A+l("}")}function M(a){var b=
a[0];a=a[1];if(a!=null)b=r([b,"=",q(a)]);return b}function q(a){var b=a[0],c=N[b];if(!c)throw new Error("Can't find generator for \""+b+'"');o.push(a);a=c.apply(b,a.slice(1));o.pop();return a}if(d)d=Sa(d,{indent_start:0,indent_level:4,quote_keys:false,space_colon:false});var P=0,A=d?"\n":"",K=d?" ":"",N={string:ha,num:s,name:F,toplevel:function(a){return G(a).join(A+A)},block:H,"var":function(a){return"var "+i(y(a,M))+";"},"const":function(a){return"const "+i(y(a,M))+";"},"try":function(a,b,c){a=
["try",H(a)];b&&a.push("catch","("+b[0]+")",H(b[1]));c&&a.push("finally",H(c));return r(a)},"throw":function(a){return r(["throw",q(a)])+";"},"new":function(a,b){b=b.length>0?"("+i(y(b,q))+")":"";return r(["new",g(a,"seq","binary","conditional","assign",function(c){var n=ua(),u={};try{n.with_walkers({call:function(){throw u;},"function":function(){return this}},function(){n.walk(c)})}catch(B){if(B===u)return true;throw B;}})+b])},"switch":function(a,b){return r(["switch","("+q(a)+")",t(b)])},"break":function(a){var b=
"break";if(a!=null)b+=" "+F(a);return b+";"},"continue":function(a){var b="continue";if(a!=null)b+=" "+F(a);return b+";"},conditional:function(a,b,c){return r([g(a,"assign","seq","conditional"),"?",g(b,"seq"),":",g(c,"seq")])},assign:function(a,b,c){if(a&&a!==true)a+="=";else a="=";return r([q(b),a,g(c,"seq")])},dot:function(a){var b=q(a),c=1;if(a[0]=="num")b+=".";else if(p(a))b="("+b+")";for(;c<arguments.length;)b+="."+F(arguments[c++]);return b},call:function(a,b){var c=q(a);if(p(a))c="("+c+")";
return c+"("+i(y(b,function(n){return g(n,"seq")}))+")"},"function":w,defun:w,"if":function(a,b,c){a=["if","("+q(a)+")",c?R(b):q(b)];c&&a.push("else",q(c));return r(a)},"for":function(a,b,c,n){var u=["for"];a=(a!=null?q(a):"").replace(/;*\s*$/,";"+K);b=(b!=null?q(b):"").replace(/;*\s*$/,";"+K);c=(c!=null?q(c):"").replace(/;*\s*$/,"");a=a+b+c;if(a=="; ; ")a=";;";u.push("("+a+")",q(n));return r(u)},"for-in":function(a,b,c,n){var u=r(["for","("]);if(a)u+="var ";u+=r([F(b)+" in "+q(c)+")",q(n)]);return u},
"while":function(a,b){return r(["while","("+q(a)+")",q(b)])},"do":function(a,b){return r(["do",q(b),"while","("+q(a)+")"])+";"},"return":function(a){var b=["return"];a!=null&&b.push(q(a));return r(b)+";"},binary:function(a,b,c){var n=q(b),u=q(c);if(U(b[0],["assign","conditional","seq"])||b[0]=="binary"&&V[a]>V[b[1]])n="("+n+")";if(U(c[0],["assign","conditional","seq"])||c[0]=="binary"&&V[a]>=V[c[1]]&&!(c[1]==a&&U(a,["&&","||","*"])))u="("+u+")";return r([n,a,u])},"unary-prefix":function(a,b){var c=
q(b);b[0]=="num"||b[0]=="unary-prefix"&&!x(Y,a+b[1])||!p(b)||(c="("+c+")");return a+(aa(a.charAt(0))?" ":"")+c},"unary-postfix":function(a,b){var c=q(b);b[0]=="num"||b[0]=="unary-postfix"&&!x(Y,a+b[1])||!p(b)||(c="("+c+")");return c+a},sub:function(a,b){var c=q(a);if(p(a))c="("+c+")";return c+"["+q(b)+"]"},object:function(a){if(a.length==0)return"{}";return"{"+A+j(function(){return y(a,function(b){if(b.length==3)return l(w(b[0],b[1][2],b[1][3],b[2]));var c=b[0];b=q(b[1]);if(d&&d.quote_keys)c=ha(c);
else if((typeof c=="number"||!d&&+c+""==c)&&parseFloat(c)>=0)c=s(+c);else Ta(c)||(c=ha(c));return l(r(d&&d.space_colon?[c,":",b]:[c+":",b]))}).join(","+A)})+A+l("}")},regexp:function(a,b){return"/"+a+"/"+b},array:function(a){if(a.length==0)return"[]";return r(["[",i(y(a,function(b){if(!d&&b[0]=="atom"&&b[1]=="undefined")return"";return g(b,"seq")})),"]"])},stat:function(a){return q(a).replace(/;*\s*$/,";")},seq:function(){return i(y(O(arguments),q))},label:function(a,b){return r([F(a),":",q(b)])},
"with":function(a,b){return r(["with","("+q(a)+")",q(b)])},atom:function(a){return F(a)}},o=[];return q(f)}function Z(f){var d=O(arguments,1);return function(){return f.apply(this,d.concat(O(arguments)))}}function D(f){if(f instanceof Function)f=f();for(var d=1,l=arguments.length;--l>0;++d)arguments[d]();return f}function E(f){for(var d={},l=0;l<f.length;++l)d[f[l]]=true;return d}function O(f,d){return Array.prototype.slice.call(f,d==null?0:d)}function W(f){return f.split("")}function U(f,d){for(var l=
d.length;--l>=0;)if(d[l]===f)return true;return false}function va(f,d){if(d<=0)return"";if(d==1)return f;var l=va(f,d>>1);l+=l;if(d&1)l+=f;return l}function Sa(f,d){var l={};if(f===true)f={};for(var j in d)if(x(d,j))l[j]=f&&x(f,j)?f[j]:d[j];return l}function Ta(f){return/^[a-z_$][a-z0-9_$]*$/i.test(f)&&f!="this"&&!x(pa,f)&&!x(Ua,f)&&!x(oa,f)}function x(f,d){return Object.prototype.hasOwnProperty.call(f,d)}function y(f,d,l){for(var j=[],r=0;r<f.length;++r)j.push(d.call(l,f[r],r));return j}var oa=E(["break",
"case","catch","const","continue","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","throw","try","typeof","var","void","while","with"]),Ua=E(["abstract","boolean","byte","char","class","debugger","double","enum","export","extends","final","float","goto","implements","import","int","interface","long","native","package","private","protected","public","short","static","super","synchronized","throws","transient","volatile"]),Aa=E(["return","new",
"delete","throw","else","case"]),pa=E(["false","null","true","undefined"]),Fa=E(W("+-*&%=<>!?|~^")),xa=/^0x[0-9a-f]+$/i,ya=/^0[0-7]+$/,za=/^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i,Y=E(["in","instanceof","typeof","new","void","delete","++","--","+","-","!","~","&","|","^","*","/","%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","=","+=","-=","/=","*=","%=",">>=","<<=",">>>=","%=","|=","^=","&=","&&","||"]),Ca=E(W(" \n\r\t")),Ba=E(W("[{}(,.;:")),Ea=E(W("[]{}(),;:")),Da=E(W("gmsiy"));
ka.prototype.toString=function(){return this.message+" (line: "+this.line+", col: "+this.col+", pos: "+this.pos+")\n\n"+this.stack};var ca={},Ja=E(["typeof","void","delete","--","++","!","~","-","+"]),na=E(["--","++"]),ta=function(f,d,l){for(;l<f.length;){d[f[l]]=f[l].substr(0,f[l].length-1);l++}return d}(["+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&="],{"=":true},0),V=function(f,d){for(var l=0,j=1;l<f.length;++l,++j)for(var r=f[l],i=0;i<r.length;++i)d[r[i]]=j;return d}([["||"],["&&"],
["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],{}),Ia=E(["for","do","while","switch"]),Ma=E(["atom","num","string","regexp","name"]);da.prototype.toString=function(){return this.name};var Ra=E(["name","array","string","dot","sub","call","regexp"]);return{parse:Ga,stringify:Qa,tokenizer:ma,walker:ua}});

View file

@ -1336,6 +1336,10 @@ function walker() {
};
};
function empty(b) {
return !b || (b[0] == "block" && (!b[1] || b[1].length == 0));
};
/* -----[ re-generate code from the AST ]----- */
var DOT_CALL_NO_PARENS = array_to_hash([