method sig_item =
fun f sg ->
let () = o#node f sg Ast.loc_of_sig_item
in
match sg with
| Ast.SgNil _ -> ()
| Ast.SgSem (_, sg, (Ast.SgNil _)) |
Ast.SgSem (_, (Ast.SgNil _), sg) -> o#sig_item f sg
| Ast.SgSem (_, sg1, sg2) ->
(o#sig_item f sg1; cut f; o#sig_item f sg2)
| Ast.SgExc (_, t) ->
pp f "@[<2>exception@ %a%(%)@]" o#ctyp t semisep
| Ast.SgExt (_, s, t, sl) ->
pp f "@[<2>external@ %a :@ %a =@ %a%(%)@]"
o#var s o#ctyp t (meta_list o#quoted_string "@ ")
sl semisep
| Ast.SgMod (_, s1, (Ast.MtFun (_, s2, mt1, mt2))) ->
let rec loop accu =
(function
| Ast.MtFun (_, s, mt1, mt2) ->
loop ((s, mt1) :: accu) mt2
| mt -> ((List.rev accu), mt)) in
let (al, mt) = loop [ (s2, mt1) ] mt2
in
pp f "@[<2>module %a@ @[<0>%a@] :@ %a%(%)@]"
o#var s1 o#functor_args al o#module_type mt
semisep
| Ast.SgMod (_, s, mt) ->
pp f "@[<2>module %a :@ %a%(%)@]" o#var s
o#module_type mt semisep
| Ast.SgMty (_, s, (Ast.MtNil _)) ->
pp f "@[<2>module type %a%(%)@]" o#var s semisep
| Ast.SgMty (_, s, mt) ->
pp f "@[<2>module type %a =@ %a%(%)@]" o#var s
o#module_type mt semisep
| Ast.SgOpn (_, sl) ->
pp f "@[<2>open@ %a%(%)@]" o#ident sl semisep
| Ast.SgTyp (_, t) ->
pp f "@[<hv0>@[<hv2>type %a@]%(%)@]" o#ctyp t
semisep
| Ast.SgVal (_, s, t) ->
pp f "@[<2>%s %a :@ %a%(%)@]" o#value_val o#var s
o#ctyp t semisep
| Ast.SgInc (_, mt) ->
pp f "@[<2>include@ %a%(%)@]" o#module_type mt
semisep
| Ast.SgClt (_, ct) ->
pp f "@[<2>class type %a%(%)@]" o#class_type ct
semisep
| Ast.SgCls (_, ce) ->
pp f "@[<2>class %a%(%)@]" o#class_type ce semisep
| Ast.SgRecMod (_, mb) ->
pp f "@[<2>module rec %a%(%)@]"
o#module_rec_binding mb semisep
| Ast.SgDir (_, _, _) -> ()
| Ast.SgAnt (_, s) -> pp f "%a%(%)" o#anti s semisep