summaryrefslogtreecommitdiff
path: root/ocamldoc
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2012-07-26 19:21:54 +0000
committerDamien Doligez <damien.doligez-inria.fr>2012-07-26 19:21:54 +0000
commit0c3a7de5079529bc99cbc9e68806f1a7021d94ef (patch)
tree3b973b6db6313c9bb2993b77c925c0dc8b457f7a /ocamldoc
parent229044d83a940d855fd9590d9aa76596f8c1a8b9 (diff)
downloadocaml-0c3a7de5079529bc99cbc9e68806f1a7021d94ef.tar.gz
merge changes from 4.00 branching to 4.00.0 (part 1)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12784 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'ocamldoc')
-rw-r--r--ocamldoc/.depend287
-rw-r--r--ocamldoc/Makefile17
-rw-r--r--ocamldoc/odoc_analyse.ml2
-rw-r--r--ocamldoc/odoc_args.ml92
-rw-r--r--ocamldoc/odoc_args.mli24
-rw-r--r--ocamldoc/odoc_ast.ml316
-rw-r--r--ocamldoc/odoc_class.ml2
-rw-r--r--ocamldoc/odoc_comments.ml2
-rw-r--r--ocamldoc/odoc_cross.ml31
-rw-r--r--ocamldoc/odoc_gen.ml15
-rw-r--r--ocamldoc/odoc_gen.mli11
-rw-r--r--ocamldoc/odoc_html.ml143
-rw-r--r--ocamldoc/odoc_info.ml8
-rw-r--r--ocamldoc/odoc_info.mli12
-rw-r--r--ocamldoc/odoc_latex.ml41
-rw-r--r--ocamldoc/odoc_man.ml8
-rw-r--r--ocamldoc/odoc_merge.mli2
-rw-r--r--ocamldoc/odoc_messages.ml13
-rw-r--r--ocamldoc/odoc_misc.ml2
-rw-r--r--ocamldoc/odoc_name.ml6
-rw-r--r--ocamldoc/odoc_name.mli3
-rw-r--r--ocamldoc/odoc_scan.ml17
-rw-r--r--ocamldoc/odoc_search.ml71
-rw-r--r--ocamldoc/odoc_search.mli20
-rw-r--r--ocamldoc/odoc_sig.ml95
-rw-r--r--ocamldoc/odoc_sig.mli2
-rw-r--r--ocamldoc/odoc_test.ml13
-rw-r--r--ocamldoc/odoc_text.ml2
-rw-r--r--ocamldoc/odoc_text_lexer.mll39
-rw-r--r--ocamldoc/odoc_text_parser.mly4
-rw-r--r--ocamldoc/odoc_types.ml6
-rw-r--r--ocamldoc/odoc_types.mli6
32 files changed, 885 insertions, 427 deletions
diff --git a/ocamldoc/.depend b/ocamldoc/.depend
index 6467d445b3..f8e0d35704 100644
--- a/ocamldoc/.depend
+++ b/ocamldoc/.depend
@@ -1,12 +1,12 @@
-odoc.cmo: ../typing/typedtree.cmi odoc_messages.cmo odoc_info.cmi \
+odoc.cmo : ../typing/typedtree.cmi odoc_messages.cmo odoc_info.cmi \
odoc_global.cmi odoc_gen.cmi odoc_config.cmi odoc_args.cmi \
odoc_analyse.cmi ../utils/misc.cmi ../utils/config.cmi \
../utils/clflags.cmi
-odoc.cmx: ../typing/typedtree.cmx odoc_messages.cmx odoc_info.cmx \
+odoc.cmx : ../typing/typedtree.cmx odoc_messages.cmx odoc_info.cmx \
odoc_global.cmx odoc_gen.cmx odoc_config.cmx odoc_args.cmx \
odoc_analyse.cmx ../utils/misc.cmx ../utils/config.cmx \
../utils/clflags.cmx
-odoc_analyse.cmo: ../utils/warnings.cmi ../typing/typetexp.cmi \
+odoc_analyse.cmo : ../utils/warnings.cmi ../typing/typetexp.cmi \
../typing/types.cmi ../typing/typemod.cmi ../typing/typedtree.cmi \
../typing/typedecl.cmi ../typing/typecore.cmi ../typing/typeclass.cmi \
../bytecomp/translcore.cmi ../bytecomp/translclass.cmi \
@@ -16,9 +16,9 @@ odoc_analyse.cmo: ../utils/warnings.cmi ../typing/typetexp.cmi \
odoc_cross.cmi odoc_comments.cmi odoc_class.cmo odoc_ast.cmi \
../utils/misc.cmi ../parsing/location.cmi ../parsing/lexer.cmi \
../typing/includemod.cmi ../typing/env.cmi ../typing/ctype.cmi \
- ../utils/config.cmi ../utils/clflags.cmi ../utils/ccomp.cmi \
- odoc_analyse.cmi
-odoc_analyse.cmx: ../utils/warnings.cmx ../typing/typetexp.cmx \
+ ../utils/config.cmi ../typing/cmi_format.cmi ../utils/clflags.cmi \
+ ../utils/ccomp.cmi odoc_analyse.cmi
+odoc_analyse.cmx : ../utils/warnings.cmx ../typing/typetexp.cmx \
../typing/types.cmx ../typing/typemod.cmx ../typing/typedtree.cmx \
../typing/typedecl.cmx ../typing/typecore.cmx ../typing/typeclass.cmx \
../bytecomp/translcore.cmx ../bytecomp/translclass.cmx \
@@ -28,226 +28,229 @@ odoc_analyse.cmx: ../utils/warnings.cmx ../typing/typetexp.cmx \
odoc_cross.cmx odoc_comments.cmx odoc_class.cmx odoc_ast.cmx \
../utils/misc.cmx ../parsing/location.cmx ../parsing/lexer.cmx \
../typing/includemod.cmx ../typing/env.cmx ../typing/ctype.cmx \
- ../utils/config.cmx ../utils/clflags.cmx ../utils/ccomp.cmx \
- odoc_analyse.cmi
-odoc_args.cmo: odoc_types.cmi odoc_texi.cmo odoc_messages.cmo odoc_man.cmo \
+ ../utils/config.cmx ../typing/cmi_format.cmx ../utils/clflags.cmx \
+ ../utils/ccomp.cmx odoc_analyse.cmi
+odoc_args.cmo : odoc_types.cmi odoc_texi.cmo odoc_messages.cmo odoc_man.cmo \
odoc_latex.cmo odoc_html.cmo odoc_global.cmi odoc_gen.cmi odoc_dot.cmo \
odoc_config.cmi ../utils/misc.cmi ../utils/config.cmi odoc_args.cmi
-odoc_args.cmx: odoc_types.cmx odoc_texi.cmx odoc_messages.cmx odoc_man.cmx \
+odoc_args.cmx : odoc_types.cmx odoc_texi.cmx odoc_messages.cmx odoc_man.cmx \
odoc_latex.cmx odoc_html.cmx odoc_global.cmx odoc_gen.cmx odoc_dot.cmx \
odoc_config.cmx ../utils/misc.cmx ../utils/config.cmx odoc_args.cmi
-odoc_ast.cmo: ../typing/types.cmi ../typing/typedtree.cmi \
+odoc_ast.cmo : ../typing/types.cmi ../typing/typedtree.cmi \
../typing/predef.cmi ../typing/path.cmi ../parsing/parsetree.cmi \
odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_sig.cmi \
odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_messages.cmo \
odoc_global.cmi odoc_exception.cmo odoc_env.cmi odoc_class.cmo \
../utils/misc.cmi ../parsing/location.cmi ../typing/ident.cmi \
../parsing/asttypes.cmi odoc_ast.cmi
-odoc_ast.cmx: ../typing/types.cmx ../typing/typedtree.cmx \
+odoc_ast.cmx : ../typing/types.cmx ../typing/typedtree.cmx \
../typing/predef.cmx ../typing/path.cmx ../parsing/parsetree.cmi \
odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_sig.cmx \
odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_messages.cmx \
odoc_global.cmx odoc_exception.cmx odoc_env.cmx odoc_class.cmx \
../utils/misc.cmx ../parsing/location.cmx ../typing/ident.cmx \
../parsing/asttypes.cmi odoc_ast.cmi
-odoc_class.cmo: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
+odoc_class.cmo : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_parameter.cmo odoc_name.cmi
-odoc_class.cmx: ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
+odoc_class.cmx : ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
odoc_parameter.cmx odoc_name.cmx
-odoc_comments.cmo: odoc_types.cmi odoc_text.cmi odoc_see_lexer.cmo \
+odoc_comments.cmo : odoc_types.cmi odoc_text.cmi odoc_see_lexer.cmo \
odoc_parser.cmi odoc_misc.cmi odoc_messages.cmo odoc_merge.cmi \
odoc_lexer.cmo odoc_global.cmi odoc_cross.cmi odoc_comments_global.cmi \
odoc_comments.cmi
-odoc_comments.cmx: odoc_types.cmx odoc_text.cmx odoc_see_lexer.cmx \
+odoc_comments.cmx : odoc_types.cmx odoc_text.cmx odoc_see_lexer.cmx \
odoc_parser.cmx odoc_misc.cmx odoc_messages.cmx odoc_merge.cmx \
odoc_lexer.cmx odoc_global.cmx odoc_cross.cmx odoc_comments_global.cmx \
odoc_comments.cmi
-odoc_comments_global.cmo: odoc_comments_global.cmi
-odoc_comments_global.cmx: odoc_comments_global.cmi
-odoc_config.cmo: ../utils/config.cmi odoc_config.cmi
-odoc_config.cmx: ../utils/config.cmx odoc_config.cmi
-odoc_control.cmo:
-odoc_control.cmx:
-odoc_cross.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_search.cmi \
+odoc_comments_global.cmo : odoc_comments_global.cmi
+odoc_comments_global.cmx : odoc_comments_global.cmi
+odoc_config.cmo : ../utils/config.cmi odoc_config.cmi
+odoc_config.cmx : ../utils/config.cmx odoc_config.cmi
+odoc_control.cmo :
+odoc_control.cmx :
+odoc_cross.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_search.cmi \
odoc_scan.cmo odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
odoc_misc.cmi odoc_messages.cmo odoc_global.cmi odoc_exception.cmo \
odoc_class.cmo odoc_cross.cmi
-odoc_cross.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_search.cmx \
+odoc_cross.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_search.cmx \
odoc_scan.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
odoc_misc.cmx odoc_messages.cmx odoc_global.cmx odoc_exception.cmx \
odoc_class.cmx odoc_cross.cmi
-odoc_dag2html.cmo: odoc_info.cmi odoc_dag2html.cmi
-odoc_dag2html.cmx: odoc_info.cmx odoc_dag2html.cmi
-odoc_dep.cmo: ../parsing/parsetree.cmi odoc_type.cmo odoc_print.cmi \
+odoc_dag2html.cmo : odoc_info.cmi odoc_dag2html.cmi
+odoc_dag2html.cmx : odoc_info.cmx odoc_dag2html.cmi
+odoc_dep.cmo : ../parsing/parsetree.cmi odoc_type.cmo odoc_print.cmi \
odoc_module.cmo ../tools/depend.cmi
-odoc_dep.cmx: ../parsing/parsetree.cmi odoc_type.cmx odoc_print.cmx \
+odoc_dep.cmx : ../parsing/parsetree.cmi odoc_type.cmx odoc_print.cmx \
odoc_module.cmx ../tools/depend.cmx
-odoc_dot.cmo: odoc_messages.cmo odoc_info.cmi
-odoc_dot.cmx: odoc_messages.cmx odoc_info.cmx
-odoc_env.cmo: ../typing/types.cmi ../typing/printtyp.cmi ../typing/predef.cmi \
- ../typing/path.cmi odoc_name.cmi ../typing/btype.cmi odoc_env.cmi
-odoc_env.cmx: ../typing/types.cmx ../typing/printtyp.cmx ../typing/predef.cmx \
- ../typing/path.cmx odoc_name.cmx ../typing/btype.cmx odoc_env.cmi
-odoc_exception.cmo: ../typing/types.cmi odoc_types.cmi odoc_name.cmi
-odoc_exception.cmx: ../typing/types.cmx odoc_types.cmx odoc_name.cmx
-odoc_gen.cmo: odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
+odoc_dot.cmo : odoc_messages.cmo odoc_info.cmi
+odoc_dot.cmx : odoc_messages.cmx odoc_info.cmx
+odoc_env.cmo : ../typing/types.cmi ../typing/printtyp.cmi \
+ ../typing/predef.cmi ../typing/path.cmi odoc_name.cmi ../typing/btype.cmi \
+ odoc_env.cmi
+odoc_env.cmx : ../typing/types.cmx ../typing/printtyp.cmx \
+ ../typing/predef.cmx ../typing/path.cmx odoc_name.cmx ../typing/btype.cmx \
+ odoc_env.cmi
+odoc_exception.cmo : ../typing/types.cmi odoc_types.cmi odoc_name.cmi
+odoc_exception.cmx : ../typing/types.cmx odoc_types.cmx odoc_name.cmx
+odoc_gen.cmo : odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
odoc_html.cmo odoc_dot.cmo odoc_gen.cmi
-odoc_gen.cmx: odoc_texi.cmx odoc_module.cmx odoc_man.cmx odoc_latex.cmx \
+odoc_gen.cmx : odoc_texi.cmx odoc_module.cmx odoc_man.cmx odoc_latex.cmx \
odoc_html.cmx odoc_dot.cmx odoc_gen.cmi
-odoc_global.cmo: odoc_types.cmi odoc_messages.cmo odoc_config.cmi \
+odoc_global.cmo : odoc_types.cmi odoc_messages.cmo odoc_config.cmi \
../utils/clflags.cmi odoc_global.cmi
-odoc_global.cmx: odoc_types.cmx odoc_messages.cmx odoc_config.cmx \
+odoc_global.cmx : odoc_types.cmx odoc_messages.cmx odoc_config.cmx \
../utils/clflags.cmx odoc_global.cmi
-odoc_html.cmo: odoc_text.cmi odoc_ocamlhtml.cmo odoc_messages.cmo \
+odoc_html.cmo : odoc_text.cmi odoc_ocamlhtml.cmo odoc_messages.cmo \
odoc_info.cmi odoc_global.cmi odoc_dag2html.cmi ../parsing/asttypes.cmi
-odoc_html.cmx: odoc_text.cmx odoc_ocamlhtml.cmx odoc_messages.cmx \
+odoc_html.cmx : odoc_text.cmx odoc_ocamlhtml.cmx odoc_messages.cmx \
odoc_info.cmx odoc_global.cmx odoc_dag2html.cmx ../parsing/asttypes.cmi
-odoc_info.cmo: ../typing/printtyp.cmi odoc_value.cmo odoc_types.cmi \
+odoc_info.cmo : ../typing/printtyp.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_text.cmi odoc_str.cmi odoc_search.cmi odoc_scan.cmo \
odoc_print.cmi odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
odoc_misc.cmi odoc_global.cmi odoc_exception.cmo odoc_dep.cmo \
odoc_config.cmi odoc_comments.cmi odoc_class.cmo odoc_analyse.cmi \
- odoc_info.cmi
-odoc_info.cmx: ../typing/printtyp.cmx odoc_value.cmx odoc_types.cmx \
+ ../parsing/location.cmi odoc_info.cmi
+odoc_info.cmx : ../typing/printtyp.cmx odoc_value.cmx odoc_types.cmx \
odoc_type.cmx odoc_text.cmx odoc_str.cmx odoc_search.cmx odoc_scan.cmx \
odoc_print.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
odoc_misc.cmx odoc_global.cmx odoc_exception.cmx odoc_dep.cmx \
odoc_config.cmx odoc_comments.cmx odoc_class.cmx odoc_analyse.cmx \
- odoc_info.cmi
-odoc_inherit.cmo:
-odoc_inherit.cmx:
-odoc_latex.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_latex_style.cmo \
+ ../parsing/location.cmx odoc_info.cmi
+odoc_inherit.cmo :
+odoc_inherit.cmx :
+odoc_latex.cmo : odoc_to_text.cmo odoc_messages.cmo odoc_latex_style.cmo \
odoc_info.cmi ../parsing/asttypes.cmi
-odoc_latex.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_latex_style.cmx \
+odoc_latex.cmx : odoc_to_text.cmx odoc_messages.cmx odoc_latex_style.cmx \
odoc_info.cmx ../parsing/asttypes.cmi
-odoc_latex_style.cmo:
-odoc_latex_style.cmx:
-odoc_lexer.cmo: odoc_parser.cmi odoc_messages.cmo odoc_global.cmi \
+odoc_latex_style.cmo :
+odoc_latex_style.cmx :
+odoc_lexer.cmo : odoc_parser.cmi odoc_messages.cmo odoc_global.cmi \
odoc_comments_global.cmi
-odoc_lexer.cmx: odoc_parser.cmx odoc_messages.cmx odoc_global.cmx \
+odoc_lexer.cmx : odoc_parser.cmx odoc_messages.cmx odoc_global.cmx \
odoc_comments_global.cmx
-odoc_man.cmo: odoc_str.cmi odoc_print.cmi odoc_misc.cmi odoc_messages.cmo \
+odoc_man.cmo : odoc_str.cmi odoc_print.cmi odoc_misc.cmi odoc_messages.cmo \
odoc_info.cmi ../parsing/asttypes.cmi
-odoc_man.cmx: odoc_str.cmx odoc_print.cmx odoc_misc.cmx odoc_messages.cmx \
+odoc_man.cmx : odoc_str.cmx odoc_print.cmx odoc_misc.cmx odoc_messages.cmx \
odoc_info.cmx ../parsing/asttypes.cmi
-odoc_merge.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo \
+odoc_merge.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo \
odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_messages.cmo \
odoc_global.cmi odoc_exception.cmo odoc_class.cmo odoc_merge.cmi
-odoc_merge.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx \
+odoc_merge.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx \
odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_messages.cmx \
odoc_global.cmx odoc_exception.cmx odoc_class.cmx odoc_merge.cmi
-odoc_messages.cmo: ../utils/config.cmi
-odoc_messages.cmx: ../utils/config.cmx
-odoc_misc.cmo: ../typing/types.cmi ../typing/predef.cmi ../typing/path.cmi \
+odoc_messages.cmo : ../utils/config.cmi
+odoc_messages.cmx : ../utils/config.cmx
+odoc_misc.cmo : ../typing/types.cmi ../typing/predef.cmi ../typing/path.cmi \
odoc_types.cmi odoc_messages.cmo ../parsing/longident.cmi \
../typing/ctype.cmi ../typing/btype.cmi odoc_misc.cmi
-odoc_misc.cmx: ../typing/types.cmx ../typing/predef.cmx ../typing/path.cmx \
+odoc_misc.cmx : ../typing/types.cmx ../typing/predef.cmx ../typing/path.cmx \
odoc_types.cmx odoc_messages.cmx ../parsing/longident.cmx \
../typing/ctype.cmx ../typing/btype.cmx odoc_misc.cmi
-odoc_module.cmo: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
+odoc_module.cmo : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_name.cmi odoc_exception.cmo odoc_class.cmo
-odoc_module.cmx: ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
+odoc_module.cmx : ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
odoc_type.cmx odoc_name.cmx odoc_exception.cmx odoc_class.cmx
-odoc_name.cmo: ../typing/path.cmi odoc_misc.cmi ../typing/ident.cmi \
+odoc_name.cmo : ../typing/path.cmi odoc_misc.cmi ../typing/ident.cmi \
odoc_name.cmi
-odoc_name.cmx: ../typing/path.cmx odoc_misc.cmx ../typing/ident.cmx \
+odoc_name.cmx : ../typing/path.cmx odoc_misc.cmx ../typing/ident.cmx \
odoc_name.cmi
-odoc_ocamlhtml.cmo:
-odoc_ocamlhtml.cmx:
-odoc_parameter.cmo: ../typing/types.cmi odoc_types.cmi
-odoc_parameter.cmx: ../typing/types.cmx odoc_types.cmx
-odoc_parser.cmo: odoc_types.cmi odoc_comments_global.cmi odoc_parser.cmi
-odoc_parser.cmx: odoc_types.cmx odoc_comments_global.cmx odoc_parser.cmi
-odoc_print.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_print.cmi
-odoc_print.cmx: ../typing/types.cmx ../typing/printtyp.cmx odoc_print.cmi
-odoc_scan.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_module.cmo \
+odoc_ocamlhtml.cmo :
+odoc_ocamlhtml.cmx :
+odoc_parameter.cmo : ../typing/types.cmi odoc_types.cmi
+odoc_parameter.cmx : ../typing/types.cmx odoc_types.cmx
+odoc_parser.cmo : odoc_types.cmi odoc_comments_global.cmi odoc_parser.cmi
+odoc_parser.cmx : odoc_types.cmx odoc_comments_global.cmx odoc_parser.cmi
+odoc_print.cmo : ../typing/types.cmi ../typing/printtyp.cmi odoc_print.cmi
+odoc_print.cmx : ../typing/types.cmx ../typing/printtyp.cmx odoc_print.cmi
+odoc_scan.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_module.cmo \
odoc_exception.cmo odoc_class.cmo
-odoc_scan.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_module.cmx \
+odoc_scan.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_module.cmx \
odoc_exception.cmx odoc_class.cmx
-odoc_search.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo \
+odoc_search.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo \
odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_exception.cmo \
odoc_class.cmo odoc_search.cmi
-odoc_search.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx \
+odoc_search.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx \
odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_exception.cmx \
odoc_class.cmx odoc_search.cmi
-odoc_see_lexer.cmo: odoc_parser.cmi
-odoc_see_lexer.cmx: odoc_parser.cmx
-odoc_sig.cmo: ../typing/types.cmi ../typing/typedtree.cmi ../typing/path.cmi \
- ../parsing/parsetree.cmi odoc_value.cmo odoc_types.cmi odoc_type.cmo \
- odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_misc.cmi \
- odoc_messages.cmo odoc_merge.cmi odoc_global.cmi odoc_exception.cmo \
- odoc_env.cmi odoc_class.cmo ../utils/misc.cmi ../parsing/location.cmi \
- ../typing/btype.cmi ../parsing/asttypes.cmi odoc_sig.cmi
-odoc_sig.cmx: ../typing/types.cmx ../typing/typedtree.cmx ../typing/path.cmx \
- ../parsing/parsetree.cmi odoc_value.cmx odoc_types.cmx odoc_type.cmx \
- odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_misc.cmx \
- odoc_messages.cmx odoc_merge.cmx odoc_global.cmx odoc_exception.cmx \
- odoc_env.cmx odoc_class.cmx ../utils/misc.cmx ../parsing/location.cmx \
- ../typing/btype.cmx ../parsing/asttypes.cmi odoc_sig.cmi
-odoc_str.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_value.cmo \
+odoc_see_lexer.cmo : odoc_parser.cmi
+odoc_see_lexer.cmx : odoc_parser.cmx
+odoc_sig.cmo : ../typing/types.cmi ../typing/typedtree.cmi \
+ ../typing/path.cmi ../parsing/parsetree.cmi odoc_value.cmo odoc_types.cmi \
+ odoc_type.cmo odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
+ odoc_misc.cmi odoc_messages.cmo odoc_merge.cmi odoc_global.cmi \
+ odoc_exception.cmo odoc_env.cmi odoc_class.cmo ../utils/misc.cmi \
+ ../parsing/location.cmi ../typing/ident.cmi ../typing/btype.cmi \
+ ../parsing/asttypes.cmi odoc_sig.cmi
+odoc_sig.cmx : ../typing/types.cmx ../typing/typedtree.cmx \
+ ../typing/path.cmx ../parsing/parsetree.cmi odoc_value.cmx odoc_types.cmx \
+ odoc_type.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
+ odoc_misc.cmx odoc_messages.cmx odoc_merge.cmx odoc_global.cmx \
+ odoc_exception.cmx odoc_env.cmx odoc_class.cmx ../utils/misc.cmx \
+ ../parsing/location.cmx ../typing/ident.cmx ../typing/btype.cmx \
+ ../parsing/asttypes.cmi odoc_sig.cmi
+odoc_str.cmo : ../typing/types.cmi ../typing/printtyp.cmi odoc_value.cmo \
odoc_type.cmo odoc_print.cmi odoc_name.cmi odoc_misc.cmi \
odoc_messages.cmo odoc_exception.cmo odoc_class.cmo \
../parsing/asttypes.cmi odoc_str.cmi
-odoc_str.cmx: ../typing/types.cmx ../typing/printtyp.cmx odoc_value.cmx \
+odoc_str.cmx : ../typing/types.cmx ../typing/printtyp.cmx odoc_value.cmx \
odoc_type.cmx odoc_print.cmx odoc_name.cmx odoc_misc.cmx \
odoc_messages.cmx odoc_exception.cmx odoc_class.cmx \
../parsing/asttypes.cmi odoc_str.cmi
-odoc_test.cmo: odoc_info.cmi odoc_gen.cmi odoc_args.cmi
-odoc_test.cmx: odoc_info.cmx odoc_gen.cmx odoc_args.cmx
-odoc_texi.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_info.cmi \
- ../parsing/asttypes.cmi
-odoc_texi.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_info.cmx \
- ../parsing/asttypes.cmi
-odoc_text.cmo: odoc_types.cmi odoc_text_parser.cmi odoc_text_lexer.cmo \
+odoc_test.cmo : odoc_info.cmi odoc_gen.cmi odoc_args.cmi
+odoc_test.cmx : odoc_info.cmx odoc_gen.cmx odoc_args.cmx
+odoc_texi.cmo : ../typing/types.cmi odoc_to_text.cmo odoc_messages.cmo \
+ odoc_info.cmi ../parsing/asttypes.cmi
+odoc_texi.cmx : ../typing/types.cmx odoc_to_text.cmx odoc_messages.cmx \
+ odoc_info.cmx ../parsing/asttypes.cmi
+odoc_text.cmo : odoc_types.cmi odoc_text_parser.cmi odoc_text_lexer.cmo \
odoc_text.cmi
-odoc_text.cmx: odoc_types.cmx odoc_text_parser.cmx odoc_text_lexer.cmx \
+odoc_text.cmx : odoc_types.cmx odoc_text_parser.cmx odoc_text_lexer.cmx \
odoc_text.cmi
-odoc_text_lexer.cmo: odoc_text_parser.cmi odoc_misc.cmi
-odoc_text_lexer.cmx: odoc_text_parser.cmx odoc_misc.cmx
-odoc_text_parser.cmo: odoc_types.cmi odoc_misc.cmi odoc_text_parser.cmi
-odoc_text_parser.cmx: odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmi
-odoc_to_text.cmo: odoc_module.cmo odoc_messages.cmo odoc_info.cmi
-odoc_to_text.cmx: odoc_module.cmx odoc_messages.cmx odoc_info.cmx
-odoc_type.cmo: ../typing/types.cmi odoc_types.cmi odoc_name.cmi \
+odoc_text_lexer.cmo : odoc_text_parser.cmi odoc_misc.cmi
+odoc_text_lexer.cmx : odoc_text_parser.cmx odoc_misc.cmx
+odoc_text_parser.cmo : odoc_types.cmi odoc_misc.cmi odoc_text_parser.cmi
+odoc_text_parser.cmx : odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmi
+odoc_to_text.cmo : odoc_module.cmo odoc_messages.cmo odoc_info.cmi
+odoc_to_text.cmx : odoc_module.cmx odoc_messages.cmx odoc_info.cmx
+odoc_type.cmo : ../typing/types.cmi odoc_types.cmi odoc_name.cmi \
../parsing/asttypes.cmi
-odoc_type.cmx: ../typing/types.cmx odoc_types.cmx odoc_name.cmx \
+odoc_type.cmx : ../typing/types.cmx odoc_types.cmx odoc_name.cmx \
../parsing/asttypes.cmi
-odoc_types.cmo: odoc_messages.cmo odoc_types.cmi
-odoc_types.cmx: odoc_messages.cmx odoc_types.cmi
-odoc_value.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_types.cmi \
+odoc_types.cmo : odoc_messages.cmo ../parsing/location.cmi odoc_types.cmi
+odoc_types.cmx : odoc_messages.cmx ../parsing/location.cmx odoc_types.cmi
+odoc_value.cmo : ../typing/types.cmi ../typing/printtyp.cmi odoc_types.cmi \
odoc_parameter.cmo odoc_name.cmi
-odoc_value.cmx: ../typing/types.cmx ../typing/printtyp.cmx odoc_types.cmx \
+odoc_value.cmx : ../typing/types.cmx ../typing/printtyp.cmx odoc_types.cmx \
odoc_parameter.cmx odoc_name.cmx
-t.cmo:
-t.cmx:
-odoc_analyse.cmi: odoc_module.cmo odoc_global.cmi
-odoc_args.cmi: odoc_gen.cmi
-odoc_ast.cmi: ../typing/types.cmi ../typing/typedtree.cmi ../typing/path.cmi \
- ../parsing/parsetree.cmi odoc_sig.cmi odoc_name.cmi odoc_module.cmo
-odoc_comments.cmi: odoc_types.cmi odoc_module.cmo
-odoc_comments_global.cmi:
-odoc_config.cmi:
-odoc_cross.cmi: odoc_types.cmi odoc_module.cmo
-odoc_dag2html.cmi: odoc_info.cmi
-odoc_env.cmi: ../typing/types.cmi odoc_name.cmi
-odoc_gen.cmi: odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
+odoc_analyse.cmi : odoc_module.cmo odoc_global.cmi
+odoc_args.cmi : odoc_gen.cmi
+odoc_ast.cmi : ../typing/types.cmi ../typing/typedtree.cmi \
+ ../typing/path.cmi ../parsing/parsetree.cmi odoc_sig.cmi odoc_name.cmi \
+ odoc_module.cmo
+odoc_comments.cmi : odoc_types.cmi odoc_module.cmo
+odoc_comments_global.cmi :
+odoc_config.cmi :
+odoc_cross.cmi : odoc_types.cmi odoc_module.cmo
+odoc_dag2html.cmi : odoc_info.cmi
+odoc_env.cmi : ../typing/types.cmi odoc_name.cmi
+odoc_gen.cmi : odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
odoc_html.cmo odoc_dot.cmo
-odoc_global.cmi: odoc_types.cmi
-odoc_info.cmi: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
+odoc_global.cmi : odoc_types.cmi
+odoc_info.cmi : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_search.cmi odoc_parameter.cmo odoc_module.cmo \
- odoc_global.cmi odoc_exception.cmo odoc_class.cmo
-odoc_merge.cmi: odoc_types.cmi odoc_module.cmo
-odoc_misc.cmi: ../typing/types.cmi odoc_types.cmi ../parsing/longident.cmi
-odoc_name.cmi: ../typing/path.cmi ../parsing/longident.cmi \
+ odoc_global.cmi odoc_exception.cmo odoc_class.cmo ../parsing/location.cmi
+odoc_merge.cmi : odoc_types.cmi odoc_module.cmo
+odoc_misc.cmi : ../typing/types.cmi odoc_types.cmi ../parsing/longident.cmi
+odoc_name.cmi : ../typing/path.cmi ../parsing/longident.cmi \
../typing/ident.cmi
-odoc_parser.cmi: odoc_types.cmi
-odoc_print.cmi: ../typing/types.cmi
-odoc_search.cmi: odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_module.cmo \
- odoc_exception.cmo odoc_class.cmo
-odoc_sig.cmi: ../typing/types.cmi ../parsing/parsetree.cmi odoc_types.cmi \
+odoc_parser.cmi : odoc_types.cmi
+odoc_print.cmi : ../typing/types.cmi
+odoc_search.cmi : odoc_value.cmo odoc_types.cmi odoc_type.cmo \
+ odoc_module.cmo odoc_exception.cmo odoc_class.cmo
+odoc_sig.cmi : ../typing/types.cmi ../parsing/parsetree.cmi odoc_types.cmi \
odoc_type.cmo odoc_name.cmi odoc_module.cmo odoc_env.cmi odoc_class.cmo
-odoc_str.cmi: ../typing/types.cmi odoc_value.cmo odoc_type.cmo \
+odoc_str.cmi : ../typing/types.cmi odoc_value.cmo odoc_type.cmo \
odoc_exception.cmo odoc_class.cmo
-odoc_text.cmi: odoc_types.cmi
-odoc_text_parser.cmi: odoc_types.cmi
-odoc_types.cmi:
+odoc_text.cmi : odoc_types.cmi
+odoc_text_parser.cmi : odoc_types.cmi
+odoc_types.cmi : ../parsing/location.cmi
diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile
index 245f6f873f..c7e85f2ac2 100644
--- a/ocamldoc/Makefile
+++ b/ocamldoc/Makefile
@@ -50,7 +50,9 @@ ODOC_TEST=odoc_test.cmo
GENERATORS_CMOS= \
generators/odoc_todo.cmo \
generators/odoc_literate.cmo
-GENERATORS_CMXS=$(GENERATORS_CMOS:.cmo=.cmxs)
+GENERATORS_CMXS_TMP1=$(GENERATORS_CMOS:.cmo=.cmxs)
+GENERATORS_CMXS_TMP2=$(NATDYNLINK:false=)
+GENERATORS_CMXS=$(GENERATORS_CMXS_TMP2:true=$(GENERATORS_CMXS_TMP1))
# Compilation
@@ -214,12 +216,12 @@ debug:
$(OCAMLDOC): $(EXECMOFILES)
$(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES)
$(OCAMLDOC_OPT): $(EXECMXFILES)
- $(OCAMLOPT) -o $@ unix.cmxa str.cmxa dynlink.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES)
+ $(OCAMLOPT) -o $@ -linkall unix.cmxa str.cmxa dynlink.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES)
$(OCAMLDOC_LIBCMA): $(LIBCMOFILES)
- $(OCAMLC) -a -o $@ $(LINKFLAGS) $(OCAMLCMOFILES) $(LIBCMOFILES)
+ $(OCAMLC) -a -o $@ $(LINKFLAGS) $(OCAMLSRCDIR)/tools/depend.cmo $(LIBCMOFILES)
$(OCAMLDOC_LIBCMXA): $(LIBCMXFILES)
- $(OCAMLOPT) -a -o $@ $(LINKFLAGS) $(OCAMLCMXFILES) $(LIBCMXFILES)
+ $(OCAMLOPT) -a -o $@ $(LINKFLAGS) $(OCAMLSRCDIR)/tools/depend.cmx $(LIBCMXFILES)
manpages: stdlib_man/Pervasives.3o
@@ -309,6 +311,13 @@ test_stdlib: dummy
../otherlibs/unix/unix.mli \
../otherlibs/str/str.mli
+test_stdlib_code: dummy
+ $(MKDIR) $@
+ $(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/stdlib.odoc -keep-code \
+ `ls ../stdlib/*.ml | grep -v Labels` \
+ ../otherlibs/unix/unix.ml \
+ ../otherlibs/str/str.ml
+
test_framed: dummy
$(MKDIR) $@
$(OCAMLDOC_RUN) -g odoc_fhtml.cmo -sort -colorize-code -d $@ $(INCLUDES) odoc*.ml odoc*.mli
diff --git a/ocamldoc/odoc_analyse.ml b/ocamldoc/odoc_analyse.ml
index b1f47c31ac..cc0cf57b2c 100644
--- a/ocamldoc/odoc_analyse.ml
+++ b/ocamldoc/odoc_analyse.ml
@@ -251,7 +251,7 @@ let process_file ppf sourcefile =
[Odoc_module.Element_module_comment txt] ;
Odoc_module.m_loc =
{ Odoc_types.loc_impl = None ;
- Odoc_types.loc_inter = Some (file, 0) } ;
+ Odoc_types.loc_inter = Some (Location.in_file file) } ;
Odoc_module.m_top_deps = [] ;
Odoc_module.m_code = None ;
Odoc_module.m_code_intf = None ;
diff --git a/ocamldoc/odoc_args.ml b/ocamldoc/odoc_args.ml
index fa3cc30337..24cf08b50c 100644
--- a/ocamldoc/odoc_args.ml
+++ b/ocamldoc/odoc_args.ml
@@ -17,6 +17,96 @@ module M = Odoc_messages
let current_generator = ref (None : Odoc_gen.generator option)
+let get_html_generator () =
+ match !current_generator with
+ None -> (module Odoc_html.Generator : Odoc_html.Html_generator)
+ | Some (Odoc_gen.Html m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "html")
+;;
+
+let get_latex_generator () =
+ match !current_generator with
+ None -> (module Odoc_latex.Generator : Odoc_latex.Latex_generator)
+ | Some (Odoc_gen.Latex m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "latex")
+;;
+
+let get_texi_generator () =
+ match !current_generator with
+ None -> (module Odoc_texi.Generator : Odoc_texi.Texi_generator)
+ | Some (Odoc_gen.Texi m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "texi")
+;;
+
+let get_man_generator () =
+ match !current_generator with
+ None -> (module Odoc_man.Generator : Odoc_man.Man_generator)
+ | Some (Odoc_gen.Man m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "man")
+;;
+
+let get_dot_generator () =
+ match !current_generator with
+ None -> (module Odoc_dot.Generator : Odoc_dot.Dot_generator)
+ | Some (Odoc_gen.Dot m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "dot")
+;;
+
+let get_base_generator () =
+ match !current_generator with
+ None -> (module Odoc_gen.Base_generator : Odoc_gen.Base)
+ | Some (Odoc_gen.Base m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "base")
+;;
+
+let extend_html_generator f =
+ let current = get_html_generator () in
+ let module Current = (val current : Odoc_html.Html_generator) in
+ let module F = (val f : Odoc_gen.Html_functor) in
+ let module M = F(Current) in
+ current_generator := Some (Odoc_gen.Html (module M : Odoc_html.Html_generator))
+;;
+
+let extend_latex_generator f =
+ let current = get_latex_generator () in
+ let module Current = (val current : Odoc_latex.Latex_generator) in
+ let module F = (val f : Odoc_gen.Latex_functor) in
+ let module M = F(Current) in
+ current_generator := Some(Odoc_gen.Latex (module M : Odoc_latex.Latex_generator))
+;;
+
+let extend_texi_generator f =
+ let current = get_texi_generator () in
+ let module Current = (val current : Odoc_texi.Texi_generator) in
+ let module F = (val f : Odoc_gen.Texi_functor) in
+ let module M = F(Current) in
+ current_generator := Some(Odoc_gen.Texi (module M : Odoc_texi.Texi_generator))
+;;
+
+let extend_man_generator f =
+ let current = get_man_generator () in
+ let module Current = (val current : Odoc_man.Man_generator) in
+ let module F = (val f : Odoc_gen.Man_functor) in
+ let module M = F(Current) in
+ current_generator := Some(Odoc_gen.Man (module M : Odoc_man.Man_generator))
+;;
+
+let extend_dot_generator f =
+ let current = get_dot_generator () in
+ let module Current = (val current : Odoc_dot.Dot_generator) in
+ let module F = (val f : Odoc_gen.Dot_functor) in
+ let module M = F(Current) in
+ current_generator := Some (Odoc_gen.Dot (module M : Odoc_dot.Dot_generator))
+;;
+
+let extend_base_generator f =
+ let current = get_base_generator () in
+ let module Current = (val current : Odoc_gen.Base) in
+ let module F = (val f : Odoc_gen.Base_functor) in
+ let module M = F(Current) in
+ current_generator := Some (Odoc_gen.Base (module M : Odoc_gen.Base))
+;;
+
(** Analysis of a string defining options. Return the list of
options according to the list giving associations between
[(character, _)] and a list of options. *)
@@ -226,7 +316,7 @@ let help_action () =
let msg =
Arg.usage_string
(!options @ !help_options)
- (M.usage ^ M.options_are) in
+ (M.usage ^ M.options_are) in
print_string msg
let () =
help_options := [
diff --git a/ocamldoc/odoc_args.mli b/ocamldoc/odoc_args.mli
index 2f190ef756..1d55de7477 100644
--- a/ocamldoc/odoc_args.mli
+++ b/ocamldoc/odoc_args.mli
@@ -19,6 +19,30 @@ val current_generator : Odoc_gen.generator option ref
(** To set the documentation generator. *)
val set_generator : Odoc_gen.generator -> unit
+(** Extend current HTML generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_html_generator : (module Odoc_gen.Html_functor) -> unit
+
+(** Extend current LaTeX generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_latex_generator : (module Odoc_gen.Latex_functor) -> unit
+
+(** Extend current Texi generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_texi_generator : (module Odoc_gen.Texi_functor) -> unit
+
+(** Extend current man generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_man_generator : (module Odoc_gen.Man_functor) -> unit
+
+(** Extend current dot generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_dot_generator : (module Odoc_gen.Dot_functor) -> unit
+
+(** Extend current base generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_base_generator : (module Odoc_gen.Base_functor) -> unit
+
(** Add an option specification. *)
val add_option : string * Arg.spec * string -> unit
diff --git a/ocamldoc/odoc_ast.ml b/ocamldoc/odoc_ast.ml
index 26f813cad3..74fbb50f11 100644
--- a/ocamldoc/odoc_ast.ml
+++ b/ocamldoc/odoc_ast.ml
@@ -358,6 +358,13 @@ module Analyser =
let name_pre = Name.from_ident ident in
let name = Name.parens_if_infix name_pre in
let complete_name = Name.concat current_module_name name in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
(* create the value *)
let new_value = {
val_name = complete_name ;
@@ -365,8 +372,8 @@ module Analyser =
val_type = Odoc_env.subst_type env pat.Typedtree.pat_type ;
val_recursive = rec_flag = Asttypes.Recursive ;
val_parameters = tt_analyse_function_parameters env comment_opt pat_exp_list2 ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
[ new_value ]
@@ -376,14 +383,21 @@ module Analyser =
let name_pre = Name.from_ident ident in
let name = Name.parens_if_infix name_pre in
let complete_name = Name.concat current_module_name name in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
let new_value = {
val_name = complete_name ;
val_info = comment_opt ;
val_type = Odoc_env.subst_type env pat.Typedtree.pat_type ;
val_recursive = rec_flag = Asttypes.Recursive ;
val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
[ new_value ]
@@ -438,7 +452,7 @@ module Analyser =
| l ->
match l with
[] ->
- (* cas impossible, on l'a filtré avant *)
+ (* cas impossible, on l'a filtré avant *)
assert false
| (pattern_param, exp) :: second_ele :: q ->
(* implicit pattern matching -> anonymous parameter *)
@@ -553,27 +567,34 @@ module Analyser =
try
if virt then
Typedtree_search.search_virtual_attribute_type table
- (Name.simple current_class_name) label
+ (Name.simple current_class_name) label
else
Typedtree_search.search_attribute_type tt_cls label
with Not_found ->
raise (Failure (Odoc_messages.attribute_not_found_in_typedtree complete_name))
- in
- let att =
- {
- att_value = { val_name = complete_name ;
- val_info = info_opt ;
- val_type = Odoc_env.subst_type env type_exp ;
- val_recursive = false ;
- val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- } ;
- att_mutable = mutable_flag = Asttypes.Mutable ;
- att_virtual = virt ;
- }
- in
- iter acc_inher (acc_fields @ ele_comments @ [ Class_attribute att ]) loc.Location.loc_end.Lexing.pos_cnum q
+ in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let att =
+ {
+ att_value = { val_name = complete_name ;
+ val_info = info_opt ;
+ val_type = Odoc_env.subst_type env type_exp ;
+ val_recursive = false ;
+ val_parameters = [] ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ } ;
+ att_mutable = mutable_flag = Asttypes.Mutable ;
+ att_virtual = virt ;
+ }
+ in
+ iter acc_inher (acc_fields @ ele_comments @ [ Class_attribute att ]) loc.Location.loc_end.Lexing.pos_cnum q
| (Parsetree.Pcf_virt ({ txt = label }, private_flag, _)) ->
let complete_name = Name.concat current_class_name label in
@@ -584,64 +605,79 @@ module Analyser =
in
let real_type =
match met_type.Types.desc with
- Tarrow (_, _, t, _) ->
- t
- | _ ->
+ Tarrow (_, _, t, _) ->
+ t
+ | _ ->
(* ?!? : not an arrow type ! return the original type *)
- met_type
- in
- let met =
- {
- met_value = { val_name = complete_name ;
- val_info = info_opt ;
- val_type = Odoc_env.subst_type env real_type ;
- val_recursive = false ;
- val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- } ;
- met_private = private_flag = Asttypes.Private ;
- met_virtual = true ;
- }
- in
- (* update the parameter description *)
- Odoc_value.update_value_parameters_text met.met_value;
+ met_type
+ in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let met =
+ {
+ met_value = {
+ val_name = complete_name ;
+ val_info = info_opt ;
+ val_type = Odoc_env.subst_type env real_type ;
+ val_recursive = false ;
+ val_parameters = [] ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ } ;
+ met_private = private_flag = Asttypes.Private ;
+ met_virtual = true ;
+ }
+ in
+ (* update the parameter description *)
+ Odoc_value.update_value_parameters_text met.met_value;
- iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
+ iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
| (Parsetree.Pcf_meth ({ txt = label }, private_flag, _, _)) ->
let complete_name = Name.concat current_class_name label in
let (info_opt, ele_comments) = get_comments_in_class last_pos loc.Location.loc_start.Lexing.pos_cnum in
let exp =
try Typedtree_search.search_method_expression tt_cls label
- with Not_found -> raise (Failure (Odoc_messages.method_not_found_in_typedtree complete_name))
- in
- let real_type =
- match exp.exp_type.desc with
- Tarrow (_, _, t,_) ->
- t
- | _ ->
+ with Not_found -> raise (Failure (Odoc_messages.method_not_found_in_typedtree complete_name))
+ in
+ let real_type =
+ match exp.exp_type.desc with
+ Tarrow (_, _, t,_) ->
+ t
+ | _ ->
(* ?!? : not an arrow type ! return the original type *)
- exp.Typedtree.exp_type
- in
- let met =
- {
- met_value = { val_name = complete_name ;
- val_info = info_opt ;
- val_type = Odoc_env.subst_type env real_type ;
- val_recursive = false ;
- val_parameters = tt_analyse_method_expression env complete_name info_opt exp ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- } ;
- met_private = private_flag = Asttypes.Private ;
- met_virtual = false ;
+ exp.Typedtree.exp_type
+ in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let met =
+ {
+ met_value = { val_name = complete_name ;
+ val_info = info_opt ;
+ val_type = Odoc_env.subst_type env real_type ;
+ val_recursive = false ;
+ val_parameters = tt_analyse_method_expression env complete_name info_opt exp ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ } ;
+ met_private = private_flag = Asttypes.Private ;
+ met_virtual = false ;
}
- in
- (* update the parameter description *)
- Odoc_value.update_value_parameters_text met.met_value;
+ in
+ (* update the parameter description *)
+ Odoc_value.update_value_parameters_text met.met_value;
- iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
+ iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
| Parsetree.Pcf_constr (_, _) ->
(* don't give a $*%@ ! *)
@@ -664,7 +700,7 @@ module Analyser =
(* A VOIR : dommage qu'on n'ait pas un Tclass_ident :-( même quand on a class tutu = toto *)
Name.from_longident lid.txt
in
- (* On n'a pas ici les paramètres de type sous forme de Types.type_expr,
+ (* On n'a pas ici les paramètres de type sous forme de Types.type_expr,
par contre on peut les trouver dans le class_type *)
let params =
match tt_class_exp.Typedtree.cl_type with
@@ -749,7 +785,7 @@ module Analyser =
match tt_class_expr2.Typedtree.cl_desc with
Typedtree.Tcl_ident (p,_,_) -> Name.from_path p (* A VOIR : obtenir le nom complet *)
| _ ->
- (* A VOIR : dommage qu'on n'ait pas un Tclass_ident :-( même quand on a class tutu = toto *)
+ (* A VOIR : dommage qu'on n'ait pas un Tclass_ident :-( même quand on a class tutu = toto *)
match p_class_expr2.Parsetree.pcl_desc with
Parsetree.Pcl_constr (lid, _) ->
(* we try to get the name from the environment. *)
@@ -814,7 +850,8 @@ module Analyser =
let analyse_class env current_module_name comment_opt p_class_decl tt_type_params tt_class_exp table =
let name = p_class_decl.Parsetree.pci_name in
let complete_name = Name.concat current_module_name name.txt in
- let pos_start = p_class_decl.Parsetree.pci_expr.Parsetree.pcl_loc.Location.loc_start.Lexing.pos_cnum in
+ let loc = p_class_decl.Parsetree.pci_expr.Parsetree.pcl_loc in
+ let pos_start = loc.Location.loc_start.Lexing.pos_cnum in
let type_parameters = tt_type_params in
let virt = p_class_decl.Parsetree.pci_virt = Asttypes.Virtual in
let cltype = Odoc_env.subst_class_type env tt_class_exp.Typedtree.cl_type in
@@ -836,7 +873,7 @@ module Analyser =
cl_type_parameters = type_parameters ;
cl_kind = kind ;
cl_parameters = parameters ;
- cl_loc = { loc_impl = Some (!file_name, pos_start) ; loc_inter = None } ;
+ cl_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
cl
@@ -1089,23 +1126,30 @@ module Analyser =
(0, new_env, l_ele)
| Parsetree.Pstr_primitive ({ txt = name_pre }, val_desc) ->
- (* of string * value_description *)
- print_DEBUG ("Parsetree.Pstr_primitive ("^name_pre^", ["^(String.concat ", " val_desc.Parsetree.pval_prim)^"]");
- let typ = Typedtree_search.search_primitive table name_pre in
- let name = Name.parens_if_infix name_pre in
- let complete_name = Name.concat current_module_name name in
- let new_value = {
- val_name = complete_name ;
- val_info = comment_opt ;
- val_type = Odoc_env.subst_type env typ ;
- val_recursive = false ;
- val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- }
- in
- let new_env = Odoc_env.add_value env new_value.val_name in
- (0, new_env, [Element_value new_value])
+ (* of string * value_description *)
+ print_DEBUG ("Parsetree.Pstr_primitive ("^name_pre^", ["^(String.concat ", " val_desc.Parsetree.pval_prim)^"]");
+ let typ = Typedtree_search.search_primitive table name_pre in
+ let name = Name.parens_if_infix name_pre in
+ let complete_name = Name.concat current_module_name name in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let new_value = {
+ val_name = complete_name ;
+ val_info = comment_opt ;
+ val_type = Odoc_env.subst_type env typ ;
+ val_recursive = false ;
+ val_parameters = [] ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ }
+ in
+ let new_env = Odoc_env.add_value env new_value.val_name in
+ (0, new_env, [Element_value new_value])
| Parsetree.Pstr_type name_typedecl_list ->
(* of (string * type_declaration) list *)
@@ -1124,14 +1168,15 @@ module Analyser =
[] -> (maybe_more_acc, [])
| ({ txt = name }, type_decl) :: q ->
let complete_name = Name.concat current_module_name name in
- let loc_start = type_decl.Parsetree.ptype_loc.Location.loc_start.Lexing.pos_cnum in
- let loc_end = type_decl.Parsetree.ptype_loc.Location.loc_end.Lexing.pos_cnum in
+ let loc = type_decl.Parsetree.ptype_loc in
+ let loc_start = loc.Location.loc_start.Lexing.pos_cnum in
+ let loc_end = loc.Location.loc_end.Lexing.pos_cnum in
let pos_limit2 =
match q with
- [] -> pos_limit
- | (_, td) :: _ -> td.Parsetree.ptype_loc.Location.loc_start.Lexing.pos_cnum
- in
- let (maybe_more, name_comment_list) =
+ [] -> pos_limit
+ | (_, td) :: _ -> td.Parsetree.ptype_loc.Location.loc_start.Lexing.pos_cnum
+ in
+ let (maybe_more, name_comment_list) =
Sig.name_comment_from_type_kind
loc_end
pos_limit2
@@ -1151,47 +1196,47 @@ module Analyser =
let kind = Sig.get_type_kind
new_env name_comment_list
tt_type_decl.Types.type_kind
- in
- let new_end = loc_end + maybe_more in
- let t =
- {
- ty_name = complete_name ;
- ty_info = com_opt ;
- ty_parameters =
+ in
+ let new_end = loc_end + maybe_more in
+ let t =
+ {
+ ty_name = complete_name ;
+ ty_info = com_opt ;
+ ty_parameters =
List.map2
- (fun p (co,cn,_) ->
- (Odoc_env.subst_type new_env p,
- co, cn)
- )
+ (fun p (co,cn,_) ->
+ (Odoc_env.subst_type new_env p,
+ co, cn)
+ )
tt_type_decl.Types.type_params
tt_type_decl.Types.type_variance ;
- ty_kind = kind ;
- ty_private = tt_type_decl.Types.type_private;
- ty_manifest =
- (match tt_type_decl.Types.type_manifest with
- None -> None
- | Some t -> Some (Odoc_env.subst_type new_env t));
- ty_loc = { loc_impl = Some (!file_name, loc_start) ; loc_inter = None } ;
- ty_code =
+ ty_kind = kind ;
+ ty_private = tt_type_decl.Types.type_private;
+ ty_manifest =
+ (match tt_type_decl.Types.type_manifest with
+ None -> None
+ | Some t -> Some (Odoc_env.subst_type new_env t));
+ ty_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ ty_code =
(
if !Odoc_global.keep_code then
Some (get_string_of_file loc_start new_end)
else
None
) ;
- }
- in
- let (maybe_more2, info_after_opt) =
- My_ir.just_after_special
+ }
+ in
+ let (maybe_more2, info_after_opt) =
+ My_ir.just_after_special
!file_name
(get_string_of_file new_end pos_limit2)
- in
- t.ty_info <- Sig.merge_infos t.ty_info info_after_opt ;
- let (maybe_more3, eles) = f (maybe_more + maybe_more2) (new_end + maybe_more2) q in
- (maybe_more3, ele_comments @ ((Element_type t) :: eles))
- in
- let (maybe_more, eles) = f ~first: true 0 loc.Location.loc_start.Lexing.pos_cnum name_typedecl_list in
- (maybe_more, new_env, eles)
+ in
+ t.ty_info <- Sig.merge_infos t.ty_info info_after_opt ;
+ let (maybe_more3, eles) = f (maybe_more + maybe_more2) (new_end + maybe_more2) q in
+ (maybe_more3, ele_comments @ ((Element_type t) :: eles))
+ in
+ let (maybe_more, eles) = f ~first: true 0 loc.Location.loc_start.Lexing.pos_cnum name_typedecl_list in
+ (maybe_more, new_env, eles)
| Parsetree.Pstr_exception (name, excep_decl) ->
(* a new exception is defined *)
@@ -1213,7 +1258,7 @@ module Analyser =
Odoc_env.subst_type new_env ctyp.ctyp_type)
tt_excep_decl.exn_params ;
ex_alias = None ;
- ex_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ ex_loc = { loc_impl = Some loc ; loc_inter = None } ;
ex_code =
(
if !Odoc_global.keep_code then
@@ -1242,7 +1287,7 @@ module Analyser =
ex_args = [] ;
ex_alias = Some { ea_name = (Odoc_env.full_exception_name env (Name.from_path tt_path)) ;
ea_ex = None ; } ;
- ex_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ ex_loc = { loc_impl = Some loc ; loc_inter = None } ;
ex_code = None ;
}
in
@@ -1369,7 +1414,7 @@ module Analyser =
mt_is_interface = false ;
mt_file = !file_name ;
mt_kind = Some kind ;
- mt_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ mt_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
let new_env = Odoc_env.add_module_type env mt.mt_name in
@@ -1485,7 +1530,7 @@ module Analyser =
clt_type_parameters = List.map (Odoc_env.subst_type new_env) type_params ;
clt_virtual = virt ;
clt_kind = kind ;
- clt_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ;
+ clt_loc = { loc_impl = Some loc ;
loc_inter = None } ;
}
in
@@ -1504,13 +1549,14 @@ module Analyser =
im_info = comment_opt ;
}
in
- (0, env, [ Element_included_module im ]) (* A VOIR : étendre l'environnement ? avec quoi ? *)
+ (0, env, [ Element_included_module im ]) (* A VOIR : étendre l'environnement ? avec quoi ? *)
(** Analysis of a [Parsetree.module_expr] and a name to return a [t_module].*)
and analyse_module env current_module_name module_name comment_opt p_module_expr tt_module_expr =
let complete_name = Name.concat current_module_name module_name in
- let pos_start = p_module_expr.Parsetree.pmod_loc.Location.loc_start.Lexing.pos_cnum in
- let pos_end = p_module_expr.Parsetree.pmod_loc.Location.loc_end.Lexing.pos_cnum in
+ let loc = p_module_expr.Parsetree.pmod_loc in
+ let pos_start = loc.Location.loc_start.Lexing.pos_cnum in
+ let pos_end = loc.Location.loc_end.Lexing.pos_cnum in
let modtype =
(* A VOIR : Odoc_env.subst_module_type env ? *)
tt_module_expr.Typedtree.mod_type
@@ -1532,7 +1578,7 @@ module Analyser =
m_is_interface = false ;
m_file = !file_name ;
m_kind = Module_struct [] ;
- m_loc = { loc_impl = Some (!file_name, pos_start) ; loc_inter = None } ;
+ m_loc = { loc_impl = Some loc ; loc_inter = None } ;
m_top_deps = [] ;
m_code = None ; (* code is set by the caller, after the module is created *)
m_code_intf = m_code_intf ;
@@ -1732,7 +1778,7 @@ module Analyser =
m_is_interface = false ;
m_file = !file_name ;
m_kind = kind ;
- m_loc = { loc_impl = Some (!file_name, 0) ; loc_inter = None } ;
+ m_loc = { loc_impl = Some (Location.in_file !file_name) ; loc_inter = None } ;
m_top_deps = [] ;
m_code = (if !Odoc_global.keep_code then Some !file else None) ;
m_code_intf = None ;
diff --git a/ocamldoc/odoc_class.ml b/ocamldoc/odoc_class.ml
index 676d0ebc37..28abf67031 100644
--- a/ocamldoc/odoc_class.ml
+++ b/ocamldoc/odoc_class.ml
@@ -115,7 +115,7 @@ let rec class_elements ?(trans=true) cl =
| Class_constraint (c_kind, ct_kind) ->
iter_kind c_kind
(* A VOIR : utiliser le c_kind ou le ct_kind ?
- Pour l'instant, comme le ct_kind n'est pas analysé,
+ Pour l'instant, comme le ct_kind n'est pas analysé,
on cherche dans le c_kind
class_type_elements ~trans: trans
{ clt_name = "" ; clt_info = None ;
diff --git a/ocamldoc/odoc_comments.ml b/ocamldoc/odoc_comments.ml
index ea5427e077..af524eefaf 100644
--- a/ocamldoc/odoc_comments.ml
+++ b/ocamldoc/odoc_comments.ml
@@ -38,7 +38,7 @@ module Info_retriever =
| Odoc_text.Text_syntax (l, c, s) ->
raise (Failure (Odoc_messages.text_parse_error l c s))
| _ ->
- raise (Failure ("Erreur inconnue lors du parse de see : "^s))
+ raise (Failure ("Unknown error while parsing @see tag: "^s))
let retrieve_info fun_lex file (s : string) =
try
diff --git a/ocamldoc/odoc_cross.ml b/ocamldoc/odoc_cross.ml
index 39965f83b2..cd79790d24 100644
--- a/ocamldoc/odoc_cross.ml
+++ b/ocamldoc/odoc_cross.ml
@@ -58,7 +58,9 @@ module P_alias =
let p_class c _ = (false, false)
let p_class_type ct _ = (false, false)
let p_value v _ = false
- let p_type t _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type t _ = (false, false)
let p_exception e _ = e.ex_alias <> None
let p_attribute a _ = false
let p_method m _ = false
@@ -178,7 +180,7 @@ let kind_name_exists kind =
match kind with
RK_module -> (fun e -> match e with Odoc_search.Res_module _ -> true | _ -> false)
| RK_module_type -> (fun e -> match e with Odoc_search.Res_module_type _ -> true | _ -> false)
- | RK_class -> (fun e -> match e with Odoc_search.Res_class_type _ -> true | _ -> false)
+ | RK_class -> (fun e -> match e with Odoc_search.Res_class _ -> true | _ -> false)
| RK_class_type -> (fun e -> match e with Odoc_search.Res_class_type _ -> true | _ -> false)
| RK_value -> (fun e -> match e with Odoc_search.Res_value _ -> true | _ -> false)
| RK_type -> (fun e -> match e with Odoc_search.Res_type _ -> true | _ -> false)
@@ -186,6 +188,8 @@ let kind_name_exists kind =
| RK_attribute -> (fun e -> match e with Odoc_search.Res_attribute _ -> true | _ -> false)
| RK_method -> (fun e -> match e with Odoc_search.Res_method _ -> true | _ -> false)
| RK_section _ -> assert false
+ | RK_recfield -> (fun e -> match e with Odoc_search.Res_recfield _ -> true | _ -> false)
+ | RK_const -> (fun e -> match e with Odoc_search.Res_const _ -> true | _ -> false)
in
fun name ->
try List.exists pred (get_known_elements name)
@@ -200,6 +204,8 @@ let type_exists = kind_name_exists RK_type
let exception_exists = kind_name_exists RK_exception
let attribute_exists = kind_name_exists RK_attribute
let method_exists = kind_name_exists RK_method
+let recfield_exists = kind_name_exists RK_recfield
+let const_exists = kind_name_exists RK_const
let lookup_module name =
match List.find
@@ -246,8 +252,17 @@ class scan =
inherit Odoc_scan.scanner
method! scan_value v =
add_known_element v.val_name (Odoc_search.Res_value v)
- method! scan_type t =
- add_known_element t.ty_name (Odoc_search.Res_type t)
+ method! scan_type_recfield t f =
+ add_known_element
+ (Printf.sprintf "%s.%s" t.ty_name f.rf_name)
+ (Odoc_search.Res_recfield (t, f))
+ method! scan_type_const t f =
+ add_known_element
+ (Printf.sprintf "%s.%s" t.ty_name f.vc_name)
+ (Odoc_search.Res_const (t, f))
+ method! scan_type_pre t =
+ add_known_element t.ty_name (Odoc_search.Res_type t);
+ true
method! scan_exception e =
add_known_element e.ex_name (Odoc_search.Res_exception e)
method! scan_attribute a =
@@ -620,6 +635,8 @@ let not_found_of_kind kind name =
| RK_attribute -> Odoc_messages.cross_attribute_not_found
| RK_method -> Odoc_messages.cross_method_not_found
| RK_section _ -> Odoc_messages.cross_section_not_found
+ | RK_recfield -> Odoc_messages.cross_recfield_not_found
+ | RK_const -> Odoc_messages.cross_const_not_found
) name
let rec assoc_comments_text_elements parent_name module_list t_ele =
@@ -675,6 +692,10 @@ let rec assoc_comments_text_elements parent_name module_list t_ele =
| Odoc_search.Res_attribute a -> (a.att_value.val_name, RK_attribute)
| Odoc_search.Res_method m -> (m.met_value.val_name, RK_method)
| Odoc_search.Res_section (_ ,t)-> assert false
+ | Odoc_search.Res_recfield (t, f) ->
+ (Printf.sprintf "%s.%s" t.ty_name f.rf_name, RK_recfield)
+ | Odoc_search.Res_const (t, f) ->
+ (Printf.sprintf "%s.%s" t.ty_name f.vc_name, RK_const)
in
add_verified (name, Some kind) ;
(name, Some kind)
@@ -731,6 +752,8 @@ let rec assoc_comments_text_elements parent_name module_list t_ele =
| RK_attribute -> attribute_exists
| RK_method -> method_exists
| RK_section _ -> assert false
+ | RK_recfield -> recfield_exists
+ | RK_const -> const_exists
in
if f name then
(
diff --git a/ocamldoc/odoc_gen.ml b/ocamldoc/odoc_gen.ml
index b77b186d4c..b1909e786d 100644
--- a/ocamldoc/odoc_gen.ml
+++ b/ocamldoc/odoc_gen.ml
@@ -18,13 +18,24 @@ module type Base = sig
class generator : doc_generator
end;;
+module Base_generator : Base = struct
+ class generator : doc_generator = object method generate l = () end
+ end;;
+
+module type Base_functor = functor (G: Base) -> Base
+module type Html_functor = functor (G: Odoc_html.Html_generator) -> Odoc_html.Html_generator
+module type Latex_functor = functor (G: Odoc_latex.Latex_generator) -> Odoc_latex.Latex_generator
+module type Texi_functor = functor (G: Odoc_texi.Texi_generator) -> Odoc_texi.Texi_generator
+module type Man_functor = functor (G: Odoc_man.Man_generator) -> Odoc_man.Man_generator
+module type Dot_functor = functor (G: Odoc_dot.Dot_generator) -> Odoc_dot.Dot_generator
+
type generator =
| Html of (module Odoc_html.Html_generator)
| Latex of (module Odoc_latex.Latex_generator)
| Texi of (module Odoc_texi.Texi_generator)
| Man of (module Odoc_man.Man_generator)
| Dot of (module Odoc_dot.Dot_generator)
- | Other of (module Base)
+ | Base of (module Base)
;;
let get_minimal_generator = function
@@ -43,7 +54,7 @@ let get_minimal_generator = function
| Dot m ->
let module M = (val m : Odoc_dot.Dot_generator) in
(new M.dot :> doc_generator)
-| Other m ->
+| Base m ->
let module M = (val m : Base) in
new M.generator
;;
diff --git a/ocamldoc/odoc_gen.mli b/ocamldoc/odoc_gen.mli
index 4649c9504b..37768c008d 100644
--- a/ocamldoc/odoc_gen.mli
+++ b/ocamldoc/odoc_gen.mli
@@ -20,6 +20,15 @@ module type Base = sig
class generator : doc_generator
end;;
+module Base_generator : Base
+
+module type Base_functor = functor (P: Base) -> Base
+module type Html_functor = functor (G: Odoc_html.Html_generator) -> Odoc_html.Html_generator
+module type Latex_functor = functor (G: Odoc_latex.Latex_generator) -> Odoc_latex.Latex_generator
+module type Texi_functor = functor (G: Odoc_texi.Texi_generator) -> Odoc_texi.Texi_generator
+module type Man_functor = functor (G: Odoc_man.Man_generator) -> Odoc_man.Man_generator
+module type Dot_functor = functor (G: Odoc_dot.Dot_generator) -> Odoc_dot.Dot_generator
+
(** Various ways to create a generator. *)
type generator =
| Html of (module Odoc_html.Html_generator)
@@ -27,7 +36,7 @@ type generator =
| Texi of (module Odoc_texi.Texi_generator)
| Man of (module Odoc_man.Man_generator)
| Dot of (module Odoc_dot.Dot_generator)
- | Other of (module Base)
+ | Base of (module Base)
;;
val get_minimal_generator : generator -> doc_generator
diff --git a/ocamldoc/odoc_html.ml b/ocamldoc/odoc_html.ml
index 369114d74c..e3ce5344a0 100644
--- a/ocamldoc/odoc_html.ml
+++ b/ocamldoc/odoc_html.ml
@@ -37,6 +37,9 @@ module Naming =
(** The prefix for types marks. *)
let mark_type = "TYPE"
+ (** The prefix for types elements (record fields or constructors). *)
+ let mark_type_elt = "TYPEELT"
+
(** The prefix for functions marks. *)
let mark_function = "FUN"
@@ -89,9 +92,25 @@ module Naming =
(** Return the link target for the given type. *)
let type_target t = target mark_type (Name.simple t.ty_name)
+ (** Return the link target for the given variant constructor. *)
+ let const_target t f =
+ let name = Printf.sprintf "%s.%s" (Name.simple t.ty_name) f.vc_name in
+ target mark_type_elt name
+
+ (** Return the link target for the given record field. *)
+ let recfield_target t f = target mark_type_elt
+ (Printf.sprintf "%s.%s" (Name.simple t.ty_name) f.rf_name)
+
(** Return the complete link target for the given type. *)
let complete_type_target t = complete_target mark_type t.ty_name
+ let complete_recfield_target name =
+ let typ = Name.father name in
+ let field = Name.simple name in
+ Printf.sprintf "%s.%s" (complete_target mark_type_elt typ) field
+
+ let complete_const_target = complete_recfield_target
+
(** Return the link target for the given exception. *)
let exception_target e = target mark_exception (Name.simple e.ex_name)
@@ -316,14 +335,10 @@ class virtual text =
in
fun b s ->
if !colorize_code then
- (
- bs b "<pre></pre>";
- self#html_of_code b (remove_useless_newlines s);
- bs b "<pre></pre>"
- )
+ self#html_of_code b (remove_useless_newlines s)
else
(
- bs b "<pre><code class=\"";
+ bs b "<pre class=\"codepre\"><code class=\"";
bs b Odoc_ocamlhtml.code_class;
bs b "\">" ;
bs b (self#escape (remove_useless_newlines s));
@@ -331,7 +346,7 @@ class virtual text =
)
method html_of_Verbatim b s =
- bs b "<pre>";
+ bs b "<pre class=\"verbatim\">";
bs b (self#escape s);
bs b "</pre>"
@@ -440,6 +455,8 @@ class virtual text =
| Odoc_info.RK_method -> (Naming.complete_target Naming.mark_method name, h name)
| Odoc_info.RK_section t -> (Naming.complete_label_target name,
Odoc_info.Italic [Raw (Odoc_info.string_of_text t)])
+ | Odoc_info.RK_recfield -> (Naming.complete_recfield_target name, h name)
+ | Odoc_info.RK_const -> (Naming.complete_const_target name, h name)
in
let text =
match text_opt with
@@ -466,7 +483,7 @@ class virtual text =
bs b "<br>\n<table class=\"indextable\">\n";
List.iter
(fun name ->
- bs b "<tr><td>";
+ bs b "<tr><td class=\"module\">";
(
try
let m =
@@ -490,8 +507,9 @@ class virtual text =
let index_if_not_empty l url m =
match l with
[] -> ()
- | _ -> bp b "<a href=\"%s\">%s</a><br>\n" url m
+ | _ -> bp b "<li><a href=\"%s\">%s</a></li>\n" url m
in
+ bp b "<ul class=\"indexlist\">\n";
index_if_not_empty self#list_types self#index_types Odoc_messages.index_of_types;
index_if_not_empty self#list_exceptions self#index_exceptions Odoc_messages.index_of_exceptions;
index_if_not_empty self#list_values self#index_values Odoc_messages.index_of_values;
@@ -500,7 +518,8 @@ class virtual text =
index_if_not_empty self#list_classes self#index_classes Odoc_messages.index_of_classes;
index_if_not_empty self#list_class_types self#index_class_types Odoc_messages.index_of_class_types;
index_if_not_empty self#list_modules self#index_modules Odoc_messages.index_of_modules;
- index_if_not_empty self#list_module_types self#index_module_types Odoc_messages.index_of_module_types
+ index_if_not_empty self#list_module_types self#index_module_types Odoc_messages.index_of_module_types;
+ bp b "</ul>\n"
method virtual list_types : Odoc_info.Type.t_type list
method virtual index_types : string
@@ -690,7 +709,7 @@ class virtual info =
let module M = Odoc_info in
let dep = info.M.i_deprecated <> None in
bs b "<div class=\"info\">\n";
- if dep then bs b "<font color=\"#CCCCCC\">";
+ if dep then bs b "<span class=\"deprecated\">";
(
match info.M.i_desc with
None -> ()
@@ -701,7 +720,7 @@ class virtual info =
(Odoc_info.first_sentence_of_text d));
bs b "\n"
);
- if dep then bs b "</font>";
+ if dep then bs b "</span>";
bs b "</div>\n"
end
@@ -748,11 +767,7 @@ class html =
(** The default style options. *)
val mutable default_style_options =
- ["a:visited {color : #416DFF; text-decoration : none; }" ;
- "a:link {color : #416DFF; text-decoration : none;}" ;
- "a:hover {color : Red; text-decoration : none; background-color: #5FFF88}" ;
- "a:active {color : Red; text-decoration : underline; }" ;
- ".keyword { font-weight : bold ; color : Red }" ;
+ [ ".keyword { font-weight : bold ; color : Red }" ;
".keywordsign { color : #C04600 }" ;
".superscript { font-size : 4 }" ;
".subscript { font-size : 4 }" ;
@@ -761,9 +776,18 @@ class html =
".type { color : #5C6585 }" ;
".string { color : Maroon }" ;
".warning { color : Red ; font-weight : bold }" ;
- ".info { margin-left : 3em; margin-right : 3em }" ;
+ ".info { margin-left : 3em; margin-right: 3em }" ;
".param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em }" ;
".code { color : #465F91 ; }" ;
+ ".typetable { border-style : hidden }" ;
+ ".paramstable { border-style : hidden ; padding: 5pt 5pt}" ;
+ "tr { background-color : White }" ;
+ "td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;}" ;
+ "div.sig_block {margin-left: 2em}" ;
+ "*:target { background: yellow; }" ;
+
+ "body {font: 13px sans-serif; color: black; text-align: left; padding: 5px; margin: 0}";
+
"h1 { font-size : 20pt ; text-align: center; }" ;
"h2 { font-size : 20pt ; border: 1px solid #000000; "^
@@ -788,7 +812,7 @@ class html =
"h6 { font-size : 20pt ; border: 1px solid #000000; "^
"margin-top: 5px; margin-bottom: 2px;"^
- "text-align: center; background-color: #C0FFFF ; "^
+ "text-align: center; background-color: #90BDFF ; "^
"padding: 2px; }" ;
"div.h7 { font-size : 20pt ; border: 1px solid #000000; "^
@@ -806,17 +830,22 @@ class html =
"text-align: center; background-color: #FFFFFF ; "^
"padding: 2px; }" ;
- ".typetable { border-style : hidden }" ;
- ".indextable { border-style : hidden }" ;
- ".paramstable { border-style : hidden ; padding: 5pt 5pt}" ;
- "body { background-color : White }" ;
- "tr { background-color : White }" ;
- "td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;}" ;
- "pre { margin-bottom: 4px }" ;
+ "a {color: #416DFF; text-decoration: none}";
+ "a:hover {background-color: #ddd; text-decoration: underline}";
+ "pre { margin-bottom: 4px; font-family: monospace; }" ;
+ "pre.verbatim, pre.codepre { }";
- "div.sig_block {margin-left: 2em}" ;
+ ".indextable {border: 1px #ddd solid; border-collapse: collapse}";
+ ".indextable td, .indextable th {border: 1px #ddd solid; min-width: 80px}";
+ ".indextable td.module {background-color: #eee ; padding-left: 2px; padding-right: 2px}";
+ ".indextable td.module a {color: 4E6272; text-decoration: none; display: block; width: 100%}";
+ ".indextable td.module a:hover {text-decoration: underline; background-color: transparent}";
+ ".deprecated {color: #888; font-style: italic}" ;
+
+ ".indextable tr td div.info { margin-left: 2px; margin-right: 2px }" ;
- "*:target { background: yellow; } " ;
+ "ul.indexlist { margin-left: 0; padding-left: 0;}";
+ "ul.indexlist li { list-style-type: none ; margin-left: 0; padding-left: 0; }";
]
(** The style file for all pages. *)
@@ -1052,21 +1081,24 @@ class html =
match pre with
None -> ()
| Some name ->
- bp b "<a href=\"%s\">%s</a>\n"
+ bp b "<a class=\"pre\" href=\"%s\" title=\"%s\">%s</a>\n"
(fst (Naming.html_files name))
+ name
Odoc_messages.previous
);
bs b "&nbsp;";
let father = Name.father name in
let href = if father = "" then self#index else fst (Naming.html_files father) in
- bp b "<a href=\"%s\">%s</a>\n" href Odoc_messages.up;
+ let father_name = if father = "" then "Index" else father in
+ bp b "<a class=\"up\" href=\"%s\" title=\"%s\">%s</a>\n" href father_name Odoc_messages.up;
bs b "&nbsp;";
(
match post with
None -> ()
| Some name ->
- bp b "<a href=\"%s\">%s</a>\n"
+ bp b "<a class=\"post\" href=\"%s\" title=\"%s\">%s</a>\n"
(fst (Naming.html_files name))
+ name
Odoc_messages.next
);
bs b "</div>\n"
@@ -1244,7 +1276,7 @@ class html =
self#html_of_module_kind b father k2;
self#html_of_text b [Code ")"]
| Module_with (k, s) ->
- (* TODO: à modifier quand Module_with sera plus détaillé *)
+ (* TODO: modify when Module_with will be more detailed *)
self#html_of_module_type_kind b father ?modu k;
bs b "<code class=\"type\"> ";
bs b (self#create_fully_qualified_module_idents_links father s);
@@ -1427,7 +1459,7 @@ class html =
(match t.ty_manifest, t.ty_kind with
None, Type_abstract -> "<pre>"
| None, Type_variant _
- | None, Type_record _ -> "<br><code>"
+ | None, Type_record _ -> "<pre><code>"
| Some _, Type_abstract -> "<pre>"
| Some _, Type_variant _
| Some _, Type_record _ -> "<pre>"
@@ -1456,7 +1488,7 @@ class html =
bs b
(
match t.ty_manifest with
- None -> "</code>"
+ None -> "</code></pre>"
| Some _ -> "</pre>"
);
bs b "<table class=\"typetable\">\n";
@@ -1466,7 +1498,9 @@ class html =
bs b (self#keyword "|");
bs b "</code></td>\n<td align=\"left\" valign=\"top\" >\n";
bs b "<code>";
- bs b (self#constructor constr.vc_name);
+ bp b "<span id=\"%s\">%s</span>"
+ (Naming.const_target t constr)
+ (self#constructor constr.vc_name);
(
match constr.vc_args, constr.vc_ret with
[], None -> ()
@@ -1480,7 +1514,7 @@ class html =
bs b (" " ^ (self#keyword ":") ^ " ");
self#html_of_type_expr_list ~par: false b father " * " l;
bs b (" " ^ (self#keyword "->") ^ " ");
- self#html_of_type_expr b father r;
+ self#html_of_type_expr b father r;
);
bs b "</code></td>\n";
(
@@ -1511,7 +1545,7 @@ class html =
bs b
(
match t.ty_manifest with
- None -> "</code>"
+ None -> "</code></pre>"
| Some _ -> "</pre>"
);
bs b "<table class=\"typetable\">\n" ;
@@ -1521,7 +1555,9 @@ class html =
bs b "</td>\n<td align=\"left\" valign=\"top\" >\n";
bs b "<code>";
if r.rf_mutable then bs b (self#keyword "mutable&nbsp;") ;
- bs b (r.rf_name ^ "&nbsp;: ") ;
+ bp b "<span id=\"%s\">%s</span>&nbsp;:"
+ (Naming.recfield_target t r)
+ r.rf_name;
self#html_of_type_expr b father r.rf_type;
bs b ";</code></td>\n";
(
@@ -1834,7 +1870,7 @@ class html =
self#html_of_text b [Code "end"]
| Class_apply capp ->
- (* TODO: afficher le type final à partir du typedtree *)
+ (* TODO: display final type from typedtree *)
self#html_of_text b [Raw "class application not handled yet"]
| Class_constr cco ->
@@ -2085,9 +2121,11 @@ class html =
let b = new_buf () in
bs b "<html>\n";
self#print_header b (self#inner_title title);
- bs b "<body>\n<center><h1>";
+ bs b "<body>\n";
+ self#print_navbar b None None "";
+ bs b "<h1>";
bs b title;
- bs b "</h1></center>\n" ;
+ bs b "</h1>\n" ;
let sorted_elements = List.sort
(fun e1 e2 -> compare (Name.simple (name e1)) (Name.simple (name e2)))
@@ -2120,7 +2158,7 @@ class html =
in
bs b "<table>\n";
List.iter f_group groups ;
- bs b "</table><br>\n" ;
+ bs b "</table>\n" ;
bs b "</body>\n</html>";
Buffer.output_buffer chanout b;
close_out chanout
@@ -2159,11 +2197,11 @@ class html =
(self#inner_title cl.cl_name);
bs b "<body>\n";
self#print_navbar b pre_name post_name cl.cl_name;
- bs b "<center><h1>";
+ bs b "<h1>";
bs b (Odoc_messages.clas^" ");
if cl.cl_virtual then bs b "virtual " ;
bp b "<a href=\"%s\">%s</a>" type_file cl.cl_name;
- bs b "</h1></center>\n<br>\n";
+ bs b "</h1>\n";
self#html_of_class b ~with_link: false cl;
(* parameters *)
self#html_of_described_parameter_list b
@@ -2207,11 +2245,11 @@ class html =
bs b "<body>\n";
self#print_navbar b pre_name post_name clt.clt_name;
- bs b "<center><h1>";
+ bs b "<h1>";
bs b (Odoc_messages.class_type^" ");
if clt.clt_virtual then bs b "virtual ";
bp b "<a href=\"%s\">%s</a>" type_file clt.clt_name;
- bs b "</h1></center>\n<br>\n";
+ bs b "</h1>\n";
self#html_of_class_type b ~with_link: false clt;
(* class inheritance *)
@@ -2252,14 +2290,14 @@ class html =
(self#inner_title mt.mt_name);
bs b "<body>\n";
self#print_navbar b pre_name post_name mt.mt_name;
- bp b "<center><h1>";
+ bp b "<h1>";
bs b (Odoc_messages.module_type^" ");
(
match mt.mt_type with
Some _ -> bp b "<a href=\"%s\">%s</a>" type_file mt.mt_name
| None-> bs b mt.mt_name
);
- bs b "</h1></center>\n<br>\n" ;
+ bs b "</h1>\n" ;
self#html_of_modtype b ~with_link: false mt;
(* parameters for functors *)
@@ -2320,7 +2358,7 @@ class html =
(self#inner_title modu.m_name);
bs b "<body>\n" ;
self#print_navbar b pre_name post_name modu.m_name ;
- bs b "<center><h1>";
+ bs b "<h1>";
if modu.m_text_only then
bs b modu.m_name
else
@@ -2339,7 +2377,7 @@ class html =
| Some _ -> bp b " (<a href=\"%s\">.ml</a>)" code_file
)
);
- bs b "</h1></center>\n<br>\n";
+ bs b "</h1>\n";
if not modu.m_text_only then self#html_of_module b ~with_link: false modu;
@@ -2397,9 +2435,10 @@ class html =
bs b "<html>\n";
self#print_header b self#title;
bs b "<body>\n";
- bs b "<center><h1>";
+
+ bs b "<h1>";
bs b title;
- bs b "</h1></center>\n" ;
+ bs b "</h1>\n" ;
let info = Odoc_info.apply_opt
(Odoc_info.info_of_comment_file module_list)
!Odoc_info.Global.intro_file
diff --git a/ocamldoc/odoc_info.ml b/ocamldoc/odoc_info.ml
index 047fa2b5bb..769aade9ca 100644
--- a/ocamldoc/odoc_info.ml
+++ b/ocamldoc/odoc_info.ml
@@ -24,6 +24,8 @@ type ref_kind = Odoc_types.ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element = Odoc_types.text_element =
| Raw of string
@@ -81,8 +83,8 @@ type info = Odoc_types.info = {
}
type location = Odoc_types.location = {
- loc_impl : (string * int) option ;
- loc_inter : (string * int) option ;
+ loc_impl : Location.t option ;
+ loc_inter : Location.t option ;
}
let dummy_loc = { loc_impl = None ; loc_inter = None }
@@ -293,6 +295,8 @@ module Search =
| Res_attribute of Value.t_attribute
| Res_method of Value.t_method
| Res_section of string * text
+ | Res_recfield of Type.t_type * Type.record_field
+ | Res_const of Type.t_type * Type.variant_constructor
type search_result = result_element list
diff --git a/ocamldoc/odoc_info.mli b/ocamldoc/odoc_info.mli
index 0ab1fa815a..0d755c7f4a 100644
--- a/ocamldoc/odoc_info.mli
+++ b/ocamldoc/odoc_info.mli
@@ -25,6 +25,8 @@ type ref_kind = Odoc_types.ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element = Odoc_types.text_element =
| Raw of string (** Raw text. *)
@@ -98,8 +100,8 @@ type info = Odoc_types.info = {
(** Location of elements in implementation and interface files. *)
type location = Odoc_types.location = {
- loc_impl : (string * int) option ; (** implementation file name and position *)
- loc_inter : (string * int) option ; (** interface file name and position *)
+ loc_impl : Location.t option ; (** implementation location *)
+ loc_inter : Location.t option ; (** interface location *)
}
(** A dummy location. *)
@@ -792,6 +794,8 @@ module Search :
| Res_attribute of Value.t_attribute
| Res_method of Value.t_method
| Res_section of string * text
+ | Res_recfield of Type.t_type * Type.record_field
+ | Res_const of Type.t_type * Type.variant_constructor
(** The type representing a research result.*)
type search_result = result_element list
@@ -836,6 +840,10 @@ module Scan :
(** Scan of 'leaf elements'. *)
method scan_value : Value.t_value -> unit
+
+ method scan_type_pre : Type.t_type -> bool
+ method scan_type_const : Type.t_type -> Type.variant_constructor -> unit
+ method scan_type_recfield : Type.t_type -> Type.record_field -> unit
method scan_type : Type.t_type -> unit
method scan_exception : Exception.t_exception -> unit
method scan_attribute : Value.t_attribute -> unit
diff --git a/ocamldoc/odoc_latex.ml b/ocamldoc/odoc_latex.ml
index df404fc327..f2bff2172a 100644
--- a/ocamldoc/odoc_latex.ml
+++ b/ocamldoc/odoc_latex.ml
@@ -37,6 +37,7 @@ let latex_titles = ref [
let latex_value_prefix = ref Odoc_messages.default_latex_value_prefix
let latex_type_prefix = ref Odoc_messages.default_latex_type_prefix
+let latex_type_elt_prefix = ref Odoc_messages.default_latex_type_elt_prefix
let latex_exception_prefix = ref Odoc_messages.default_latex_exception_prefix
let latex_module_prefix = ref Odoc_messages.default_latex_module_prefix
let latex_module_type_prefix = ref Odoc_messages.default_latex_module_type_prefix
@@ -96,19 +97,19 @@ class text =
"}", "\\\\}";
"\\$", "\\\\$";
"\\^", "{\\\\textasciicircum}";
- "à", "\\\\`a";
- "â", "\\\\^a";
- "é", "\\\\'e";
- "è", "\\\\`e";
- "ê", "\\\\^e";
- "ë", "\\\\\"e";
- "ç", "\\\\c{c}";
- "ô", "\\\\^o";
- "ö", "\\\\\"o";
- "î", "\\\\^i";
- "ï", "\\\\\"i";
- "ù", "\\\\`u";
- "û", "\\\\^u";
+ "à", "\\\\`a";
+ "â", "\\\\^a";
+ "é", "\\\\'e";
+ "è", "\\\\`e";
+ "ê", "\\\\^e";
+ "ë", "\\\\\"e";
+ "ç", "\\\\c{c}";
+ "ô", "\\\\^o";
+ "ö", "\\\\\"o";
+ "î", "\\\\^i";
+ "ï", "\\\\\"i";
+ "ù", "\\\\`u";
+ "û", "\\\\^u";
"%", "\\\\%";
"_", "\\\\_";
"~", "\\\\~{}";
@@ -240,6 +241,12 @@ class text =
(** Make a correct label from a type name. *)
method type_label ?no_ name = !latex_type_prefix^(self#label ?no_ name)
+ (** Make a correct label from a record field. *)
+ method recfield_label ?no_ name = !latex_type_elt_prefix^(self#label ?no_ name)
+
+ (** Make a correct label from a variant constructor. *)
+ method const_label ?no_ name = !latex_type_elt_prefix^(self#label ?no_ name)
+
(** Return latex code for the label of a given label. *)
method make_label label = "\\label{"^label^"}"
@@ -409,6 +416,8 @@ class text =
| Odoc_info.RK_attribute -> self#attribute_label
| Odoc_info.RK_method -> self#method_label
| Odoc_info.RK_section _ -> assert false
+ | Odoc_info.RK_recfield -> self#recfield_label
+ | Odoc_info.RK_const -> self#const_label
in
let text =
match text_opt with
@@ -566,7 +575,7 @@ class latex =
":"
(self#normal_type_list ~par: false mod_name " * " l)
"->"
- (self#normal_type mod_name r)
+ (self#normal_type mod_name r)
);
flush2 ()
in
@@ -694,7 +703,7 @@ class latex =
self#latex_of_module_kind fmt father k2;
self#latex_of_text fmt [Code ")"]
| Module_with (k, s) ->
- (* TODO: à modifier quand Module_with sera plus détaillé *)
+ (* TODO: à modifier quand Module_with sera plus détaillé *)
self#latex_of_module_type_kind fmt father k;
self#latex_of_text fmt
[ Code " ";
@@ -723,7 +732,7 @@ class latex =
self#latex_of_text fmt [Latex "\\end{ocamldocobjectend}\n"]
| Class_apply capp ->
- (* TODO: afficher le type final à partir du typedtree *)
+ (* TODO: afficher le type final à partir du typedtree *)
self#latex_of_text fmt [Raw "class application not handled yet"]
| Class_constr cco ->
diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml
index 037dee02da..dae2ff986a 100644
--- a/ocamldoc/odoc_man.ml
+++ b/ocamldoc/odoc_man.ml
@@ -478,10 +478,10 @@ class man =
bs b "(* ";
self#man_of_text b t;
bs b " *)\n "
- | [], None, Some r ->
+ | [], None, Some r ->
bs b "\n.B : ";
self#man_of_type_expr b father r;
- bs b " "
+ bs b " "
| [], (Some t), Some r ->
bs b "\n.B : ";
self#man_of_type_expr b father r;
@@ -999,6 +999,8 @@ class man =
| Res_attribute a -> Name.simple a.att_value.val_name
| Res_method m -> Name.simple m.met_value.val_name
| Res_section _ -> assert false
+ | Res_recfield (_,f) -> f.rf_name
+ | Res_const (_,f) -> f.vc_name
in
let all_items_pre = Odoc_info.Search.search_by_name module_list (Str.regexp ".*") in
let all_items = List.filter
@@ -1040,6 +1042,8 @@ class man =
| Res_attribute a -> a.att_value.val_name
| Res_method m -> m.met_value.val_name
| Res_section (s,_) -> s
+ | Res_recfield (_,f) -> f.rf_name
+ | Res_const (_,f) -> f.vc_name
)
in
let date = Unix.time () in
diff --git a/ocamldoc/odoc_merge.mli b/ocamldoc/odoc_merge.mli
index 4f580ee899..3133c5e939 100644
--- a/ocamldoc/odoc_merge.mli
+++ b/ocamldoc/odoc_merge.mli
@@ -13,7 +13,7 @@
(** Merge of information from [.ml] and [.mli] for a module.*)
-(** Merging \@before tags. *)
+(** Merging \@before tags. *)
val merge_before_tags :
(string * Odoc_types.text) list -> (string * Odoc_types.text) list
diff --git a/ocamldoc/odoc_messages.ml b/ocamldoc/odoc_messages.ml
index 3e9578744e..2425157580 100644
--- a/ocamldoc/odoc_messages.ml
+++ b/ocamldoc/odoc_messages.ml
@@ -128,6 +128,11 @@ let latex_type_prefix =
"<string>\n\t\tUse <string> as prefix for the LaTeX labels of types.\n"^
"\t\t(default is \""^default_latex_type_prefix^"\")"
+let default_latex_type_elt_prefix = "typeelt:"
+let latex_type_elt_prefix =
+ "<string>\n\t\tUse <string> as prefix for the LaTeX labels of type elements.\n"^
+ "\t\t(default is \""^default_latex_type_elt_prefix^"\")"
+
let default_latex_exception_prefix = "exception:"
let latex_exception_prefix =
"<string>\n\t\tUse <string> as prefix for the LaTeX labels of exceptions.\n"^
@@ -245,7 +250,7 @@ let tag_not_handled tag = "Tag @"^tag^" not handled by this generator"
let bad_tree = "Incorrect tree structure."
let not_a_valid_tag s = s^" is not a valid tag."
let fun_without_param f = "Function "^f^" has no parameter.";;
-let method_without_param f = "Méthode "^f^" has no parameter.";;
+let method_without_param f = "Method "^f^" has no parameter.";;
let anonymous_parameters f = "Function "^f^" has anonymous parameters."
let function_colon f = "Function "^f^": "
let implicit_match_in_parameter = "Parameters contain implicit pattern matching."
@@ -295,11 +300,17 @@ let cross_attribute_not_found n = "Attribute "^n^" not found"
let cross_section_not_found n = "Section "^n^" not found"
let cross_value_not_found n = "Value "^n^" not found"
let cross_type_not_found n = "Type "^n^" not found"
+let cross_recfield_not_found n = Printf.sprintf "Record field %s not found" n
+let cross_const_not_found n = Printf.sprintf "Constructor %s not found" n
let object_end = "object ... end"
let struct_end = "struct ... end"
let sig_end = "sig ... end"
+let current_generator_is_not kind =
+ Printf.sprintf "Current generator is not a %s generator" kind
+;;
+
(** Messages for verbose mode. *)
let analysing f = "Analysing file "^f^"..."
diff --git a/ocamldoc/odoc_misc.ml b/ocamldoc/odoc_misc.ml
index c48c1f6a56..c74b287d6f 100644
--- a/ocamldoc/odoc_misc.ml
+++ b/ocamldoc/odoc_misc.ml
@@ -334,7 +334,7 @@ let rec get_before_dot s =
let len = String.length s in
let n = String.index s '.' in
if n + 1 >= len then
- (* le point est le dernier caractère *)
+ (* le point est le dernier caractère *)
(true, s, "")
else
match s.[n+1] with
diff --git a/ocamldoc/odoc_name.ml b/ocamldoc/odoc_name.ml
index b82cf87458..7d059df40d 100644
--- a/ocamldoc/odoc_name.ml
+++ b/ocamldoc/odoc_name.ml
@@ -215,3 +215,9 @@ let to_path n =
| Some p -> p
let from_longident = Odoc_misc.string_of_longident
+
+module Set = Set.Make (struct
+ type z = t
+ type t = z
+ let compare = String.compare
+end)
diff --git a/ocamldoc/odoc_name.mli b/ocamldoc/odoc_name.mli
index e3b43a7867..9bff7c22ff 100644
--- a/ocamldoc/odoc_name.mli
+++ b/ocamldoc/odoc_name.mli
@@ -67,3 +67,6 @@ val to_path : t -> Path.t
(** Get a name from a [Longident.t].*)
val from_longident : Longident.t -> t
+
+(** Set of Name.t *)
+module Set : Set.S with type elt = t
diff --git a/ocamldoc/odoc_scan.ml b/ocamldoc/odoc_scan.ml
index 29e1ca2724..18a8f117c2 100644
--- a/ocamldoc/odoc_scan.ml
+++ b/ocamldoc/odoc_scan.ml
@@ -28,7 +28,18 @@ class scanner =
(** Scan of 'leaf elements'. *)
method scan_value (v : Odoc_value.t_value) = ()
- method scan_type (t : Odoc_type.t_type) = ()
+
+ method scan_type_pre (t : Odoc_type.t_type) = true
+
+ method scan_type_recfield t (f : Odoc_type.record_field) = ()
+ method scan_type_const t (f : Odoc_type.variant_constructor) = ()
+ method scan_type (t : Odoc_type.t_type) =
+ if self#scan_type_pre t then
+ match t.Odoc_type.ty_kind with
+ Odoc_type.Type_abstract -> ()
+ | Odoc_type.Type_variant l -> List.iter (self#scan_type_const t) l
+ | Odoc_type.Type_record l -> List.iter (self#scan_type_recfield t) l
+
method scan_exception (e : Odoc_exception.t_exception) = ()
method scan_attribute (a : Odoc_value.t_attribute) = ()
method scan_method (m : Odoc_value.t_method) = ()
@@ -45,7 +56,7 @@ class scanner =
method scan_class_pre (c : Odoc_class.t_class) = true
(** This method scan the elements of the given class.
- A VOIR : scan des classes héritées.*)
+ A VOIR : scan des classes héritées.*)
method scan_class_elements c =
List.iter
(fun ele ->
@@ -71,7 +82,7 @@ class scanner =
method scan_class_type_pre (ct : Odoc_class.t_class_type) = true
(** This method scan the elements of the given class type.
- A VOIR : scan des classes héritées.*)
+ A VOIR : scan des classes héritées.*)
method scan_class_type_elements ct =
List.iter
(fun ele ->
diff --git a/ocamldoc/odoc_search.ml b/ocamldoc/odoc_search.ml
index 65d602d3b9..91b1d13c89 100644
--- a/ocamldoc/odoc_search.ml
+++ b/ocamldoc/odoc_search.ml
@@ -32,6 +32,8 @@ type result_element =
| Res_attribute of t_attribute
| Res_method of t_method
| Res_section of string * Odoc_types.text
+ | Res_recfield of t_type * record_field
+ | Res_const of t_type * variant_constructor
type result = result_element list
@@ -43,7 +45,9 @@ module type Predicates =
val p_class : t_class -> t -> bool * bool
val p_class_type : t_class_type -> t -> bool * bool
val p_value : t_value -> t -> bool
- val p_type : t_type -> t -> bool
+ val p_recfield : t_type -> record_field -> t -> bool
+ val p_const : t_type -> variant_constructor -> t -> bool
+ val p_type : t_type -> t -> (bool * bool)
val p_exception : t_exception -> t -> bool
val p_attribute : t_attribute -> t -> bool
val p_method : t_method -> t -> bool
@@ -92,7 +96,26 @@ module Search =
let search_value va v = if P.p_value va v then [Res_value va] else []
- let search_type t v = if P.p_type t v then [Res_type t] else []
+ let search_recfield t f v =
+ if P.p_recfield t f v then [Res_recfield (t,f)] else []
+
+ let search_const t f v =
+ if P.p_const t f v then [Res_const (t,f)] else []
+
+ let search_type t v =
+ let (go_deeper, ok) = P.p_type t v in
+ let l =
+ match go_deeper with
+ false -> []
+ | true ->
+ match t.ty_kind with
+ Type_abstract -> []
+ | Type_record l ->
+ List.flatten (List.map (fun rf -> search_recfield t rf v) l)
+ | Type_variant l ->
+ List.flatten (List.map (fun rf -> search_const t rf v) l)
+ in
+ if ok then (Res_type t) :: l else l
let search_exception e v = if P.p_exception e v then [Res_exception e] else []
@@ -305,7 +328,13 @@ module P_name =
let p_class c r = (true, c.cl_name =~ r)
let p_class_type ct r = (true, ct.clt_name =~ r)
let p_value v r = v.val_name =~ r
- let p_type t r = t.ty_name =~ r
+ let p_recfield t f r =
+ let name = Printf.sprintf "%s.%s" t.ty_name f.rf_name in
+ name =~ r
+ let p_const t f r =
+ let name = Printf.sprintf "%s.%s" t.ty_name f.vc_name in
+ name =~ r
+ let p_type t r = (true, t.ty_name =~ r)
let p_exception e r = e.ex_name =~ r
let p_attribute a r = a.att_value.val_name =~ r
let p_method m r = m.met_value.val_name =~ r
@@ -322,7 +351,9 @@ module P_values =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = true
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -347,7 +378,9 @@ module P_exceptions =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = true
let p_attribute _ _ = false
let p_method _ _ = false
@@ -372,7 +405,9 @@ module P_types =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = true
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, true)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -397,7 +432,9 @@ module P_attributes =
let p_class _ _ = (true, false)
let p_class_type _ _ = (true, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = true
let p_method _ _ = false
@@ -422,7 +459,9 @@ module P_methods =
let p_class _ _ = (true, false)
let p_class_type _ _ = (true, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = true
@@ -447,7 +486,9 @@ module P_classes =
let p_class _ _ = (false, true)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -472,7 +513,9 @@ module P_class_types =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, true)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -497,7 +540,9 @@ module P_modules =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -522,7 +567,9 @@ module P_module_types =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
diff --git a/ocamldoc/odoc_search.mli b/ocamldoc/odoc_search.mli
index d7ace5831a..2f882d5246 100644
--- a/ocamldoc/odoc_search.mli
+++ b/ocamldoc/odoc_search.mli
@@ -25,6 +25,8 @@ type result_element =
| Res_attribute of Odoc_value.t_attribute
| Res_method of Odoc_value.t_method
| Res_section of string * Odoc_types.text
+ | Res_recfield of Odoc_type.t_type * Odoc_type.record_field
+ | Res_const of Odoc_type.t_type * Odoc_type.variant_constructor
(** The type representing a research result.*)
type result = result_element list
@@ -42,7 +44,9 @@ module type Predicates =
val p_class : Odoc_class.t_class -> t -> bool * bool
val p_class_type : Odoc_class.t_class_type -> t -> bool * bool
val p_value : Odoc_value.t_value -> t -> bool
- val p_type : Odoc_type.t_type -> t -> bool
+ val p_recfield : Odoc_type.t_type -> Odoc_type.record_field -> t -> bool
+ val p_const : Odoc_type.t_type -> Odoc_type.variant_constructor -> t -> bool
+ val p_type : Odoc_type.t_type -> t -> (bool * bool)
val p_exception : Odoc_exception.t_exception -> t -> bool
val p_attribute : Odoc_value.t_attribute -> t -> bool
val p_method : Odoc_value.t_method -> t -> bool
@@ -59,6 +63,14 @@ module Search :
(** search in a value *)
val search_value : Odoc_value.t_value -> P.t -> result_element list
+ (** search in a record field *)
+ val search_recfield :
+ Odoc_type.t_type -> Odoc_type.record_field -> P.t -> result_element list
+
+ (** search in a variant constructor *)
+ val search_const :
+ Odoc_type.t_type -> Odoc_type.variant_constructor -> P.t -> result_element list
+
(** search in a type *)
val search_type : Odoc_type.t_type -> P.t -> result_element list
@@ -102,7 +114,9 @@ module P_name :
val p_class : Odoc_class.t_class -> Str.regexp -> bool * bool
val p_class_type : Odoc_class.t_class_type -> Str.regexp -> bool * bool
val p_value : Odoc_value.t_value -> Str.regexp -> bool
- val p_type : Odoc_type.t_type -> Str.regexp -> bool
+ val p_recfield : Odoc_type.t_type -> Odoc_type.record_field -> Str.regexp -> bool
+ val p_const : Odoc_type.t_type -> Odoc_type.variant_constructor -> Str.regexp -> bool
+ val p_type : Odoc_type.t_type -> Str.regexp -> (bool * bool)
val p_exception : Odoc_exception.t_exception -> Str.regexp -> bool
val p_attribute : Odoc_value.t_attribute -> Str.regexp -> bool
val p_method : Odoc_value.t_method -> Str.regexp -> bool
@@ -113,6 +127,8 @@ module Search_by_name :
sig
val search_section : Odoc_types.text -> string -> P_name.t -> result_element list
val search_value : Odoc_value.t_value -> P_name.t -> result_element list
+ val search_recfield : Odoc_type.t_type -> Odoc_type.record_field -> P_name.t -> result_element list
+ val search_const : Odoc_type.t_type -> Odoc_type.variant_constructor -> P_name.t -> result_element list
val search_type : Odoc_type.t_type -> P_name.t -> result_element list
val search_exception :
Odoc_exception.t_exception -> P_name.t -> result_element list
diff --git a/ocamldoc/odoc_sig.ml b/ocamldoc/odoc_sig.ml
index 74de957ed6..ea42ddb7b9 100644
--- a/ocamldoc/odoc_sig.ml
+++ b/ocamldoc/odoc_sig.ml
@@ -257,6 +257,38 @@ module Analyser =
in
Odoc_type.Type_record (List.map f l)
+ let erased_names_of_constraints constraints acc =
+ List.fold_right (fun (longident, constraint_) acc ->
+ match constraint_ with
+ | Parsetree.Pwith_type _ | Parsetree.Pwith_module _ -> acc
+ | Parsetree.Pwith_typesubst _ | Parsetree.Pwith_modsubst _ ->
+ Name.Set.add (Name.from_longident longident.txt) acc)
+ constraints acc
+
+ let filter_out_erased_items_from_signature erased signature =
+ if Name.Set.is_empty erased then signature
+ else List.fold_right (fun sig_item acc ->
+ let take_item psig_desc = { sig_item with Parsetree.psig_desc } :: acc in
+ match sig_item.Parsetree.psig_desc with
+ | Parsetree.Psig_value (_, _)
+ | Parsetree.Psig_exception (_, _)
+ | Parsetree.Psig_open _
+ | Parsetree.Psig_include _
+ | Parsetree.Psig_class _
+ | Parsetree.Psig_class_type _ as tp -> take_item tp
+ | Parsetree.Psig_type types ->
+ (match List.filter (fun (name, _) -> not (Name.Set.mem name.txt erased)) types with
+ | [] -> acc
+ | types -> take_item (Parsetree.Psig_type types))
+ | Parsetree.Psig_module (name, _)
+ | Parsetree.Psig_modtype (name, _) as m ->
+ if Name.Set.mem name.txt erased then acc else take_item m
+ | Parsetree.Psig_recmodule mods ->
+ (match List.filter (fun (name, _) -> not (Name.Set.mem name.txt erased)) mods with
+ | [] -> acc
+ | mods -> take_item (Parsetree.Psig_recmodule mods)))
+ signature []
+
(** Analysis of the elements of a class, from the information in the parsetree and in the class
signature. @return the couple (inherited_class list, elements).*)
let analyse_class_elements env current_class_name last_pos pos_limit
@@ -292,7 +324,7 @@ module Analyser =
val_recursive = false ;
val_parameters = Odoc_value.dummy_parameter_list subst_typ ;
val_code = None ;
- val_loc = { loc_impl = None ; loc_inter = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) };
+ val_loc = { loc_impl = None ; loc_inter = Some loc };
} ;
met_private = private_flag = Asttypes.Private ;
met_virtual = false ;
@@ -352,7 +384,7 @@ module Analyser =
val_recursive = false ;
val_parameters = [] ;
val_code = None ;
- val_loc = { loc_impl = None ; loc_inter = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum)} ;
+ val_loc = { loc_impl = None ; loc_inter = Some loc} ;
} ;
att_mutable = mutable_flag = Asttypes.Mutable ;
att_virtual = virtual_flag = Asttypes.Virtual ;
@@ -466,6 +498,7 @@ module Analyser =
signat
table
current_module_name
+ ele.Parsetree.psig_loc
ele.Parsetree.psig_loc.Location.loc_start.Lexing.pos_cnum
ele.Parsetree.psig_loc.Location.loc_end.Lexing.pos_cnum
(match q with
@@ -488,7 +521,7 @@ module Analyser =
(** Analyse the given signature_item_desc to create the corresponding module element
(with the given attached comment).*)
and analyse_signature_item_desc env signat table current_module_name
- pos_start_ele pos_end_ele pos_limit comment_opt sig_item_desc =
+ sig_item_loc pos_start_ele pos_end_ele pos_limit comment_opt sig_item_desc =
match sig_item_desc with
Parsetree.Psig_value (name_pre, value_desc) ->
let type_expr =
@@ -506,7 +539,7 @@ module Analyser =
val_recursive = false ;
val_parameters = Odoc_value.dummy_parameter_list subst_typ ;
val_code = None ;
- val_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele)}
+ val_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -533,7 +566,7 @@ module Analyser =
ex_info = comment_opt ;
ex_args = List.map (Odoc_env.subst_type env) types_excep_decl.exn_args ;
ex_alias = None ;
- ex_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ ex_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
ex_code =
(
if !Odoc_global.keep_code then
@@ -618,10 +651,7 @@ module Analyser =
(match sig_type_decl.Types.type_manifest with
None -> None
| Some t -> Some (Odoc_env.subst_type new_env t));
- ty_loc =
- { loc_impl = None ;
- loc_inter = Some (!file_name,loc_start) ;
- };
+ ty_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
ty_code =
(
if !Odoc_global.keep_code then
@@ -683,7 +713,7 @@ module Analyser =
m_is_interface = true ;
m_file = !file_name ;
m_kind = module_kind ;
- m_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ m_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
m_top_deps = [] ;
m_code = None ;
m_code_intf = code_intf ;
@@ -734,8 +764,9 @@ module Analyser =
(acc_maybe_more, [])
| (name, modtype) :: q ->
let complete_name = Name.concat current_module_name name.txt in
- let loc_start = modtype.Parsetree.pmty_loc.Location.loc_start.Lexing.pos_cnum in
- let loc_end = modtype.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
+ let loc = modtype.Parsetree.pmty_loc in
+ let loc_start = loc.Location.loc_start.Lexing.pos_cnum in
+ let loc_end = loc.Location.loc_end.Lexing.pos_cnum in
let (assoc_com, ele_comments) =
if first then
(comment_opt, [])
@@ -747,7 +778,7 @@ module Analyser =
let pos_limit2 =
match q with
[] -> pos_limit
- | (_, mty) :: _ -> mty.Parsetree.pmty_loc.Location.loc_start.Lexing.pos_cnum
+ | (_, mty) :: _ -> loc.Location.loc_start.Lexing.pos_cnum
in
(* get the information for the module in the signature *)
let sig_module_type =
@@ -759,7 +790,6 @@ module Analyser =
let module_kind = analyse_module_kind new_env complete_name modtype sig_module_type in
let code_intf =
if !Odoc_global.keep_code then
- let loc = modtype.Parsetree.pmty_loc in
let st = loc.Location.loc_start.Lexing.pos_cnum in
let en = loc.Location.loc_end.Lexing.pos_cnum in
Some (get_string_of_file st en)
@@ -774,7 +804,7 @@ module Analyser =
m_is_interface = true ;
m_file = !file_name ;
m_kind = module_kind ;
- m_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ m_loc = { loc_impl = None ; loc_inter = Some loc } ;
m_top_deps = [] ;
m_code = None ;
m_code_intf = code_intf ;
@@ -822,7 +852,7 @@ module Analyser =
mt_is_interface = true ;
mt_file = !file_name ;
mt_kind = module_type_kind ;
- mt_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ mt_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -863,7 +893,7 @@ module Analyser =
im_info = comment_opt;
}
in
- (0, env, [ Element_included_module im ]) (* A VOIR : étendre l'environnement ? avec quoi ? *)
+ (0, env, [ Element_included_module im ]) (* A VOIR : etendre l'environnement ? avec quoi ? *)
| Parsetree.Psig_class class_description_list ->
(* we start by extending the environment *)
@@ -920,7 +950,7 @@ module Analyser =
cl_virtual = class_desc.Parsetree.pci_virt = Asttypes.Virtual ;
cl_kind = class_kind ;
cl_parameters = parameters ;
- cl_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ cl_loc = { loc_impl = None ; loc_inter = Some class_desc.Parsetree.pci_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -994,7 +1024,7 @@ module Analyser =
clt_type_parameters = sig_cltype_decl.clty_params ;
clt_virtual = ct_decl.Parsetree.pci_virt = Asttypes.Virtual ;
clt_kind = kind ;
- clt_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ clt_loc = { loc_impl = None ; loc_inter = Some ct_decl.Parsetree.pci_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -1015,7 +1045,8 @@ module Analyser =
(maybe_more, new_env, eles)
(** Return a module_type_kind from a Parsetree.module_type and a Types.module_type *)
- and analyse_module_type_kind env current_module_name module_type sig_module_type =
+ and analyse_module_type_kind
+ ?(erased = Name.Set.empty) env current_module_name module_type sig_module_type =
match module_type.Parsetree.pmty_desc with
Parsetree.Pmty_ident longident ->
let name =
@@ -1029,6 +1060,7 @@ module Analyser =
| Parsetree.Pmty_signature ast ->
(
+ let ast = filter_out_erased_items_from_signature erased ast in
(* we must have a signature in the module type *)
match sig_module_type with
Types.Mty_signature signat ->
@@ -1059,7 +1091,7 @@ module Analyser =
mp_kind = mp_kind ;
}
in
- let k = analyse_module_type_kind env
+ let k = analyse_module_type_kind ~erased env
current_module_name
module_type2
body_module_type
@@ -1071,13 +1103,15 @@ module Analyser =
raise (Failure "Parsetree.Pmty_functor _ but not Types.Mty_functor _")
)
- | Parsetree.Pmty_with (module_type2, _) ->
+ | Parsetree.Pmty_with (module_type2, constraints) ->
(* of module_type * (Longident.t * with_constraint) list *)
(
let loc_start = module_type2.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let loc_end = module_type.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let s = get_string_of_file loc_start loc_end in
- let k = analyse_module_type_kind env current_module_name module_type2 sig_module_type in
+ let erased = erased_names_of_constraints constraints erased in
+ let k = analyse_module_type_kind ~erased env current_module_name module_type2 sig_module_type in
+
Module_type_with (k, s)
)
@@ -1088,7 +1122,8 @@ module Analyser =
Module_type_typeof s
(** analyse of a Parsetree.module_type and a Types.module_type.*)
- and analyse_module_kind env current_module_name module_type sig_module_type =
+ and analyse_module_kind
+ ?(erased = Name.Set.empty) env current_module_name module_type sig_module_type =
match module_type.Parsetree.pmty_desc with
Parsetree.Pmty_ident longident ->
let k = analyse_module_type_kind env current_module_name module_type sig_module_type in
@@ -1096,6 +1131,7 @@ module Analyser =
| Parsetree.Pmty_signature signature ->
(
+ let signature = filter_out_erased_items_from_signature erased signature in
match sig_module_type with
Types.Mty_signature signat ->
Module_struct
@@ -1130,7 +1166,7 @@ module Analyser =
mp_kind = mp_kind ;
}
in
- let k = analyse_module_kind env
+ let k = analyse_module_kind ~erased env
current_module_name
module_type2
body_module_type
@@ -1141,13 +1177,14 @@ module Analyser =
(* if we're here something's wrong *)
raise (Failure "Parsetree.Pmty_functor _ but not Types.Mty_functor _")
)
- | Parsetree.Pmty_with (module_type2, _) ->
+ | Parsetree.Pmty_with (module_type2, constraints) ->
(*of module_type * (Longident.t * with_constraint) list*)
(
let loc_start = module_type2.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let loc_end = module_type.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let s = get_string_of_file loc_start loc_end in
- let k = analyse_module_type_kind env current_module_name module_type2 sig_module_type in
+ let erased = erased_names_of_constraints constraints erased in
+ let k = analyse_module_type_kind ~erased env current_module_name module_type2 sig_module_type in
Module_with (k, s)
)
| Parsetree.Pmty_typeof module_expr ->
@@ -1202,7 +1239,7 @@ module Analyser =
)
else
(
- raise (Failure "Parsetree.Pcty_fun (parse_label, _, pclass_type), labels différents")
+ raise (Failure "Parsetree.Pcty_fun (parse_label, _, pclass_type), labels differents")
)
| _ ->
@@ -1304,7 +1341,7 @@ module Analyser =
m_is_interface = true ;
m_file = !file_name ;
m_kind = Module_struct elements ;
- m_loc = { loc_impl = None ; loc_inter = Some (!file_name, 0) } ;
+ m_loc = { loc_impl = None ; loc_inter = Some (Location.in_file !file_name) } ;
m_top_deps = [] ;
m_code = None ;
m_code_intf = code_intf ;
diff --git a/ocamldoc/odoc_sig.mli b/ocamldoc/odoc_sig.mli
index 5717dc1f9c..766994d717 100644
--- a/ocamldoc/odoc_sig.mli
+++ b/ocamldoc/odoc_sig.mli
@@ -156,7 +156,7 @@ module Analyser :
(** Return a module_type_kind from a Parsetree.module_type and a Types.module_type *)
val analyse_module_type_kind :
- Odoc_env.env -> Odoc_name.t ->
+ ?erased:Odoc_name.Set.t -> Odoc_env.env -> Odoc_name.t ->
Parsetree.module_type -> Types.module_type ->
Odoc_module.module_type_kind
diff --git a/ocamldoc/odoc_test.ml b/ocamldoc/odoc_test.ml
index 7b455f45bf..a903b1c151 100644
--- a/ocamldoc/odoc_test.ml
+++ b/ocamldoc/odoc_test.ml
@@ -22,12 +22,13 @@ type test_kind =
let p = Format.fprintf
-module Generator =
+module Generator (G : Odoc_gen.Base) =
struct
-class string_gen =
+ class string_gen =
object(self)
inherit Odoc_info.Scan.scanner
+
val mutable test_kinds = []
val mutable fmt = Format.str_formatter
@@ -111,8 +112,12 @@ class string_gen =
class generator =
let g = new string_gen in
object
- method generate = g#generate
+ inherit G.generator as base
+
+ method generate l =
+ base#generate l;
+ g#generate l
end
end;;
-let _ = Odoc_args.set_generator (Odoc_gen.Other (module Generator : Odoc_gen.Base))
+let _ = Odoc_args.extend_base_generator (module Generator : Odoc_gen.Base_functor);;
diff --git a/ocamldoc/odoc_text.ml b/ocamldoc/odoc_text.ml
index b50a2dbd17..e80b680ed4 100644
--- a/ocamldoc/odoc_text.ml
+++ b/ocamldoc/odoc_text.ml
@@ -133,6 +133,8 @@ module Texter =
| RK_attribute -> "attribute"
| RK_method -> "method"
| RK_section _ -> "section"
+ | RK_recfield -> "recfield"
+ | RK_const -> "const"
in
s^":"
)
diff --git a/ocamldoc/odoc_text_lexer.mll b/ocamldoc/odoc_text_lexer.mll
index 37d8631815..a4888c1a8f 100644
--- a/ocamldoc/odoc_text_lexer.mll
+++ b/ocamldoc/odoc_text_lexer.mll
@@ -22,10 +22,10 @@ let char_number = ref 0
let string_buffer = Buffer.create 32
-(** Fonction de remise à zéro de la chaine de caractères tampon *)
+(** Fonction de remise à zéro de la chaine de caractères tampon *)
let reset_string_buffer () = Buffer.reset string_buffer
-(** Fonction d'ajout d'un caractère dans la chaine de caractères tampon *)
+(** Fonction d'ajout d'un caractère dans la chaine de caractères tampon *)
let ajout_char_string = Buffer.add_char string_buffer
(** Add a string to the buffer. *)
@@ -161,6 +161,8 @@ let begin_clt_ref = "{!classtype:"blank_nl | "{!classtype:"
let begin_att_ref = "{!attribute:"blank_nl | "{!attribute:"
let begin_met_ref = "{!method:"blank_nl | "{!method:"
let begin_sec_ref = "{!section:"blank_nl | "{!section:"
+let begin_recf_ref = "{!recfield:"blank_nl | "{!recfield:"
+let begin_const_ref = "{!const:"blank_nl | "{!const:"
let begin_mod_list_ref = "{!modules:"blank_nl | "{!modules:"
let index_list = "{!indexlist}"
let begin_custom = "{"['a'-'z''A'-'Z']['a'-'z''A'-'Z''0'-'9']*
@@ -664,7 +666,38 @@ rule main = parse
Char (Lexing.lexeme lexbuf)
)
}
-
+| begin_recf_ref
+ {
+ incr_cpts lexbuf ;
+ if !verb_mode or !target_mode or !code_pre_mode or !open_brackets >= 1 then
+ Char (Lexing.lexeme lexbuf)
+ else
+ if not !ele_ref_mode then
+ (
+ ele_ref_mode := true;
+ RECF_REF
+ )
+ else
+ (
+ Char (Lexing.lexeme lexbuf)
+ )
+ }
+| begin_const_ref
+ {
+ incr_cpts lexbuf ;
+ if !verb_mode or !target_mode or !code_pre_mode or !open_brackets >= 1 then
+ Char (Lexing.lexeme lexbuf)
+ else
+ if not !ele_ref_mode then
+ (
+ ele_ref_mode := true;
+ CONST_REF
+ )
+ else
+ (
+ Char (Lexing.lexeme lexbuf)
+ )
+ }
| begin_mod_list_ref
{
incr_cpts lexbuf ;
diff --git a/ocamldoc/odoc_text_parser.mly b/ocamldoc/odoc_text_parser.mly
index 55909141bd..6efc32f54d 100644
--- a/ocamldoc/odoc_text_parser.mly
+++ b/ocamldoc/odoc_text_parser.mly
@@ -62,6 +62,8 @@ let print_DEBUG s = print_string s; print_newline ()
%token ATT_REF
%token MET_REF
%token SEC_REF
+%token RECF_REF
+%token CONST_REF
%token MOD_LIST_REF
%token INDEX_LIST
@@ -121,6 +123,8 @@ ele_ref_kind:
| ATT_REF { Some RK_attribute }
| MET_REF { Some RK_method }
| SEC_REF { Some (RK_section [])}
+| RECF_REF { Some RK_recfield }
+| CONST_REF { Some RK_const }
;
text_element:
diff --git a/ocamldoc/odoc_types.ml b/ocamldoc/odoc_types.ml
index 53a1ca5f9c..d1ae70ef2d 100644
--- a/ocamldoc/odoc_types.ml
+++ b/ocamldoc/odoc_types.ml
@@ -22,6 +22,8 @@ type ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element =
| Raw of string
@@ -91,8 +93,8 @@ let dummy_info = {
}
type location = {
- loc_impl : (string * int) option ;
- loc_inter : (string * int) option ;
+ loc_impl : Location.t option ;
+ loc_inter : Location.t option ;
}
let dummy_loc = { loc_impl = None ; loc_inter = None }
diff --git a/ocamldoc/odoc_types.mli b/ocamldoc/odoc_types.mli
index d4affb5039..f6eca5d96c 100644
--- a/ocamldoc/odoc_types.mli
+++ b/ocamldoc/odoc_types.mli
@@ -25,6 +25,8 @@ type ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element =
| Raw of string (** Raw text. *)
@@ -94,8 +96,8 @@ val dummy_info : info
(** Location of elements in implementation and interface files. *)
type location = {
- loc_impl : (string * int) option ; (** implementation file name and position *)
- loc_inter : (string * int) option ; (** interface file name and position *)
+ loc_impl : Location.t option ; (** implementation location *)
+ loc_inter : Location.t option ; (** interface location *)
}
(** A dummy location. *)