method simple_expr =
fun f e ->
let () = o#node f e Ast.loc_of_expr
in
match e with
| Ast.ExNil _ -> ()
| Ast.ExSeq (_, e) -> pp f "@[<hv1>(%a)@]" o#seq e
| Ast.ExApp (_,
(Ast.ExApp (_,
(Ast.ExId (_, (Ast.IdUid (_, "::")))), _)),
_) -> o#expr_list_cons true f e
| Ast.ExTup (_, e) -> pp f "@[<1>(%a)@]" o#expr e
| Ast.ExArr (_, e) ->
pp f "@[<0>@[<2>[|@ %a@]@ |]@]" o#under_semi#expr e
| Ast.ExCoe (_, e, (Ast.TyNil _), t) ->
pp f "@[<2>(%a :>@ %a)@]" o#expr e o#ctyp t
| Ast.ExCoe (_, e, t1, t2) ->
pp f "@[<2>(%a :@ %a :>@ %a)@]" o#expr e o#ctyp t1
o#ctyp t2
| Ast.ExTyc (_, e, t) ->
pp f "@[<2>(%a :@ %a)@]" o#expr e o#ctyp t
| Ast.ExAnt (_, s) -> o#anti f s
| Ast.ExFor (_, s, e1, e2, df, e3) ->
pp f
"@[<hv0>@[<hv2>@[<2>for %a =@ %a@ %a@ %a@ do@]@ %a@]@ done@]"
o#var s o#expr e1 o#direction_flag df o#expr e2
o#seq e3
| Ast.ExInt (_, s) -> o#numeric f s ""
| Ast.ExNativeInt (_, s) -> o#numeric f s "n"
| Ast.ExInt64 (_, s) -> o#numeric f s "L"
| Ast.ExInt32 (_, s) -> o#numeric f s "l"
| Ast.ExFlo (_, s) -> o#numeric f s ""
| Ast.ExChr (_, s) -> pp f "'%s'" (ocaml_char s)
| Ast.ExId (_, i) -> o#var_ident f i
| Ast.ExRec (_, b, (Ast.ExNil _)) ->
pp f "@[<hv0>@[<hv2>{%a@]@ }@]" o#record_binding b
| Ast.ExRec (_, b, e) ->
pp f "@[<hv0>@[<hv2>{@ (%a)@ with%a@]@ }@]"
o#expr e o#record_binding b
| Ast.ExStr (_, s) -> pp f "\"%s\"" s
| Ast.ExWhi (_, e1, e2) ->
pp f "@[<2>while@ %a@ do@ %a@ done@]" o#expr e1
o#seq e2
| Ast.ExLab (_, s, (Ast.ExNil _)) -> pp f "~%s" s
| Ast.ExLab (_, s, e) ->
pp f "@[<2>~%s:@ %a@]" s o#dot_expr e
| Ast.ExOlb (_, s, (Ast.ExNil _)) -> pp f "?%s" s
| Ast.ExOlb (_, s, e) ->
pp f "@[<2>?%s:@ %a@]" s o#dot_expr e
| Ast.ExVrn (_, s) -> pp f "`%a" o#var s
| Ast.ExOvr (_, b) ->
pp f "@[<hv0>@[<hv2>{<%a@]@ >}@]" o#record_binding
b
| Ast.ExCom (_, e1, e2) ->
pp f "%a,@ %a" o#simple_expr e1 o#simple_expr e2
| Ast.ExSem (_, e1, e2) ->
pp f "%a;@ %a" o#under_semi#expr e1 o#expr e2
| Ast.ExPkg (_, (Ast.MeTyc (_, me, mt))) ->
pp f "@[<hv0>@[<hv2>(module %a : %a@])@]"
o#module_expr me o#module_type mt
| Ast.ExPkg (_, me) ->
pp f "@[<hv0>@[<hv2>(module %a@])@]" o#module_expr
me
| Ast.ExApp (_, _, _) | Ast.ExAcc (_, _, _) |
Ast.ExAre (_, _, _) | Ast.ExSte (_, _, _) |
Ast.ExAss (_, _, _) | Ast.ExSnd (_, _, _) |
Ast.ExFun (_, _) | Ast.ExFUN (_, _, _) |
Ast.ExMat (_, _, _) | Ast.ExTry (_, _, _) |
Ast.ExIfe (_, _, _, _) | Ast.ExLet (_, _, _, _) |
Ast.ExLmd (_, _, _, _) | Ast.ExOpI (_, _, _) |
Ast.ExAsr (_, _) | Ast.ExAsf _ | Ast.ExLaz (_, _) |
Ast.ExNew (_, _) | Ast.ExObj (_, _, _) ->
pp f "(%a)" o#reset#expr e