% module :-style_check(-singleton),style_check(-no_effect),ensure_loaded("core3"). % run_all ws_run_all(_s,_l3,_upvals):-_upvals=[_run_ws,_debug,_debug,_lexer,_debug],(call_cl(_debug,["lexer..."]),get_(_lexer,"run",T27789),_T73885=T27789,call_cl(_T73885,[_s,_l2]),call_cl(_debug,[_l2]),!,call_cl(_debug,["whitespace..."]),call_cl(_run_ws,[_l2,_l3])). % halt ws_halt(_upvals):-_upvals=[],(halt). % test ws_test(_upvals):-_upvals=[],(_type_next="EOF"). % run_ws ws_run_ws(_l1,_l2,_upvals):-_upvals=[_ws],(((_l1=[fc_Token(_,"whitespace",_)|_tks_tail],call(ws_run_ws(_tks_tail,_l2),_upvals));(call_cl(_ws,[_l1,[],fc_Token("","SOF",_),_l2])))). % ws ws_ws(_l,_ind,_tk_prev,_l2,_upvals):-_upvals=[_iterate,_push_semicolon,_debug,_debug,_debug,_debug,_iterate,_push_semicolon,_debug,_list,_list,_list,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],(((true,_l=[fc_Token(_,"EOF",_)|[]],((_ind=[],_l2=_l);(_l2=[fc_Token(";",";",_)|_l])));(_l=[_h1|_t1],_h1=fc_Token(_a,_tk_type,_),neq(_tk_type,"whitespace"),call(ws_ws(_t1,_ind,_h1,_t2),_upvals),_l2=[_h1|_t2]);(_l=[_|_t1],_t1=[_h2|_t2],_h2=fc_Token(_,"whitespace",_),call(ws_ws(_t1,_ind,_tk_prev,_t3),_upvals),_l2=_t3);(_l=[_h1|_t1],_h1=fc_Token(_a,"whitespace",_info),call_cl(_after_nl,[_a,_a2]),_l=[_|[fc_Token(_,_type_next,_)|_]],call_cl(_debug,['[|]'(_a2,'[|]'(_ind,'[|]'(_snew,[])))]),((_type_next="EOF",get_(_list,"size",T5217),_T11807=T5217,call_cl(_T11807,[_ind,_n]),_t2=_t1,call_cl(_iterate,[_push_semicolon,_n,_t2,_l2]));(_neq=clos([_type_next,_iterate,_push_semicolon,_list,_debug,_after_nl],ws_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],ws_neq2),call_cl(_debug,['[|]'("same",'[|]'(_type_next,'[|]'(_type_prev,[])))]),get_(_list,"forall",T54667),_T84756=T54667,call_cl(_T84756,['[|]'(";",'[|]'("connective",'[|]'("else",'[|]'("elseif",'[|]'("case",[]))))),_neq]),get_(_list,"forall",T53462),_T44593=T53462,call_cl(_T44593,['[|]'(";",'[|]'("{",'[|]'("connective",'[|]'("else",'[|]'("elseif",'[|]'("case",[])))))),_neq2]),call(ws_ws(_t1,_ind2,_h1,_t2),_upvals),_l2=[fc_Token("and","connective",_info)|_t2]);(neq(_snew,""),_ind2=[_snew|_ind],call(ws_ws(_t1,_ind2,_h1,_t2),_upvals),_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,[])))]),neq(_type_next,";"),neq(_type_next,"connective"),_neqprev=clos([_type_prev,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],ws_neqprev),get_(_list,"forall",T82279),_T68141=T82279,call_cl(_T68141,['[|]'("connective",'[|]'("else",'[|]'("elseif",'[|]'("case",[])))),_neqprev]),get_(_list,"forall",T30417),_T40362=T30417,call_cl(_T40362,['[|]'(";",'[|]'("connective",[])),_neq]),((neq(_type_prev,";"),get_(_list,"forall",T79438),_T20258=T79438,call_cl(_T20258,['[|]'("}",'[|]'("else",'[|]'("elseif",'[|]'("case",[])))),_neq]),call_cl(_debug,[1]),call_cl(_iterate,[_push_semicolon,_n,[fc_Token("and","connective",_info)|_t2],_l2]),call(ws_ws(_t1,_ind2,_h1,_t2),_upvals));(_type_prev="}",call_cl(_debug,[2]),_l2=[fc_Token("and","connective",_info)|_t2],call(ws_ws(_t1,_ind2,_h1,_t2),_upvals));(_type_prev=";",call_cl(_debug,[2]),_l2=[fc_Token("and","connective",_info)|_t2],call(ws_ws(_t1,_ind2,_h1,_t2),_upvals));(_n2=_n-1,call_cl(_debug,["skip"]),call_cl(_debug,['[|]'(3,'[|]'(_n2,[]))]),call_cl(_iterate,[_push_semicolon,_n2,_t2,_l2]),call(ws_ws(_t1,_ind2,_h1,_t2),_upvals))))))));(_l=[_h1|_t1],call(ws_ws(_t1,_ind,_h1,_t2),_upvals),_l2=_t2))). % neqprev ws_neqprev(_x,_upvals):-_upvals=[_type_prev,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],(neq(_type_prev,_x)). % neq2 ws_neq2(_x,_upvals):-_upvals=[_type_prev,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],(neq(_type_prev,_x)). % neq ws_neq(_x,_upvals):-_upvals=[_type_next,_iterate,_push_semicolon,_list,_debug,_after_nl],(neq(_type_next,_x)). % pr ws_pr(_l,_upvals):-_upvals=[_io,_io],(((true,_l='[|]'(fc_Token(_a,_,_),_l2),get_(_io,"write",T35990),_T34565=T35990,call_cl(_T34565,[_a]),get_(_io,"write",T16497),_T65699=T16497,call_cl(_T65699,[" "]),call(ws_pr(_l2),_upvals));(_l=[]))). % push_semicolon ws_push_semicolon(_l,_l2,_upvals):-_upvals=[],(_l2=[fc_Token(";",";",_)|_l]). % after_nl ws_after_nl(_a,_a2,_upvals):-_upvals=[_string,_find_last_char,_string],(get_(_string,"size",T72842),_T87191=T72842,call_cl(_T87191,[_a,_i]),call_cl(_find_last_char,[_a,"\n",_i2]),get_(_string,"slice",T73534),_T29927=T73534,call_cl(_T29927,[_a,_i2+1,_i,_a2])). % remove_cur_inds ws_remove_cur_inds(_ind,_sgoal,_n,_upvals):-_upvals=[_string,_list],(((true,get_(_list,"fold",T78717),_T16334=T78717,get_(_string,"concat",T20029),call_cl(_T16334,[_ind,T20029,"",_s]),str(_s,_s1),_s1=_sgoal,_n=0);(_ind=[_h|_tail],call(ws_remove_cur_inds(_tail,_sgoal,_i),_upvals),_n=_i+1))). % remove_prev_inds ws_remove_prev_inds(_s1,_ind,_s2,_upvals):-_upvals=[_remove_from_start,_list],(get_(_list,"fold",T71726),_T5266=T71726,call_cl(_T5266,[_ind,_remove_from_start,_s1,_s2])). % remove_from_start ws_remove_from_start(_s1,_s2,_s3,_upvals):-_upvals=[_string,_string,_string,_string],(get_(_string,"find",T65944),_T41382=T65944,call_cl(_T41382,[_s1,_s2,_pos]),!,get_(_string,"size",T40756),_T55100=T40756,call_cl(_T55100,[_s2,_n]),get_(_string,"size",T81411),_T75120=T81411,call_cl(_T75120,[_s1,_n2]),_k=_n+_pos,get_(_string,"slice",T81803),_T72641=T81803,call_cl(_T72641,[_s1,_k,_n2,_s3])). % find_last_char ws_find_last_char(_s,_c,_pos,_upvals):-_upvals=[_find_last_char2,_string],(neq(_s,""),get_(_string,"size",T84577),_T47362=T84577,call_cl(_T47362,[_s,_n]),call_cl(_find_last_char2,[_s,_c,_n-1,_pos])). % find_last_char2 ws_find_last_char2(_s,_c,_i,_pos,_upvals):-_upvals=[_string],(neq(_i,-1),((get_(_string,"at",T51478),_T87602=T51478,call_cl(_T87602,[_s,_i,_ci]),_ci=_c,_pos=_i);(X38871 is _i-1,call(ws_find_last_char2(_s,_c,X38871,_pos),_upvals)))). % rest ws_rest(_l,_b,_upvals):-_upvals=[],(_l=[_|_b]). % iterate ws_iterate(_p,_n,_x,_y,_upvals):-_upvals=[],(((X60551 is _n,X60551=0,_y=_x);(call_cl(_p,[_x,_x2]),call(ws_iterate(_p,_n-1,_x2,_y),_upvals)))). % debug ws_debug(_s,_upvals):-_upvals=[],(writeln_(_s)). % main ws(X):-_debug=clos([],ws_debug),_iterate=clos([],ws_iterate),_rest=clos([],ws_rest),creq("string",_string),creq("list",_list),_find_last_char2=clos([_string],ws_find_last_char2),_find_last_char=clos([_find_last_char2,_string],ws_find_last_char),_remove_from_start=clos([_string,_string,_string,_string],ws_remove_from_start),_remove_prev_inds=clos([_remove_from_start,_list],ws_remove_prev_inds),_remove_cur_inds=clos([_string,_list],ws_remove_cur_inds),_after_nl=clos([_string,_find_last_char,_string],ws_after_nl),_push_semicolon=clos([],ws_push_semicolon),new(T70248),set_(T70248,"write",_write,T88669),set_(T88669,"writeln",_writeln,T15025),_io=T15025,_pr=clos([_io,_io],ws_pr),_ws=clos([_iterate,_push_semicolon,_debug,_debug,_debug,_debug,_iterate,_push_semicolon,_debug,_list,_list,_list,_debug,_iterate,_rest,_debug,_rest,_remove_cur_inds,_debug,_debug,_list,_list,_debug,_debug,_remove_prev_inds,_iterate,_push_semicolon,_list,_debug,_after_nl],ws_ws),_run_ws=clos([_ws],ws_run_ws),_test=clos([],ws_test),_halt=clos([],ws_halt),creq("lexer",_lexer),_run_all=clos([_run_ws,_debug,_debug,_lexer,_debug],ws_run_all),new(T4845),set_(T4845,"run",_run_ws,T17057),set_(T17057,"run2",_run_all,T17182),_t=T17182,X=_t,_s="if(x)\n\ttrue\nx=1",call_cl(_run_all,[_s,_l]),call_cl(_debug,[_l]),call_cl(_test,[]),call_cl(_debug,["--"]),call_cl(_debug,[2]).