method str_item =
fun f st ->
let () = o#node f st Ast.loc_of_str_item
in
match st with
| Ast.StNil _ -> ()
| Ast.StSem (_, st, (Ast.StNil _)) |
Ast.StSem (_, (Ast.StNil _), st) -> o#str_item f st
| Ast.StSem (_, st1, st2) ->
(o#str_item f st1; cut f; o#str_item f st2)
| Ast.StExc (_, t, Ast.ONone) ->
pp f "@[<2>exception@ %a%(%)@]" o#ctyp t semisep
| Ast.StExc (_, t, (Ast.OSome sl)) ->
pp f "@[<2>exception@ %a =@ %a%(%)@]" o#ctyp t
o#ident sl semisep
| Ast.StExt (_, s, t, sl) ->
pp f "@[<2>external@ %a :@ %a =@ %a%(%)@]"
o#var s o#ctyp t (meta_list o#quoted_string "@ ")
sl semisep
| Ast.StMod (_, s1, (Ast.MeFun (_, s2, mt1, me))) ->
(match o#module_expr_get_functor_args [ (s2, mt1) ]
me
with
| (al, me, Some mt2) ->
pp f
"@[<2>module %a@ @[<0>%a@] :@ %a =@ %a%(%)@]"
o#var s1 o#functor_args al o#module_type mt2
o#module_expr me semisep
| (al, me, _) ->
pp f "@[<2>module %a@ @[<0>%a@] =@ %a%(%)@]"
o#var s1 o#functor_args al o#module_expr me
semisep)
| Ast.StMod (_, s, (Ast.MeTyc (_, me, mt))) ->
pp f "@[<2>module %a :@ %a =@ %a%(%)@]" o#var s
o#module_type mt o#module_expr me semisep
| Ast.StMod (_, s, me) ->
pp f "@[<2>module %a =@ %a%(%)@]" o#var s
o#module_expr me semisep
| Ast.StMty (_, s, mt) ->
pp f "@[<2>module type %a =@ %a%(%)@]" o#var s
o#module_type mt semisep
| Ast.StOpn (_, sl) ->
pp f "@[<2>open@ %a%(%)@]" o#ident sl semisep
| Ast.StTyp (_, t) ->
pp f "@[<hv0>@[<hv2>type %a@]%(%)@]" o#ctyp t
semisep
| Ast.StVal (_, r, bi) ->
pp f "@[<2>%s %a%a%(%)@]" o#value_let o#rec_flag r
o#binding bi semisep
| Ast.StExp (_, e) ->
pp f "@[<2>let _ =@ %a%(%)@]" o#expr e semisep
| Ast.StInc (_, me) ->
pp f "@[<2>include@ %a%(%)@]" o#simple_module_expr
me semisep
| Ast.StClt (_, ct) ->
pp f "@[<2>class type %a%(%)@]" o#class_type ct
semisep
| Ast.StCls (_, ce) ->
pp f "@[<hv2>class %a%(%)@]" o#class_declaration ce
semisep
| Ast.StRecMod (_, mb) ->
pp f "@[<2>module rec %a%(%)@]"
o#module_rec_binding mb semisep
| Ast.StDir (_, _, _) -> ()
| Ast.StAnt (_, s) -> pp f "%a%(%)" o#anti s semisep
| Ast.StExc (_, _, (Ast.OAnt _)) -> assert false