Skip to content

Commit 23747f8

Browse files
authored
Merge pull request #1254 from Julow/compat-5.3
Compatibility with OCaml 5.3
2 parents 822d266 + 9545bff commit 23747f8

File tree

14 files changed

+15
-103
lines changed

14 files changed

+15
-103
lines changed

odoc-parser.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dev-repo: "git+https://github.com/ocaml/odoc.git"
1414
doc: "https://ocaml.github.io/odoc/odoc_parser"
1515
depends: [
1616
"dune" {>= "3.7"}
17-
"ocaml" {>= "4.02.0" & < "5.3"}
17+
"ocaml" {>= "4.02.0" & < "5.4"}
1818
"astring"
1919
"result"
2020
"camlp-streams"

odoc.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ depends: [
4545
"cppo" {build & >= "1.1.0"}
4646
"dune" {>= "3.7.0"}
4747
"fpath"
48-
"ocaml" {>= "4.02.0" & < "5.3"}
48+
"ocaml" {>= "4.02.0" & < "5.4"}
4949
"result"
5050
"tyxml" {>= "4.4.0"}
5151
"fmt"

src/syntax_highlighter/syntax_highlighter.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ let tag_of_token (tok : Parser.token) =
154154

155155
let syntax_highlighting_locs src =
156156
try
157+
Lexer.init ();
157158
let lexbuf = Lexing.from_string
158159
#if OCAML_VERSION >= (4,8,0)
159160
~with_positions:true
@@ -175,4 +176,4 @@ let syntax_highlighting_locs src =
175176
collect lexbuf
176177
with e ->
177178
Format.eprintf "Error during syntax highlighting: %s\n%!" (Printexc.to_string e);
178-
[]
179+
[]

test/generators/cases/alerts.mli

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ val c : int
1717
(* At the top-level of a module. *)
1818

1919
module Top1 : sig
20-
[@@@deprecated "A"]
21-
22-
(** Top-comment. *)
23-
end
24-
25-
module Top2 : sig
26-
[@@@deprecated "A"]
2720

21+
(* On OCaml 4.04 to 4.06, this top-comment is lost by the parser if there's
22+
no empty line before it. *)
2823
(** Top-comment. *)
2924
end
25+
[@@deprecated "A"]
3026

3127
(* Deprecated alert tag. *)
3228

test/generators/html/Alerts-Top1.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
<a href="Alerts.html">Alerts</a> &#x00BB; Top1
1313
</nav>
1414
<header class="odoc-preamble">
15-
<h1>Module <code><span>Alerts.Top1</span></code></h1><p>Top-comment.</p>
15+
<h1>Module <code><span>Alerts.Top1</span></code></h1>
1616
<ul class="at-tags">
1717
<li class="deprecated"><span class="at-tag">deprecated</span> A</li>
18-
</ul>
18+
</ul><p>Top-comment.</p>
1919
</header><div class="odoc-content"></div>
2020
</body>
2121
</html>

test/generators/html/Alerts-Top2.html

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/generators/html/Alerts.html

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,7 @@ <h1>Module <code><span>Alerts</span></code></h1>
5757
<span class="keyword">end</span>
5858
</span>
5959
</code>
60-
</div><div class="spec-doc"><p>Top-comment.</p></div>
61-
</div>
62-
<div class="odoc-spec">
63-
<div class="spec module anchored" id="module-Top2">
64-
<a href="#module-Top2" class="anchor"></a>
65-
<code>
66-
<span><span class="keyword">module</span>
67-
<a href="Alerts-Top2.html">Top2</a>
68-
</span>
69-
<span> : <span class="keyword">sig</span> ...
70-
<span class="keyword">end</span>
71-
</span>
72-
</code>
73-
</div><div class="spec-doc"><p>Top-comment.</p></div>
60+
</div>
7461
</div>
7562
<div class="odoc-spec">
7663
<div class="spec value anchored" id="val-d">

test/generators/html/alerts.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
Alerts.html
22
Alerts-Top1.html
3-
Alerts-Top2.html

test/generators/latex/Alerts.tex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ \section{Module \ocamlinlinecode{Alerts}}\label{Alerts}%
1515
\end{ocamlindent}%
1616
\medbreak
1717
\label{Alerts-module-Top1}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[Alerts-Top1]{\ocamlinlinecode{Top1}}}\ocamlcodefragment{ : \ocamltag{keyword}{sig}}\begin{ocamlindent}\end{ocamlindent}%
18-
\ocamlcodefragment{\ocamltag{keyword}{end}}\begin{ocamlindent}Top-comment.\end{ocamlindent}%
19-
\medbreak
20-
\label{Alerts-module-Top2}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[Alerts-Top2]{\ocamlinlinecode{Top2}}}\ocamlcodefragment{ : \ocamltag{keyword}{sig}}\begin{ocamlindent}\end{ocamlindent}%
21-
\ocamlcodefragment{\ocamltag{keyword}{end}}\begin{ocamlindent}Top-comment.\end{ocamlindent}%
22-
\medbreak
18+
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
2319
\label{Alerts-val-d}\ocamlcodefragment{\ocamltag{keyword}{val} d : int}\begin{ocamlindent}\begin{description}\kern-\topsep
2420
\makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded
2521
\item[{deprecated}]{A deprecated alert d}\end{description}%

test/generators/link.dune.inc

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@
708708
(subdir
709709
html
710710
(rule
711-
(targets Alerts.html.gen Alerts-Top1.html.gen Alerts-Top2.html.gen)
711+
(targets Alerts.html.gen Alerts-Top1.html.gen)
712712
(action
713713
(run
714714
odoc
@@ -732,12 +732,6 @@
732732
(alias runtest)
733733
(action
734734
(diff Alerts-Top1.html Alerts-Top1.html.gen))
735-
(enabled_if
736-
(>= %{ocaml_version} 4.04)))
737-
(rule
738-
(alias runtest)
739-
(action
740-
(diff Alerts-Top2.html Alerts-Top2.html.gen))
741735
(enabled_if
742736
(>= %{ocaml_version} 4.04))))
743737

@@ -791,7 +785,7 @@
791785
(subdir
792786
man
793787
(rule
794-
(targets Alerts.3o.gen Alerts.Top1.3o.gen Alerts.Top2.3o.gen)
788+
(targets Alerts.3o.gen Alerts.Top1.3o.gen)
795789
(action
796790
(run odoc man-generate -o . --extra-suffix gen %{dep:../alerts.odocl}))
797791
(enabled_if
@@ -806,12 +800,6 @@
806800
(alias runtest)
807801
(action
808802
(diff Alerts.Top1.3o Alerts.Top1.3o.gen))
809-
(enabled_if
810-
(>= %{ocaml_version} 4.04)))
811-
(rule
812-
(alias runtest)
813-
(action
814-
(diff Alerts.Top2.3o Alerts.Top2.3o.gen))
815803
(enabled_if
816804
(>= %{ocaml_version} 4.04))))
817805

0 commit comments

Comments
 (0)