├── HTML JS Formater.js ├── README.md ├── after.jpg └── before.jpg /HTML JS Formater.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | /** 4 | * 5 | * HTML/JS Formater 6 | * 7 | * Using sources from http://jsbeautifier.org/ 8 | * (with minimized whitespaces only) 9 | * 10 | * format.js 11 | * format-html.js 12 | * tests/sanitytest.js 13 | * tests/format-tests.js 14 | * unpackers/javascriptobfuscator_unpacker.js 15 | * unpackers/urlencode_unpacker.js 16 | * unpackers/p_a_c_k_e_r_unpacker.js 17 | * unpackers/myobfuscate_unpacker.js 18 | * 19 | */ 20 | 21 | function js_format(a,e){function p(d){for(d=typeof d==="undefined"?false:d;o.length&&(o[o.length-1]===" "||o[o.length-1]===F||d&&(o[o.length-1]==="\n"||o[o.length-1]==="\r"));)o.pop()}function f(d){c.eat_next_space=false;if(!(z&&q(c.mode))){d=typeof d==="undefined"?true:d;c.if_line=false;p();if(o.length){if(o[o.length-1]!=="\n"||!d){D=true;o.push("\n")}for(d=0;d0)c=L.pop()}function s(d,t){for(var u=0;u=w)return["","TK_EOF"];K=false;var d=m.charAt(g);g+=1;if(z&&q(c.mode)){for(var t=0;s(d,O);){if(d==="\n"){p();o.push("\n");D=true;t=0}else if(d==="\t")t+=4;else if(d!== 24 | "\r")t+=1;if(g>=w)return["","TK_EOF"];d=m.charAt(g);g+=1}if(c.indentation_baseline===-1)c.indentation_baseline=t;if(D){var u;for(u=0;u=w)return["","TK_EOF"];d=m.charAt(g);g+=1}if(P)if(A>1)for(u=0;u0}if(s(d,N)){if(g=w)break}g+=2;return u?["/*"+t+"*/","TK_INLINE_COMMENT"]:["/*"+t+"*/","TK_BLOCK_COMMENT"]}if(m.charAt(g)==="/"){for(t=d;m.charAt(g)!=="\r"&&m.charAt(g)!=="\n";){t+=m.charAt(g);g+=1;if(g>=w)break}g+=1;K&&f();return[t,"TK_COMMENT"]}}if(d==="'"||d==='"'||d==="/"&&(j==="TK_WORD"&&s(l,["return","do"])||j==="TK_COMMENT"||j==="TK_START_EXPR"||j==="TK_START_BLOCK"||j==="TK_END_BLOCK"||j==="TK_OPERATOR"|| 27 | j==="TK_EQUALS"||j==="TK_EOF"||j==="TK_SEMICOLON")){t=d;u=false;var B=d;if(g=w)return[B,"TK_STRING"]}else for(;u||m.charAt(g)!==t;){B+=m.charAt(g);u=u?false:m.charAt(g)==="\\";g+=1;if(g>=w)return[B,"TK_STRING"]}g+=1;B+=t;if(t==="/")for(;g"){c.in_html_comment=false;g+=2;K&&f();return["--\>","TK_COMMENT"]}if(s(d,Q)){for(;g=w)break}return d==="="?[d,"TK_EQUALS"]:[d,"TK_OPERATOR"]}return[d,"TK_UNKNOWN"]}var m,o,r,j,l,x,E,c,L,F,O,N,Q,g,H,T,v,I,M,K,D,A;e=e?e:{};var C;if(e.space_after_anon_function!==undefined&&e.jslint_happy===undefined)e.jslint_happy=e.space_after_anon_function;if(e.braces_on_own_line!==undefined)C=e.braces_on_own_line?"expand":"collapse";C=e.brace_style? 30 | e.brace_style:C?C:"collapse";E=e.indent_size?e.indent_size:4;var R=e.indent_char?e.indent_char:" ",P=typeof e.preserve_newlines==="undefined"?true:e.preserve_newlines,S=typeof e.max_preserve_newlines==="undefined"?false:e.max_preserve_newlines,U=e.indent_level?e.indent_level:0,V=e.jslint_happy==="undefined"?false:e.jslint_happy,z=typeof e.keep_array_indentation==="undefined"?false:e.keep_array_indentation;D=false;var w=a.length;for(F="";E>0;){F+=R;E-=1}m=a;E="";j="TK_START_EXPR";x=l="";o=[];M=false; 31 | O="\n\r\t ".split("");N="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$".split("");T="0123456789".split("");Q="+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::".split(" ");H="continue,try,throw,return,var,if,switch,case,default,for,while,break,function".split(",");L=[];i("BLOCK");for(g=0;;){I=J(g);r=I[0];I=I[1];if(I==="TK_EOF")break;switch(I){case "TK_START_EXPR":if(r==="["){if(j==="TK_WORD"||l===")"){s(l,H)&&n(); 32 | i("(EXPRESSION)");b();break}if(c.mode==="[EXPRESSION]"||c.mode==="[INDENTED-EXPRESSION]")if(x==="]"&&l===","){if(c.mode==="[EXPRESSION]"){c.mode="[INDENTED-EXPRESSION]";z||(c.indentation_level+=1)}i("[EXPRESSION]");z||f()}else if(l==="["){if(c.mode==="[EXPRESSION]"){c.mode="[INDENTED-EXPRESSION]";z||(c.indentation_level+=1)}i("[EXPRESSION]");z||f()}else i("[EXPRESSION]");else i("[EXPRESSION]")}else i("(EXPRESSION)");if(l===";"||j==="TK_START_BLOCK")f();else if(!(j==="TK_END_EXPR"||j==="TK_START_EXPR"|| 33 | j==="TK_END_BLOCK"||l==="."))if(j!=="TK_WORD"&&j!=="TK_OPERATOR")n();else if(E==="function"||E==="typeof")V&&n();else if(s(l,H)||l==="catch")n();b();break;case "TK_END_EXPR":if(r==="]")if(z){if(l==="}"){h();b();G();break}}else if(c.mode==="[INDENTED-EXPRESSION]")if(l==="]"){G();f();b();break}G();b();break;case "TK_START_BLOCK":E==="do"?i("DO_BLOCK"):i("BLOCK");if(C=="expand"){if(j!=="TK_OPERATOR")l==="return"||l==="="?n():f(true);b();c.indentation_level+=1}else{if(j!=="TK_OPERATOR"&&j!=="TK_START_EXPR")j=== 34 | "TK_START_BLOCK"?f():n();else if(q(c.previous_mode)&&l===",")x==="}"?n():f();c.indentation_level+=1;b()}break;case "TK_END_BLOCK":G();if(C=="expand")l!=="{"&&f();else if(j==="TK_START_BLOCK")D?h():p();else if(q(c.mode)&&z){z=false;f();z=true}else f();b();break;case "TK_WORD":if(M){n();b();n();M=false;break}if(r==="function"){if(c.var_line)c.var_line_reindented=true;if((D||l===";")&&l!=="{"){A=D?A:0;P||(A=1);for(v=0;v<2-A;v++)f(false)}}if(r==="case"||r==="default"){if(l===":")h();else{c.indentation_level--; 35 | f();c.indentation_level++}b();c.in_case=true;break}v="NONE";if(j==="TK_END_BLOCK")if(s(r.toLowerCase(),["else","catch","finally"]))if(C=="expand"||C=="end-expand")v="NEWLINE";else{v="SPACE";n()}else v="NEWLINE";else if(j==="TK_SEMICOLON"&&(c.mode==="BLOCK"||c.mode==="DO_BLOCK"))v="NEWLINE";else if(j==="TK_SEMICOLON"&&y(c.mode))v="SPACE";else if(j==="TK_STRING")v="NEWLINE";else if(j==="TK_WORD"){l==="else"&&p(true);v="SPACE"}else if(j==="TK_START_BLOCK")v="NEWLINE";else if(j==="TK_END_EXPR"){n();v= 36 | "NEWLINE"}if(s(r,H)&&l!==")")v=l=="else"?"SPACE":"NEWLINE";if(c.if_line&&j==="TK_END_EXPR")c.if_line=false;if(s(r.toLowerCase(),["else","catch","finally"]))if(j!=="TK_END_BLOCK"||C=="expand"||C=="end-expand")f();else{p(true);n()}else if(v==="NEWLINE"){if(!((j==="TK_START_EXPR"||l==="="||l===",")&&r==="function"))if(r==="function"&&l=="new")n();else if(l==="return"||l==="throw")n();else if(j!=="TK_END_EXPR"){if((j!=="TK_START_EXPR"||r!=="var")&&l!==":")if(r==="if"&&E==="else"&&l!=="{")n();else{c.var_line= 37 | false;c.var_line_reindented=false;f()}}else if(s(r,H)&&l!=")"){c.var_line=false;c.var_line_reindented=false;f()}}else if(q(c.mode)&&l===","&&x==="}")f();else v==="SPACE"&&n();b();E=r;if(r==="var"){c.var_line=true;c.var_line_reindented=false;c.var_line_tainted=false}if(r==="if")c.if_line=true;if(r==="else")c.if_line=false;break;case "TK_SEMICOLON":b();c.var_line=false;c.var_line_reindented=false;if(c.mode=="OBJECT")c.mode="BLOCK";break;case "TK_STRING":if(j==="TK_START_BLOCK"||j==="TK_END_BLOCK"|| 38 | j==="TK_SEMICOLON")f();else j==="TK_WORD"&&n();b();break;case "TK_EQUALS":if(c.var_line)c.var_line_tainted=true;n();b();n();break;case "TK_OPERATOR":v=x=true;if(c.var_line&&r===","&&y(c.mode))c.var_line_tainted=false;if(c.var_line)if(r===",")if(c.var_line_tainted){b();c.var_line_reindented=true;c.var_line_tainted=false;f();break}else c.var_line_tainted=false;if(l==="return"||l==="throw"){n();b();break}if(r===":"&&c.in_case){b();f();c.in_case=false;break}if(r==="::"){b();break}if(r===","){if(c.var_line)if(c.var_line_tainted){b(); 39 | f();c.var_line_tainted=false}else{b();n()}else if(j==="TK_END_BLOCK"&&c.mode!=="(EXPRESSION)"){b();c.mode==="OBJECT"&&l==="}"?f():n()}else if(c.mode==="OBJECT"){b();f()}else{b();n()}break}else if(s(r,["--","++","!"])||s(r,["-","+"])&&(s(j,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||s(l,H))){v=x=false;if(l===";"&&y(c.mode))x=true;if(j==="TK_WORD"&&s(l,H))x=true;if(c.mode==="BLOCK"&&(l==="{"||l===";"))f()}else if(r===".")x=false;else if(r===":")if(c.ternary_depth==0){c.mode="OBJECT"; 40 | x=false}else c.ternary_depth-=1;else if(r==="?")c.ternary_depth+=1;x&&n();b();v&&n();break;case "TK_BLOCK_COMMENT":x=r.split(/\x0a|\x0d\x0a/);if(/^\/\*\*/.test(r)){f();o.push(x[0]);for(v=1;v1){f();p()}else n();for(v=0;v=this.input.length)return h.length?h.join(""):["","TK_EOF"];b=this.input.charAt(this.pos);this.pos++;this.line_char_count++;if(this.Utils.in_array(b,this.Utils.whitespace)){if(h.length)i=true;this.line_char_count--}else{if(i){if(this.line_char_count>=this.max_char){h.push("\n");for(i=0;i","igm");b.lastIndex=this.pos;for(var i=(b=b.exec(this.input))?b.index:this.input.length;this.pos=this.input.length)return h.length?h.join(""):["","TK_EOF"];b=this.input.charAt(this.pos);this.pos++;h.push(b)}return h.length?h.join(""):""};this.record_tag=function(b){if(this.tags[b+"count"])this.tags[b+"count"]++;else this.tags[b+"count"]=1;this.tags[b+this.tags[b+"count"]]= 45 | this.indent_level;this.tags[b+this.tags[b+"count"]+"parent"]=this.tags.parent;this.tags.parent=b+this.tags[b+"count"]};this.retrieve_tag=function(b){if(this.tags[b+"count"]){for(var h=this.tags.parent;h;){if(b+this.tags[b+"count"]===h)break;h=this.tags[h+"parent"]}if(h){this.indent_level=this.tags[b+this.tags[b+"count"]];this.tags.parent=this.tags[h+"parent"]}delete this.tags[b+this.tags[b+"count"]+"parent"];delete this.tags[b+this.tags[b+"count"]];if(this.tags[b+"count"]==1)delete this.tags[b+"count"]; 46 | else this.tags[b+"count"]--}};this.get_tag=function(){var b="",h=[],i=false;do{if(this.pos>=this.input.length)return h.length?h.join(""):["","TK_EOF"];b=this.input.charAt(this.pos);this.pos++;this.line_char_count++;if(this.Utils.in_array(b,this.Utils.whitespace)){i=true;this.line_char_count--}else{if(b==="'"||b==='"')if(!h[1]||h[1]!=="!"){b+=this.get_unformatted(b);i=true}if(b==="=")i=false;if(h.length&&h[h.length-1]!=="="&&b!==">"&&i){if(this.line_char_count>=this.max_char){this.print_newline(false, 47 | h);this.line_char_count=0}else{h.push(" ");this.line_char_count++}i=false}h.push(b)}}while(b!==">");b=h.join("");i=b.indexOf(" ")!=-1?b.indexOf(" "):b.indexOf(">");i=b.substring(1,i).toLowerCase();if(b.charAt(b.length-2)==="/"||this.Utils.in_array(i,this.Utils.single_token))this.tag_type="SINGLE";else if(i==="script"){this.record_tag(i);this.tag_type="SCRIPT"}else if(i==="style"){this.record_tag(i);this.tag_type="STYLE"}else if(i==="a"){b=this.get_unformatted("",b);h.push(b);this.tag_type="SINGLE"}else if(i.charAt(0)=== 48 | "!")if(i.indexOf("[if")!=-1){if(b.indexOf("!IE")!=-1){b=this.get_unformatted("--\>",b);h.push(b)}this.tag_type="START"}else if(i.indexOf("[endif")!=-1){this.tag_type="END";this.unindent()}else{b=i.indexOf("[cdata[")!=-1?this.get_unformatted("]]\>",b):this.get_unformatted("--\>",b);h.push(b);this.tag_type="SINGLE"}else{if(i.charAt(0)==="/"){this.retrieve_tag(i.substring(1));this.tag_type="END"}else{this.record_tag(i);this.tag_type="START"}this.Utils.in_array(i,this.Utils.extra_liners)&&this.print_newline(true, 49 | this.output)}return h.join("")};this.get_unformatted=function(b,h){if(h&&h.indexOf(b)!=-1)return"";var i="",q="",y=true;do{if(this.pos>=this.input.length)break;i=this.input.charAt(this.pos);this.pos++;if(this.Utils.in_array(i,this.Utils.whitespace)){if(!y){this.line_char_count--;continue}if(i==="\n"||i==="\r"){q+="\n";for(i=0;i0&&this.indent_level--}};return this};for(f.printer(a,p,e,80,n);;){a=f.get_token();f.token_text=a[0];f.token_type=a[1];if(f.token_type==="TK_EOF")break;switch(f.token_type){case "TK_TAG_START":case "TK_TAG_SCRIPT":case "TK_TAG_STYLE":f.print_newline(false,f.output);f.print_token(f.token_text);f.indent();f.current_mode="CONTENT";break;case "TK_TAG_END":f.print_newline(true,f.output); 53 | f.print_token(f.token_text);f.current_mode="CONTENT";break;case "TK_TAG_SINGLE":f.print_newline(false,f.output);f.print_token(f.token_text);f.current_mode="CONTENT";break;case "TK_CONTENT":if(f.token_text!==""){f.print_newline(false,f.output);f.print_token(f.token_text)}f.current_mode="TAG"}f.last_token=f.token_type;f.last_text=f.token_text}return f.output.join("")} 54 | function SanityTest(a,e){var p=a||function(h){return h};e=e||"";var f=0,n=0,b=[];this.test_function=function(h,i){p=h;e=i||""};this.expect=function(h,i){var q=p(h);if(q===i||i instanceof Array&&q.join(", ")==i.join(", "))n+=1;else{f+=1;b.push([e,h,i,q])}};this.results_raw=function(){var h="";if(f===0)h=n===0?"No tests run.":"All "+n+" tests passed.";else{for(var i=0;i/g,">").replace(/\n/g,"
")};this.log=function(){if(window.console)console.firebug?console.log.apply(console,Array.prototype.slice.call(arguments)):console.log.call(console,Array.prototype.slice.call(arguments))}} 57 | opts={indent_size:4,indent_char:" ",preserve_newlines:true,jslint_happy:false,keep_array_indentation:false,brace_style:"collapse"};function test_beautifier(a){return js_format(a,opts)}var sanitytest;function test_fragment(a,e){e=e||a;sanitytest.expect(a,e)}function bt(a,e){var p,f;e=e||a;test_fragment(a,e);if(opts.indent_size===4&&a){p="{\n"+a+"\nfoo=bar;}";f="{\n"+e.replace(/^(.+)$/mg,"\t$1")+"\n\tfoo = bar;\n}";test_fragment(p,f)}} 58 | function bt_braces(a,e){var p=opts.brace_style;opts.brace_style="expand";bt(a,e);opts.brace_style=p} 59 | function run_beautifier_tests(a){sanitytest=a||new SanityTest;sanitytest.test_function(test_beautifier,"js_format");opts.indent_size=4;opts.indent_char=" ";opts.preserve_newlines=true;opts.jslint_happy=false;opts.keep_array_indentation=false;opts.brace_style="collapse";bt("");bt("return .5");bt("a\t\t=\t\t 1","a = 1");bt("a=1","a = 1");bt("a();\n\nb();","a();\n\nb();");bt("var a = 1 var b = 2","var a = 1\nvar b = 2");bt("var a=1, b=c[d], e=6;","var a = 1,\n\tb = c[d],\n\te = 6;");bt('a = " 12345 "'); 60 | bt("a = ' 12345 '");bt("if (a == 1) b = 2;","if (a == 1) b = 2;");bt("if(1){2}else{3}","if (1) {\n\t2\n} else {\n\t3\n}");bt("if (foo) bar();\nelse\ncar();","if (foo) bar();\nelse car();");bt("if(1||2);","if (1 || 2);");bt("(a==1)||(b==2)","(a == 1) || (b == 2)");bt("var a = 1 if (2) 3;","var a = 1\nif (2) 3;");bt("a = a + 1");bt("a = a == 1");bt("/12345[^678]*9+/.match(a)");bt("a /= 5");bt("a = 0.5 * 3");bt("a *= 10.55");bt("a < .5");bt("a <= .5");bt("a<.5","a < .5");bt("a<=.5","a <= .5");bt("a = 0xff;"); 61 | bt("a=0xff+4","a = 0xff + 4");bt("a = [1, 2, 3, 4]");bt("F*(g/=f)*g+b","F * (g /= f) * g + b");bt("a.b({c:d})","a.b({\n\tc: d\n})");bt("a.b\n(\n{\nc:\nd\n}\n)","a.b({\n\tc: d\n})");bt("a=!b","a = !b");bt("a?b:c","a ? b : c");bt("a?1:2","a ? 1 : 2");bt("a?(b):c","a ? (b) : c");bt('x={a:1,b:w=="foo"?x:y,c:z}','x = {\n\ta: 1,\n\tb: w == "foo" ? x : y,\n\tc: z\n}');bt("x=a?b?c?d:e:f:g;","x = a ? b ? c ? d : e : f : g;");bt("x=a?b?c?d:{e1:1,e2:2}:f:g;","x = a ? b ? c ? d : {\n\te1: 1,\n\te2: 2\n} : f : g;"); 62 | bt("function void(void) {}");bt("if(!a)foo();","if (!a) foo();");bt("a=~a","a = ~a");bt("a;/*comment*/b;","a; /*comment*/\nb;");bt("a;/* comment */b;","a; /* comment */\nb;");test_fragment("a;/*\ncomment\n*/b;","a;\n/*\ncomment\n*/\nb;");bt("a;/**\n* javadoc\n*/b;","a;\n/**\n * javadoc\n */\nb;");bt("if(a)break;","if (a) break;");bt("if(a){break}","if (a) {\n\tbreak\n}");bt("if((a))foo();","if ((a)) foo();");bt("for(var i=0;;)","for (var i = 0;;)");bt("a++;","a++;");bt("for(;;i++)","for (;; i++)"); 63 | bt("for(;;++i)","for (;; ++i)");bt("return(1)","return (1)");bt("try{a();}catch(b){c();}finally{d();}","try {\n\ta();\n} catch (b) {\n\tc();\n} finally {\n\td();\n}");bt("(xx)()");bt("a[1]()");bt("if(a){b();}else if(c) foo();","if (a) {\n\tb();\n} else if (c) foo();");bt("switch(x) {case 0: case 1: a(); break; default: break}","switch (x) {\ncase 0:\ncase 1:\n\ta();\n\tbreak;\ndefault:\n\tbreak\n}");bt("switch(x){case -1:break;case !y:break;}","switch (x) {\ncase -1:\n\tbreak;\ncase !y:\n\tbreak;\n}"); 64 | bt("a !== b");bt("if (a) b(); else c();","if (a) b();\nelse c();");bt("// comment\n(function something() {})");bt("{\n\n\tx();\n\n}");bt("if (a in b) foo();");bt("{a:1, b:2}","{\n\ta: 1,\n\tb: 2\n}");bt("a={1:[-1],2:[+1]}","a = {\n\t1: [-1],\n\t2: [+1]\n}");bt("var l = {'a':'1', 'b':'2'}","var l = {\n\t'a': '1',\n\t'b': '2'\n}");bt("if (template.user[n] in bk) foo();");bt("{{}/z/}","{\n\t{}\n\t/z/\n}");bt("return 45","return 45");bt("If[1]","If[1]");bt("Then[1]","Then[1]");bt("a = 1e10","a = 1e10"); 65 | bt("a = 1.3e10","a = 1.3e10");bt("a = 1.3e-10","a = 1.3e-10");bt("a = -1.3e-10","a = -1.3e-10");bt("a = 1e-10","a = 1e-10");bt("a = e - 10","a = e - 10");bt("a = 11-10","a = 11 - 10");bt("a = 1;// comment\n","a = 1; // comment");bt("a = 1; // comment\n","a = 1; // comment");bt("a = 1;\n // comment\n","a = 1;\n// comment");bt("o = [{a:b},{c:d}]","o = [{\n\ta: b\n}, {\n\tc: d\n}]");bt("if (a) {\n\tdo();\n}");bt("if\n(a)\nb();","if (a) b();");bt("if (a) {\n// comment\n}else{\n// comment\n}","if (a) {\n\t// comment\n} else {\n\t// comment\n}"); 66 | bt("if (a) {\n// comment\n// comment\n}","if (a) {\n\t// comment\n\t// comment\n}");bt("if (a) b() else c();","if (a) b()\nelse c();");bt("if (a) b() else if c() d();","if (a) b()\nelse if c() d();");bt("{}");bt("{\n\n}");bt("do { a(); } while ( 1 );","do {\n\ta();\n} while (1);");bt("do {} while (1);");bt("do {\n} while (1);","do {} while (1);");bt("do {\n\n} while (1);");bt("var a = x(a, b, c)");bt("delete x if (a) b();","delete x\nif (a) b();");bt("delete x[x] if (a) b();","delete x[x]\nif (a) b();"); 67 | bt("for(var a=1,b=2)","for (var a = 1, b = 2)");bt("for(var a=1,b=2,c=3)","for (var a = 1, b = 2, c = 3)");bt("for(var a=1,b=2,c=3;d<3;d++)","for (var a = 1, b = 2, c = 3; d < 3; d++)");bt("function x(){(a||b).c()}","function x() {\n\t(a || b).c()\n}");bt("function x(){return - 1}","function x() {\n\treturn -1\n}");bt("function x(){return ! a}","function x() {\n\treturn !a\n}");bt("settings = $.extend({},defaults,settings);","settings = $.extend({}, defaults, settings);");bt("{xxx;}()","{\n\txxx;\n}()"); 68 | bt("a = 'a'\nb = 'b'");bt("a = /reg/exp");bt("a = /reg/");bt("/abc/.test()");bt("/abc/i.test()");bt("{/abc/i.test()}","{\n\t/abc/i.test()\n}");bt("var x=(a)/a;","var x = (a) / a;");bt("x != -1","x != -1");bt("for (; s--\>0;)","for (; s-- > 0;)");bt("for (; s++>0;)","for (; s++ > 0;)");bt("a = s++>s--;","a = s++ > s--;");bt("a = s++>--s;","a = s++ > --s;");bt("{x=#1=[]}","{\n\tx = #1=[]\n}");bt("{a:#1={}}","{\n\ta: #1={}\n}");bt("{a:#1#}","{\n\ta: #1#\n}");test_fragment("{a:1},{a:2}","{\n\ta: 1\n}, {\n\ta: 2\n}"); 69 | test_fragment("var ary=[{a:1}, {a:2}];","var ary = [{\n\ta: 1\n}, {\n\ta: 2\n}];");test_fragment("{a:#1","{\n\ta: #1");test_fragment("{a:#","{\n\ta: #");test_fragment("}}}","}\n}\n}");test_fragment("