(* Modified code *)
let mcodekind brackets fn x info mc =
- let print = function Ast.Noindent s | Ast.Indent s -> print_string s in
+ let print = function
+ Ast.Noindent s | Ast.Indent s | Ast.Space s -> print_string s in
List.iter (function (s,_) -> print s) info.Ast0.strings_before;
(match mc with
Ast0.MINUS(plus_stream) ->
| Ast0.CIRCLES(l) -> print_between between fn l
| Ast0.STARS(l) -> print_between between fn l)
+(* --------------------------------------------------------------------- *)
+(* Disjunctions *)
+
+let do_disj lst processor =
+ print_string "\n("; force_newline();
+ print_between (function _ -> print_string "\n|"; force_newline())
+ processor lst;
+ print_string "\n)"
+
(* --------------------------------------------------------------------- *)
let print_types = function
| Ast0.MetaId(name,_,_) -> mcode print_meta name
| Ast0.MetaFunc(name,_,_) -> mcode print_meta name
| 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.PureContext -> print_string "pure_context")*)
| Ast0.MetaExprList(name,_,_) -> mcode print_meta name
| Ast0.EComma(cm) -> mcode print_string cm; print_space()
- | Ast0.DisjExpr(_,exp_list,_,_) ->
- print_string "\n("; force_newline();
- print_between
- (function _ -> print_string "\n|"; force_newline())
- expression exp_list;
- print_string "\n)"
+ | Ast0.DisjExpr(_,exp_list,_,_) -> do_disj exp_list expression
| Ast0.NestExpr(starter,expr_dots,ender,None,multi) ->
mcode print_string starter;
start_block(); dots force_newline expression expr_dots; end_block();
mcode print_string rb
| Ast0.TypeName(name)-> mcode print_string name; print_string " "
| Ast0.MetaType(name,_)-> mcode print_meta name; print_string " "
- | Ast0.DisjType(lp,types,mids,rp) ->
- print_string "\n"; mcode print_string lp; force_newline();
- print_between
- (function _ -> print_string "\n|"; force_newline())
- typeC types;
- print_string "\n"; mcode print_string rp
+ | Ast0.DisjType(_,types,_,_) -> do_disj types typeC
| Ast0.OptType(ty) -> print_string "?"; typeC ty
| Ast0.UniqueType(ty) -> print_string "!"; typeC ty)
print_context d
(function _ ->
match Ast0.unwrap d with
- Ast0.MetaDecl(name,_) | Ast0.MetaField(name,_) -> mcode print_meta name
+ Ast0.MetaDecl(name,_) | Ast0.MetaField(name,_)
+ | Ast0.MetaFieldList(name,_,_) ->
+ mcode print_meta name
| Ast0.Init(stg,ty,id,eq,ini,sem) ->
print_option (mcode U.storage) stg;
print_named_type ty id;
whn
| Ast0.Include(inc,s) ->
mcode print_string inc; print_string " "; mcode U.inc_file s
+ | Ast0.Undef(def,id) ->
+ mcode print_string def; print_string " "; ident id
| Ast0.Define(def,id,params,body) ->
mcode print_string def; print_string " "; ident id;
print_define_parameters params;