summaryrefslogtreecommitdiff
path: root/ocamldoc/odoc_man.ml
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2014-10-14 15:51:30 +0000
committerAlain Frisch <alain@frisch.fr>2014-10-14 15:51:30 +0000
commite3ad818fb5f8ddc7b477779a6da69ccac0f00f4f (patch)
tree9016f709d251804278be1a75f518787aa571904b /ocamldoc/odoc_man.ml
parenta4e637ea622cf33b4c0870a98c6b1db0090f8e38 (diff)
parent8da19ea098b270230a9f1e1d252350bd69cbf8ee (diff)
downloadocaml-e3ad818fb5f8ddc7b477779a6da69ccac0f00f4f.tar.gz
Reintegrate-merge constructors_with_record5 branch.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15556 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'ocamldoc/odoc_man.ml')
-rw-r--r--ocamldoc/odoc_man.ml47
1 files changed, 27 insertions, 20 deletions
diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml
index e97db4bc5b..13733ba8e1 100644
--- a/ocamldoc/odoc_man.ml
+++ b/ocamldoc/odoc_man.ml
@@ -383,8 +383,14 @@ class man =
bs b "\n"
(** Print groff string to display a [Types.type_expr list].*)
- method man_of_type_expr_list ?par b m_name sep l =
- let s = Odoc_str.string_of_type_list ?par sep l in
+ method man_of_cstr_args ?par b m_name sep l =
+ let s =
+ match l with
+ | Cstr_tuple l ->
+ Odoc_str.string_of_type_list ?par sep l
+ | Cstr_record l ->
+ Odoc_str.string_of_record l
+ in
let s2 = Str.global_replace (Str.regexp "\n") "\n.B " s in
bs b "\n.B ";
bs b (self#relative_idents m_name s2);
@@ -448,16 +454,16 @@ class man =
bs b ("| "^(Name.simple x.xt_name));
(
match x.xt_args, x.xt_ret with
- | [], None -> bs b "\n"
+ | Cstr_tuple [], None -> bs b "\n"
| l, None ->
bs b "\n.B of ";
- self#man_of_type_expr_list ~par: false b father " * " l;
- | [], Some r ->
+ self#man_of_cstr_args ~par: false b father " * " l;
+ | Cstr_tuple [], Some r ->
bs b "\n.B : ";
self#man_of_type_expr b father r;
| l, Some r ->
bs b "\n.B : ";
- self#man_of_type_expr_list ~par: false b father " * " l;
+ self#man_of_cstr_args ~par: false b father " * " l;
bs b ".B -> ";
self#man_of_type_expr b father r;
);
@@ -498,18 +504,18 @@ class man =
bs b " \n";
(
match e.ex_args, e.ex_ret with
- | [], None -> ()
+ | Cstr_tuple [], None -> ()
| l, None ->
bs b ".B of ";
- self#man_of_type_expr_list
+ self#man_of_cstr_args
~par: false
b (Name.father e.ex_name) " * " e.ex_args
- | [], Some r ->
+ | Cstr_tuple [], Some r ->
bs b ".B : ";
self#man_of_type_expr b (Name.father e.ex_name) r
| l, Some r ->
bs b ".B : ";
- self#man_of_type_expr_list
+ self#man_of_cstr_args
~par: false
b (Name.father e.ex_name) " * " l;
bs b ".B -> ";
@@ -586,36 +592,36 @@ class man =
bs b " *)\n "
in
match constr.vc_args, constr.vc_text,constr.vc_ret with
- | [], None, None -> bs b "\n "
- | [], (Some t), None ->
+ | Cstr_tuple [], None, None -> bs b "\n "
+ | Cstr_tuple [], (Some t), None ->
print_text t
| l, None, None ->
bs b "\n.B of ";
- self#man_of_type_expr_list ~par: false b father " * " l;
+ self#man_of_cstr_args ~par: false b father " * " l;
bs b " "
| l, (Some t), None ->
bs b "\n.B of ";
- self#man_of_type_expr_list ~par: false b father " * " l;
+ self#man_of_cstr_args ~par: false b father " * " l;
bs b ".I \" \"\n";
print_text t
- | [], None, Some r ->
+ | Cstr_tuple [], None, Some r ->
bs b "\n.B : ";
self#man_of_type_expr b father r;
bs b " "
- | [], (Some t), Some r ->
+ | Cstr_tuple [], (Some t), Some r ->
bs b "\n.B : ";
self#man_of_type_expr b father r;
bs b ".I \" \"\n";
print_text t
| l, None, Some r ->
bs b "\n.B : ";
- self#man_of_type_expr_list ~par: false b father " * " l;
+ self#man_of_cstr_args ~par: false b father " * " l;
bs b ".B -> ";
self#man_of_type_expr b father r;
bs b " "
| l, (Some t), Some r ->
bs b "\n.B of ";
- self#man_of_type_expr_list ~par: false b father " * " l;
+ self#man_of_cstr_args ~par: false b father " * " l;
bs b ".B -> ";
self#man_of_type_expr b father r;
bs b ".I \" \"\n";
@@ -822,8 +828,8 @@ class man =
bs b ".I ";
bs b (c.vc_name^" ");
(match c.vc_args with
- [] -> ()
- | h::q ->
+ | Cstr_tuple [] -> ()
+ | Cstr_tuple (h::q) ->
bs b "of ";
self#man_of_type_expr b modname h;
List.iter
@@ -831,6 +837,7 @@ class man =
bs b " * ";
self#man_of_type_expr b modname ty)
q
+ | Cstr_record _ -> bs b "{ ... }"
);
bs b "\n.sp\n";
self#man_of_info b c.vc_text;