Skip to content

Commit ddd70f7

Browse files
authored
Merge pull request #1255 from Julow/v2.4-compat-5.3
(v2.4) Compatibility with OCaml 5.3
2 parents 5b4dfc3 + 74de92f commit ddd70f7

File tree

14 files changed

+14
-102
lines changed

14 files changed

+14
-102
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ let tag_of_token (tok : Parser.token) =
153153
#endif
154154

155155
let syntax_highlighting_locs src =
156+
Lexer.init ();
156157
let lexbuf = Lexing.from_string
157158
#if OCAML_VERSION >= (4,8,0)
158159
~with_positions:true

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">
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{module-Alerts}%
1515
\end{ocamlindent}%
1616
\medbreak
1717
\label{module-Alerts-module-Top1}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[module-Alerts-module-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{module-Alerts-module-Top2}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[module-Alerts-module-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{module-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
@@ -687,7 +687,7 @@
687687
(subdir
688688
html
689689
(rule
690-
(targets Alerts.html.gen Alerts-Top1.html.gen Alerts-Top2.html.gen)
690+
(targets Alerts.html.gen Alerts-Top1.html.gen)
691691
(action
692692
(run
693693
odoc
@@ -711,12 +711,6 @@
711711
(alias runtest)
712712
(action
713713
(diff Alerts-Top1.html Alerts-Top1.html.gen))
714-
(enabled_if
715-
(>= %{ocaml_version} 4.04)))
716-
(rule
717-
(alias runtest)
718-
(action
719-
(diff Alerts-Top2.html Alerts-Top2.html.gen))
720714
(enabled_if
721715
(>= %{ocaml_version} 4.04))))
722716

@@ -770,7 +764,7 @@
770764
(subdir
771765
man
772766
(rule
773-
(targets Alerts.3o.gen Alerts.Top1.3o.gen Alerts.Top2.3o.gen)
767+
(targets Alerts.3o.gen Alerts.Top1.3o.gen)
774768
(action
775769
(run odoc man-generate -o . --extra-suffix gen %{dep:../alerts.odocl}))
776770
(enabled_if
@@ -785,12 +779,6 @@
785779
(alias runtest)
786780
(action
787781
(diff Alerts.Top1.3o Alerts.Top1.3o.gen))
788-
(enabled_if
789-
(>= %{ocaml_version} 4.04)))
790-
(rule
791-
(alias runtest)
792-
(action
793-
(diff Alerts.Top2.3o Alerts.Top2.3o.gen))
794782
(enabled_if
795783
(>= %{ocaml_version} 4.04))))
796784

0 commit comments

Comments
 (0)