anchor.diff:             "\n);"
          )).
   
  -rec2json(Rec) -> rec2json(Rec, "", 0).
  -rec2json(#sql_box_rec{name="fields"}=Rec, Json, T) ->
  -    rec2json(Rec#sql_box_rec{name=""}, Json, T);
  -rec2json(#sql_box_rec{name=N,children=[]}, _Json, T) ->
  -    lists:duplicate(T, $\t)++"{name:\""++N++"\", top:0, height:0, children:[]}";
  -rec2json(#sql_box_rec{name=N,children=Childs}, Json, T) ->
  -    lists:duplicate(T, $\t)++"{name:\""++N++"\", top:0, height:0, children:[\n"++
  -     string:join([rec2json(C, Json,T+1) || C <- Childs], ",\n")
  -    ++"\n"++lists:duplicate(T, $\t)++"]}".
  +rec2json(Rec, Format) -> rec2json(Rec, "", 0, Format).
  +rec2json(#sql_box_rec{name="fields"}=Rec, Json, T, Format) -> rec2json(Rec#sql_box_rec{name=""}, Json, T, Format);
  +
  +rec2json(#sql_box_rec{name=N,children=[]}, _Json, _, no_format) -> "{\"name\":\""++N++"\", \"top\":0, \"height\":0, \"children\":[]}";
  +rec2json(#sql_box_rec{name=N,children=Childs}, Json, T, no_format) ->
  +    "{\"name\":\""++N++"\", \"top\":0, \"height\":0, \"children\":["++
  +     string:join([rec2json(C, Json, T+1, no_format) || C <- Childs], ",")
  +    ++"]}";
  +
  +rec2json(#sql_box_rec{name=N,children=[]}, _Json, T, format)    -> lists:duplicate(T, $\t)++"'{\"name\":\""++N++"\", \"top\":0, \"height\":0, \"children\":[]}";
  +rec2json(#sql_box_rec{name=N,children=Childs}, Json, T, format) ->
  +    lists:duplicate(T, $\t)++"'{\"name\":\""++N++"\", \"top\":0, \"height\":0, \"children\":['\n+"++
  +     string:join([rec2json(C, Json, T+1, format) || C <- Childs], ",'\n+")
  +    ++"'\n+"++lists:duplicate(T, $\t)++"']}".
   
   walk_test() ->
       io:format(user, "=================================~n", []),
  
positive.code: -module(sql_walk).
  
  -export([walk_tree/1, walk_tree/2]).
  
  -include_lib("eunit/include/eunit.hrl").
  -include("sql_box.hrl").
  -include("sql_tests.hrl").
  
  walk_tree(SqlParseTree) -> walk_tree(SqlParseTree, #sql_box_rec{}).
  
  
negative.code:    file:write_file(NewFile, list_to_binary(
              "var parsetree = new Object();\n"++
              "parsetree.json = function() {\n"++
                  "\tJson =JSON.parse(\n" ++
                  rec2json(Rec, format) ++ "'\n);\n" ++
                  "\treturn Json;\n" ++
              "}\n" ++
              "parsetree.sql = function() {\n" ++
  