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
Top-comment. Top-comment.Module
Alerts.Top1
Module
+ Alerts.Top1