%0 Table {run.Relation Any Any;run2.Any} % Info Functor;Token Functor;Cons Functor;Info Functor;Token Functor;Cons Functor % module % halt ws3_halt(_upvals):-_upvals=[],(halt). % test ws3_test(_upvals):-_upvals=[],(_type_next = "EOF"). % run_ws ws3_run_ws(_l1,_l2,_upvals):-_upvals=[_ws],(((_l1 = '[|]'(fc_Token(_,"whitespace",_),_tks_tail))->(call(ws3_run_ws(_tks_tail,_l2),_upvals));(call_cl(_ws,[_l1,[],fc_Token("","SOF",_),_l2])))). % ws ws3_ws(_l,_ind,_tk_prev,_l2,_upvals):-_upvals=[_debug,_ws2,_debug],(_l = '[|]'(_h1,_t1),_h1 = fc_Token(_a,_type,_),((_l = '[|]'(fc_Token(_,"EOF",_),[]))->(((_ind = [],_l2 = _l);(dif(_ind,[]),_l2 = [fc_Token(";",";",_)|_l])));((dif(_type,"whitespace"))->(_l2 = [_h1|_t2],call(ws3_ws(_t1,_ind,_h1,_t2),_upvals));(_h1 = fc_Token(_a,_type,_),call_cl(_debug,["ws"]),((_t1 = '[|]'(fc_Token(_,"whitespace",_),_t2),call(ws3_ws(_t1,_ind,_tk_prev,_l2),_upvals));(dif(_t1,'[|]'(fc_Token(_,"whitespace",_),_t2)),(((call_cl(_ws2,[_l,_ind,_tk_prev,_l2])),(true);call_cl(_debug,["skip2"]),call(ws3_ws(_t1,_ind,_h1,_l2),_upvals))))))))). % ws2 ws3_ws2(_l,_ind,_tk_prev,_l2,_upvals):-_upvals=[_ws,_iterate,_push_semicolon,_debug,_debug,_ws,_debug,_ws,_debug,_ws,_iterate,_push_semicolon,_debug,_list,_list,_list,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_ws,_ws,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],(_l = '[|]'(_h1,_t1),_h1 = fc_Token(_a,_tk_type,_),call_cl(_after_nl,[_a,_a2]),_l = [_|[fc_Token(_,_type_next,_)|_]],call_cl(_debug,['[|]'(_a2,'[|]'(_ind,'[|]'(_snew,[])))]),(((_type_next = "EOF"),(get_(_list,"size",T43),_T42 = T43,call_cl(_T42,[_ind,_n]),call_cl(_iterate,[_push_semicolon,_n,_t1,_l2]));_neq = clos([_type_next,_iterate,_push_semicolon,_list,_debug,_after_nl],ws3_neq),(((call_cl(_remove_prev_inds,[_a2,_ind,_snew])),(call_cl(_debug,['[|]'("indent",'[|]'(_snew,[]))]),(((_snew = ""),(_ind2 = _ind,_tk_prev = fc_Token(_,_type_prev,_),_neq2 = clos([_type_prev,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],ws3_neq2),call_cl(_debug,['[|]'("same",'[|]'(_type_next,'[|]'(_type_prev,[])))]),get_(_list,"forall",T45),_T44 = T45,call_cl(_T44,['[|]'(";",'[|]'("connective",'[|]'("else",'[|]'("elseif",'[|]'("case",'[|]'("cond",[])))))),_neq]),get_(_list,"forall",T47),_T46 = T47,call_cl(_T46,['[|]'(";",'[|]'("{",'[|]'("connective",'[|]'("else",'[|]'("elseif",'[|]'("case",'[|]'("cond",[]))))))),_neq2]),call_cl(_ws,[_t1,_ind2,_h1,_t2]),_l2 = [fc_Token("and","connective",_info)|_t2]);dif(_snew,""),_ind2 = [_snew|_ind],call_cl(_ws,[_t1,_ind2,_h1,_t2]),_l2 = _t2)));call_cl(_debug,["unindent"]),call_cl(_debug,['[|]'("unindent",'[|]'(_ind,'[|]'(_a2,'[|]'(_n,[]))))]),call_cl(_remove_cur_inds,[_ind,_a2,_n]),call_cl(_debug,['[|]'("rem",'[|]'(_rest,'[|]'(_n,'[|]'(_ind,[]))))]),call_cl(_iterate,[_rest,_n,_ind,_ind2]),_tk_prev = fc_Token(_,_type_prev,_),call_cl(_debug,['[|]'("prev",'[|]'(_tk_prev,'[|]'(_n,[])))]),dif(_type_next,";"),dif(_type_next,"connective"),_neqprev = clos([_type_prev,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_ws,_ws,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],ws3_neqprev),get_(_list,"forall",T49),_T48 = T49,call_cl(_T48,['[|]'("connective",'[|]'("else",'[|]'("elseif",'[|]'("case",'[|]'("cond",[]))))),_neqprev]),get_(_list,"forall",T51),_T50 = T51,call_cl(_T50,['[|]'(";",'[|]'("connective",[])),_neq]),(((dif(_type_prev,";")),(get_(_list,"forall",T53),_T52 = T53,call_cl(_T52,['[|]'("}",'[|]'("else",'[|]'("elseif",'[|]'("case",'[|]'("cond",[]))))),_neq]),call_cl(_debug,[1.0]),call_cl(_iterate,[_push_semicolon,_n,[fc_Token("and","connective",_info)|_t2],_l2]),call_cl(_ws,[_t1,_ind2,_h1,_t2]));((_type_prev = "}"),(call_cl(_debug,[2.0]),_l2 = [fc_Token("and","connective",_info)|_t2],call_cl(_ws,[_t1,_ind2,_h1,_t2]));((_type_prev = ";"),(call_cl(_debug,[2.0]),_l2 = [fc_Token("and","connective",_info)|_t2],call_cl(_ws,[_t1,_ind2,_h1,_t2]));{_n-1.0=T54},_n2 = T54,call_cl(_debug,["skip3"]),call_cl(_debug,['[|]'(3.0,'[|]'(_n2,[]))]),call_cl(_iterate,[_push_semicolon,_n2,_t2,_l2]),call_cl(_ws,[_t1,_ind2,_h1,_t2])))))))))). % neqprev ws3_neqprev(_x,_upvals):-_upvals=[_type_prev,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_ws,_ws,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],(dif(_type_prev,_x)). % neq2 ws3_neq2(_x,_upvals):-_upvals=[_type_prev,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],(dif(_type_prev,_x)). % neq ws3_neq(_x,_upvals):-_upvals=[_type_next,_iterate,_push_semicolon,_list,_debug,_after_nl],(dif(_type_next,_x)). % pr ws3_pr(_l,_upvals):-_upvals=[_io,_io,_io,_io],((((true),(_l = '[|]'(fc_Token(_a,_,_),_l2),get_(_io,"write",T39),_T38 = T39,call_cl(_T38,[_a]),get_(_io,"write",T41),_T40 = T41,call_cl(_T40,[" "]),call(ws3_pr(_l2),_upvals));_l = []))). % push_semicolon ws3_push_semicolon(_l,_l2,_upvals):-_upvals=[],(_l2 = [fc_Token(";",";",_)|_l]). % after_nl ws3_after_nl(_a,_a2,_upvals):-_upvals=[_string,_find_last_char,_string],(get_(_string,"size",T30),_T29 = T30,call_cl(_T29,[_a,_i]),call_cl(_find_last_char,[_a,"\n",_i2]),get_(_string,"slice",T32),_T31 = T32,calc(_i2+1.0,T33),call_cl(_T31,[_a,T33,_i,_a2])). % remove_cur_inds ws3_remove_cur_inds(_ind,_sgoal,_n,_upvals):-_upvals=[_string,_list,_string,_list],((((true),(get_(_list,"fold",T26),_T25 = T26,get_(_string,"concat",T27),call_cl(_T25,[_ind,T27,"",_s]),str(_s,_s1),_s1 = _sgoal,_n = 0.0);_ind = [_h|_tail],call(ws3_remove_cur_inds(_tail,_sgoal,_i),_upvals),calc(_i+1.0,T28),_n = T28))). % remove_prev_inds ws3_remove_prev_inds(_s1,_ind,_s2,_upvals):-_upvals=[_remove_from_start,_list],(get_(_list,"fold",T21),_T20 = T21,call_cl(_T20,[_ind,_remove_from_start,_s1,_s2])). % remove_from_start ws3_remove_from_start(_s1,_s2,_s3,_upvals):-_upvals=[_string,_string,_string,_string],(get_(_string,"find",T12),_T11 = T12,call_cl(_T11,[_s1,_s2,_pos]),!,get_(_string,"size",T14),_T13 = T14,call_cl(_T13,[_s2,_n]),get_(_string,"size",T16),_T15 = T16,call_cl(_T15,[_s1,_n2]),calc(_n+_pos,T17),_k = T17,get_(_string,"slice",T19),_T18 = T19,call_cl(_T18,[_s1,_k,_n2,_s3])). % find_last_char ws3_find_last_char(_s,_c,_pos,_upvals):-_upvals=[_find_last_char2,_string],(dif(_s,""),get_(_string,"size",T9),_T8 = T9,call_cl(_T8,[_s,_n]),{_n-1.0=T10},call_cl(_find_last_char2,[_s,_c,T10,_pos])). % find_last_char2 ws3_find_last_char2(_s,_c,_i,_pos,_upvals):-_upvals=[_string],(dif(_i,-1.0),(((get_(_string,"at",T6),_T5 = T6,call_cl(_T5,[_s,_i,_c])),(_pos = _i);{_i-1.0=T7},call(ws3_find_last_char2(_s,_c,T7,_pos),_upvals)))). % rest ws3_rest(_l,_b,_upvals):-_upvals=[],(_l = [_|_b]). % iterate ws3_iterate(_p,_n,_x,_y,_upvals):-_upvals=[],((((_n = 0.0),(_y = _x);call_cl(_p,[_x,_x2]),{_n-1.0=T1},call(ws3_iterate(_p,T1,_x2,_y),_upvals)))). % debug ws3_debug(_s,_upvals):-_upvals=[],(true). % main ws3(X):-_debug = clos([],ws3_debug),_iterate = clos([],ws3_iterate),_rest = clos([],ws3_rest),creq1("string",_string,T2),call(T2,_string),creq1("list",_list,T3),call(T3,_list),creq1("io",_io,T4),call(T4,_io),_find_last_char2 = clos([_string],ws3_find_last_char2),_find_last_char = clos([_find_last_char2,_string],ws3_find_last_char),_remove_from_start = clos([_string,_string,_string,_string],ws3_remove_from_start),_remove_prev_inds = clos([_remove_from_start,_list],ws3_remove_prev_inds),_remove_cur_inds = clos([_string,_list,_string,_list],ws3_remove_cur_inds),_after_nl = clos([_string,_find_last_char,_string],ws3_after_nl),_push_semicolon = clos([],ws3_push_semicolon),_pr = clos([_io,_io,_io,_io],ws3_pr),_ws2 = clos([_ws,_iterate,_push_semicolon,_debug,_debug,_ws,_debug,_ws,_debug,_ws,_iterate,_push_semicolon,_debug,_list,_list,_list,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_ws,_ws,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],ws3_ws2),_ws = clos([_debug,_ws2,_debug],ws3_ws),_run_ws = clos([_ws],ws3_run_ws),_test = clos([],ws3_test),_halt = clos([],ws3_halt),new(T55),set_(T55,"run",_run_ws,T57),set_(T57,"run2",_run_all,T56),_t = T56,X=_t.