diff --git a/odoc-parser.opam b/odoc-parser.opam index 4d0e0bd305..b167c9a85d 100644 --- a/odoc-parser.opam +++ b/odoc-parser.opam @@ -14,7 +14,7 @@ dev-repo: "git+https://github.com/ocaml/odoc.git" doc: "https://ocaml.github.io/odoc/odoc_parser" depends: [ "dune" {>= "3.7"} - "ocaml" {>= "4.02.0" & < "5.3"} + "ocaml" {>= "4.02.0" & < "5.4"} "astring" "result" "camlp-streams" diff --git a/odoc.opam b/odoc.opam index fc48a13534..531bcd36d1 100644 --- a/odoc.opam +++ b/odoc.opam @@ -45,7 +45,7 @@ depends: [ "cppo" {build & >= "1.1.0"} "dune" {>= "3.7.0"} "fpath" - "ocaml" {>= "4.02.0" & < "5.3"} + "ocaml" {>= "4.02.0" & < "5.4"} "result" "tyxml" {>= "4.4.0"} "fmt" diff --git a/src/syntax_highlighter/syntax_highlighter.ml b/src/syntax_highlighter/syntax_highlighter.ml index 688b85cc62..226b01f59a 100644 --- a/src/syntax_highlighter/syntax_highlighter.ml +++ b/src/syntax_highlighter/syntax_highlighter.ml @@ -153,6 +153,7 @@ let tag_of_token (tok : Parser.token) = #endif let syntax_highlighting_locs src = + Lexer.init (); let lexbuf = Lexing.from_string #if OCAML_VERSION >= (4,8,0) ~with_positions:true diff --git a/test/generators/cases/alerts.mli b/test/generators/cases/alerts.mli index f31fb3a5f7..d8440d65ff 100644 --- a/test/generators/cases/alerts.mli +++ b/test/generators/cases/alerts.mli @@ -17,16 +17,12 @@ val c : int (* At the top-level of a module. *) module Top1 : sig - [@@@deprecated "A"] - - (** Top-comment. *) -end - -module Top2 : sig - [@@@deprecated "A"] + (* On OCaml 4.04 to 4.06, this top-comment is lost by the parser if there's + no empty line before it. *) (** Top-comment. *) end +[@@deprecated "A"] (* Deprecated alert tag. *) diff --git a/test/generators/html/Alerts-Top1.html b/test/generators/html/Alerts-Top1.html index 2cff2248c8..640f5516f6 100644 --- a/test/generators/html/Alerts-Top1.html +++ b/test/generators/html/Alerts-Top1.html @@ -12,10 +12,10 @@ Alerts » Top1
-

Module Alerts.Top1

Top-comment.

+

Module Alerts.Top1

+

Top-comment.

diff --git a/test/generators/html/Alerts-Top2.html b/test/generators/html/Alerts-Top2.html deleted file mode 100644 index bfda574990..0000000000 --- a/test/generators/html/Alerts-Top2.html +++ /dev/null @@ -1,21 +0,0 @@ - - - Top2 (Alerts.Top2) - - - - - - - - -
-

Module Alerts.Top2

Top-comment.

- -
- - diff --git a/test/generators/html/Alerts.html b/test/generators/html/Alerts.html index d334ec9e68..c3fe89e5a2 100644 --- a/test/generators/html/Alerts.html +++ b/test/generators/html/Alerts.html @@ -57,20 +57,7 @@

Module Alerts

end -

Top-comment.

- -
-
- - - module - Top2 - - : sig ... - end - - -

Top-comment.

+
diff --git a/test/generators/html/alerts.targets b/test/generators/html/alerts.targets index 19845fdd8f..aa5d6fce16 100644 --- a/test/generators/html/alerts.targets +++ b/test/generators/html/alerts.targets @@ -1,3 +1,2 @@ Alerts.html Alerts-Top1.html -Alerts-Top2.html diff --git a/test/generators/latex/Alerts.tex b/test/generators/latex/Alerts.tex index 01ef0e0ac9..9630f24d10 100644 --- a/test/generators/latex/Alerts.tex +++ b/test/generators/latex/Alerts.tex @@ -15,11 +15,7 @@ \section{Module \ocamlinlinecode{Alerts}}\label{module-Alerts}% \end{ocamlindent}% \medbreak \label{module-Alerts-module-Top1}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[module-Alerts-module-Top1]{\ocamlinlinecode{Top1}}}\ocamlcodefragment{ : \ocamltag{keyword}{sig}}\begin{ocamlindent}\end{ocamlindent}% -\ocamlcodefragment{\ocamltag{keyword}{end}}\begin{ocamlindent}Top-comment.\end{ocamlindent}% -\medbreak -\label{module-Alerts-module-Top2}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[module-Alerts-module-Top2]{\ocamlinlinecode{Top2}}}\ocamlcodefragment{ : \ocamltag{keyword}{sig}}\begin{ocamlindent}\end{ocamlindent}% -\ocamlcodefragment{\ocamltag{keyword}{end}}\begin{ocamlindent}Top-comment.\end{ocamlindent}% -\medbreak +\ocamlcodefragment{\ocamltag{keyword}{end}}\\ \label{module-Alerts-val-d}\ocamlcodefragment{\ocamltag{keyword}{val} d : int}\begin{ocamlindent}\begin{description}\kern-\topsep \makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded \item[{deprecated}]{A deprecated alert d}\end{description}% diff --git a/test/generators/link.dune.inc b/test/generators/link.dune.inc index bc2679f186..da29c1b71b 100644 --- a/test/generators/link.dune.inc +++ b/test/generators/link.dune.inc @@ -687,7 +687,7 @@ (subdir html (rule - (targets Alerts.html.gen Alerts-Top1.html.gen Alerts-Top2.html.gen) + (targets Alerts.html.gen Alerts-Top1.html.gen) (action (run odoc @@ -711,12 +711,6 @@ (alias runtest) (action (diff Alerts-Top1.html Alerts-Top1.html.gen)) - (enabled_if - (>= %{ocaml_version} 4.04))) - (rule - (alias runtest) - (action - (diff Alerts-Top2.html Alerts-Top2.html.gen)) (enabled_if (>= %{ocaml_version} 4.04)))) @@ -770,7 +764,7 @@ (subdir man (rule - (targets Alerts.3o.gen Alerts.Top1.3o.gen Alerts.Top2.3o.gen) + (targets Alerts.3o.gen Alerts.Top1.3o.gen) (action (run odoc man-generate -o . --extra-suffix gen %{dep:../alerts.odocl})) (enabled_if @@ -785,12 +779,6 @@ (alias runtest) (action (diff Alerts.Top1.3o Alerts.Top1.3o.gen)) - (enabled_if - (>= %{ocaml_version} 4.04))) - (rule - (alias runtest) - (action - (diff Alerts.Top2.3o Alerts.Top2.3o.gen)) (enabled_if (>= %{ocaml_version} 4.04)))) diff --git a/test/generators/man/Alerts.3o b/test/generators/man/Alerts.3o index b8ad7e91fb..ce2269be52 100644 --- a/test/generators/man/Alerts.3o +++ b/test/generators/man/Alerts.3o @@ -33,18 +33,6 @@ Alerts .nf .sp \f[CB]module\fR Top1 : \f[CB]sig\fR \.\.\. \f[CB]end\fR -.fi -.br -.ti +2 -Top-comment\. -.nf -.sp -\f[CB]module\fR Top2 : \f[CB]sig\fR \.\.\. \f[CB]end\fR -.fi -.br -.ti +2 -Top-comment\. -.nf .sp \f[CB]val\fR d : int .fi diff --git a/test/generators/man/Alerts.Top1.3o b/test/generators/man/Alerts.Top1.3o index e442410435..8e77f79e7b 100644 --- a/test/generators/man/Alerts.Top1.3o +++ b/test/generators/man/Alerts.Top1.3o @@ -9,11 +9,11 @@ Alerts\.Top1 .in .sp .fi -Top-comment\. +@deprecated: A .nf .sp .fi -@deprecated: A +Top-comment\. .nf .SH Documentation .sp diff --git a/test/generators/man/Alerts.Top2.3o b/test/generators/man/Alerts.Top2.3o deleted file mode 100644 index cb1c8bbea1..0000000000 --- a/test/generators/man/Alerts.Top2.3o +++ /dev/null @@ -1,21 +0,0 @@ - -.TH Top2 3 "" "Odoc" "OCaml Library" -.SH Name -Alerts\.Top2 -.SH Synopsis -.sp -.in 2 -\fBModule Alerts\.Top2\fR -.in -.sp -.fi -Top-comment\. -.nf -.sp -.fi -@deprecated: A -.nf -.SH Documentation -.sp -.nf - diff --git a/test/generators/man/alerts.targets b/test/generators/man/alerts.targets index 435b06703e..6075b4901d 100644 --- a/test/generators/man/alerts.targets +++ b/test/generators/man/alerts.targets @@ -1,3 +1,2 @@ Alerts.3o Alerts.Top1.3o -Alerts.Top2.3o