You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Camlp4o messes with comments, hence with ocamldoc generation of documentation.
In order for comments to be used by ocamldoc, they should come immediately before or after a value. Camlp4o moves comments away from values, hence breaks ocamldoc.
Is there any hope that this could be fixed?
Examples :
$ cat tst.ml
(** comment of t *)
type t =
{
mutable a : int; (** a *)
mutable b : int; (** b *)
mutable c : int; (** c *)
mutable d : int; (** d *)
mutable e : int; (** e *)
}
(** after *)
$ camlp4o tst.ml
(** comment of t *)
type t =
{ (** a *) (** b *) (** c *) mutable a : int; mutable b : int;
mutable c : int; mutable d : int; (** d *) mutable e : int
}
cat tst_bis.ml
(** comment of t *)
type t =
{
mutable a : int; (** a *)
mutable b : int; (** b *)
mutable c : int; (** c *)
mutable d : int; (** d *)
mutable e : int; (** e *)
}
(** after *)
()
$ camlp4o tst_bis.ml
(** comment of t *)
type t =
{ (** a *) (** b *) (** c *) mutable a : int; mutable b : int;
mutable c : int; mutable d : int; (** d *) mutable e : int
}
(** e *)
(** after *)
let _ = ()
Old patch with partial fix :
diff --exclude=.svn -ur /home/ygrek/work/contrib/ocaml/3.11/camlp4/Camlp4/Printers/OCaml.ml camlp4/Camlp4/Printers/OCaml.ml--- /home/ygrek/work/contrib/ocaml/3.11/camlp4/Camlp4/Printers/OCaml.ml 2009-10-31 13:58:04.000000000 +0200+++ camlp4/Camlp4/Printers/OCaml.ml 2009-12-31 14:39:27.000000000 +0200@@ -152,6 +152,13 @@
do_print_comments_before loc f s
| [: :] -> () ];
+ value rec do_print_all_comments loc f =+ parser+ [ [: ` (comm, comm_loc); s :] ->+ let () = f comm comm_loc in+ do_print_all_comments loc f s+ | [: :] -> () ];+
class printer ?curry_constr:(init_curry_constr = False) ?(comments = True) () =
object (o)
@@ -737,7 +744,7 @@
<:sig_item< $<:sig_item<>>$; $sg$ >> ->
o#sig_item f sg
| <:sig_item< $sg1$; $sg2$ >> ->
- do { o#sig_item f sg1; cut f; o#sig_item f sg2 }+ do { o#sig_item f sg1; o#node f sg2 Ast.loc_of_sig_item; cut f; o#sig_item f sg2 }
| <:sig_item< exception $t$ >> ->
pp f "@[<2>exception@ %a%(%)@]" o#ctyp t semisep
| <:sig_item< external $s$ : $t$ = $sl$ >> ->
@@ -1012,7 +1019,13 @@
[ <:str_item< $exp:e$ >> -> pp f "@[<0>%a%(%)@]@." o#expr e semisep
| st -> pp f "@[<v0>%a@]@." o#str_item st ];
- method interf f sg = pp f "@[<v0>%a@]@." o#sig_item sg;+ method interf f sg = + let () = pp f "@[<v0>%a@]" o#sig_item sg in+ let loc = Ast.loc_of_sig_item sg in+ let () = do_print_all_comments loc (fun c _ -> pp f "%s@ " c)+ (CommentFilter.take_stream comment_filter) in+ pp f "@.";+
end;
value with_outfile output_file fct arg =
The text was updated successfully, but these errors were encountered:
When building documentation, OASIS runs all .mli files through camlp4o,
which messes with comments (camlp4/camlp4#6).
As a result, some API docs are corrupted (comments in wrong places,
comments missing). This patch introduces --enable-uglydocworkaround
configure option which forces API documentation to be rebuild, while
adding '-pp cat' to ocamldoc parameters. This causes multiple
'Warning: -pp overrides the effect of -syntax partly' as OASIS inserts
'-syntax camlp4o' in every ocamldoc call and works probably only by
accident but generates better documentation.
From http://caml.inria.fr/mantis/view.php?id=4713 and http://caml.inria.fr/mantis/view.php?id=4346
Camlp4o messes with comments, hence with ocamldoc generation of documentation.
In order for comments to be used by ocamldoc, they should come immediately before or after a value. Camlp4o moves comments away from values, hence breaks ocamldoc.
Is there any hope that this could be fixed?
Examples :
Old patch with partial fix :
The text was updated successfully, but these errors were encountered: