*)
+# 0 "./unparse_ast0.ml"
open Format
module Ast = Ast_cocci
module Ast0 = Ast0_cocci
| Ast0.MetaLocalFunc(name,_,_) -> mcode print_meta name
| Ast0.DisjId(_,id_list,_,_) -> do_disj id_list ident
| Ast0.OptIdent(id) -> print_string "?"; ident id
- | Ast0.UniqueIdent(id) -> print_string "!"; ident id)
+ | Ast0.UniqueIdent(id) -> print_string "!"; ident id
+ | Ast0.AsIdent(id,asid) -> ident id; print_string "@"; ident asid)
(* --------------------------------------------------------------------- *)
(* Expression *)
| Ast0.Pdots(dots) -> mcode print_string dots
| Ast0.Pcircles(dots) -> mcode print_string dots
| Ast0.OptParam(param) -> print_string "?"; parameterTypeDef param
- | Ast0.UniqueParam(param) -> print_string "!"; parameterTypeDef param)
+ | Ast0.UniqueParam(param) -> print_string "!"; parameterTypeDef param
+ | Ast0.AsParam(p,asexp) -> parameterTypeDef p; print_string "@";
+ expression asexp)
and parameter_list l = dots (function _ -> ()) parameterTypeDef l
dots force_newline (statement arity) body;
end_block(); print_string arity; mcode print_string rbrace
| Ast0.Decl(_,decl) ->
- Printf.printf "statement mcodekind %s\n"
- (Dumper.dump (Ast0.get_mcodekind s));
- Printf.printf "decl mcodekind %s\n"
- (Dumper.dump (Ast0.get_mcodekind decl));
print_string arity; declaration decl
| Ast0.Seq(lbrace,body,rbrace) ->
print_string arity; mcode print_string lbrace; start_block();
| Ast0.ExprStatement(exp,sem) ->
print_string arity; print_option expression exp;
mcode print_string sem
- | Ast0.IfThen(iff,lp,exp,rp,branch1,(info,aft)) ->
+ | Ast0.IfThen(iff,lp,exp,rp,branch1,(info,aft,adj)) ->
print_string arity;
mcode print_string iff; print_string " "; mcode print_string_box lp;
expression exp; close_box(); mcode print_string rp; print_string " ";
statement arity branch1;
- mcode (function _ -> ()) ((),(),info,aft,ref [],-1)
- | Ast0.IfThenElse(iff,lp,exp,rp,branch1,els,branch2,(info,aft)) ->
+ mcode (function _ -> ()) ((),(),info,aft,ref [],adj)
+ | Ast0.IfThenElse(iff,lp,exp,rp,branch1,els,branch2,(info,aft,adj)) ->
print_string arity;
mcode print_string iff; print_string " "; mcode print_string_box lp;
expression exp; close_box(); mcode print_string rp; print_string " ";
statement arity branch1;
print_string arity; mcode print_string els; print_string " ";
statement arity branch2;
- mcode (function _ -> ()) ((),(),info,aft,ref [],-1)
- | Ast0.While(whl,lp,exp,rp,body,(info,aft)) ->
+ mcode (function _ -> ()) ((),(),info,aft,ref [],adj)
+ | Ast0.While(whl,lp,exp,rp,body,(info,aft,adj)) ->
print_string arity;
mcode print_string whl; print_string " "; mcode print_string_box lp;
expression exp; close_box(); mcode print_string rp; print_string " ";
statement arity body;
- mcode (function _ -> ()) ((),(),info,aft,ref [],-1)
+ mcode (function _ -> ()) ((),(),info,aft,ref [],adj)
| Ast0.Do(d,body,whl,lp,exp,rp,sem) ->
print_string arity; mcode print_string d; print_string " ";
statement arity body;
mcode print_string whl; print_string " "; mcode print_string_box lp;
expression exp; close_box(); mcode print_string rp;
mcode print_string sem
- | Ast0.For(fr,lp,e1,sem1,e2,sem2,e3,rp,body,(info,aft)) ->
+ | Ast0.For(fr,lp,first,e2,sem2,e3,rp,body,(info,aft,adj)) ->
print_string arity;
mcode print_string fr; mcode print_string_box lp;
- print_option expression e1; mcode print_string sem1;
+ (match Ast0.unwrap first with
+ Ast0.ForExp(e1,sem1) ->
+ print_option expression e1; mcode print_string sem1
+ | Ast0.ForDecl (_,decl) -> declaration decl);
print_option expression e2; mcode print_string sem2;
print_option expression e3; close_box();
mcode print_string rp; print_string " "; statement arity body;
- mcode (function _ -> ()) ((),(),info,aft,ref [],-1)
- | Ast0.Iterator(nm,lp,args,rp,body,(info,aft)) ->
+ mcode (function _ -> ()) ((),(),info,aft,ref [],adj)
+ | Ast0.Iterator(nm,lp,args,rp,body,(info,aft,adj)) ->
print_string arity;
ident nm; print_string " "; mcode print_string_box lp;
let _ = dots (function _ -> ()) expression args in
close_box(); mcode print_string rp; print_string " ";
statement arity body;
- mcode (function _ -> ()) ((),(),info,aft,ref [],-1)
+ mcode (function _ -> ()) ((),(),info,aft,ref [],adj)
| Ast0.Switch(switch,lp,exp,rp,lb,decls,cases,rb) ->
print_string arity;
mcode print_string switch; print_string " ";
| Ast0.StmtTag(d) ->
print_string "Stm:"; force_newline();
statement "" d
+ | Ast0.ForInfoTag(fi) ->
+ print_string "ForInfo:"; force_newline();
+ (match Ast0.unwrap fi with
+ Ast0.ForExp(e1,sem1) ->
+ print_option expression e1; mcode print_string sem1
+ | Ast0.ForDecl (_,decl) -> declaration decl)
| Ast0.CaseLineTag(d) -> case_line "" d
| Ast0.TopTag(d) -> top_level d
| Ast0.IsoWhenTag(x) -> U.print_when_modif x