Skip to content

Commit a7a5ab4

Browse files
Merge pull request #345 from Leonidas-from-XIV/bump-minimum-ocaml-to-4.08
Bump minimum OCaml to 4.08
2 parents 1408367 + c97ec14 commit a7a5ab4

File tree

18 files changed

+117
-459
lines changed

18 files changed

+117
-459
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
#### Removed
1212

13+
- Dropped compatibility with older OCaml versions. The minimal supported range
14+
is 4.08 to 4.13 now (#345, @Leonidas-from-XIV)
15+
1316
#### Security
1417

1518
### 1.11.0

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"`ocaml-mdx` allows to execute code blocks inside markdown files.\nThere are (currently) two sub-commands, corresponding\nto two modes of operations: pre-processing (`ocaml-mdx pp`)\nand tests (`ocaml-mdx test`).\n\nThe pre-processor mode allows to mix documentation and code,\nand to practice \"literate programming\" using markdown and OCaml.\n\nThe test mode allows to ensure that shell scripts and OCaml fragments\nin the documentation always stays up-to-date.\n\n`ocaml-mdx` is released as two binaries called `ocaml-mdx` and `mdx` which are\nthe same, mdx being the deprecated name, kept for now for compatibility.")
2121
(depends
2222
(ocaml
23-
(>= 4.02.3))
23+
(>= 4.08.0))
2424
ocamlfind
2525
(fmt (>= 0.8.5))
2626
(cppo :build)

lib/block.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*)
1616

1717
open Result
18-
open Compat
1918
open Util.Result.Infix
2019

2120
module Header = struct

lib/compat.ml

Lines changed: 0 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -14,145 +14,6 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*)
1616

17-
module Char = struct
18-
include Char
19-
20-
#if OCAML_VERSION < (4, 3, 0)
21-
let equal x y = Char.compare x y = 0
22-
#endif
23-
end
24-
25-
module String = struct
26-
include String
27-
28-
#if OCAML_VERSION < (4, 3, 0)
29-
let equal x y = String.compare x y = 0
30-
#endif
31-
32-
#if OCAML_VERSION < (4, 4, 0)
33-
let split_on_char sep s =
34-
let r = ref [] in
35-
let j = ref (String.length s) in
36-
for i = String.length s - 1 downto 0 do
37-
if String.unsafe_get s i = sep then begin
38-
r := String.sub s (i + 1) (!j - i - 1) :: !r;
39-
j := i
40-
end
41-
done;
42-
String.sub s 0 !j :: !r
43-
#endif
44-
45-
#if OCAML_VERSION < (4, 5, 0)
46-
let rec index_rec_opt s lim i c =
47-
if i >= lim then None else
48-
if unsafe_get s i = c then Some i else index_rec_opt s lim (i + 1) c
49-
50-
let index_opt s c = index_rec_opt s (length s) 0 c
51-
#endif
52-
53-
#if OCAML_VERSION < (4, 3, 0)
54-
let capitalize_ascii = String.capitalize (* deprecated >= 4.3.0 *)
55-
#endif
56-
end
57-
58-
module Filename = struct
59-
include Filename
60-
61-
#if OCAML_VERSION < (4, 4, 0)
62-
let is_dir_sep s i = s.[i] = '/' (* Unix only *)
63-
64-
let extension_len name =
65-
let rec check i0 i =
66-
if i < 0 || is_dir_sep name i then 0
67-
else if name.[i] = '.' then check i0 (i - 1)
68-
else String.length name - i0
69-
in
70-
let rec search_dot i =
71-
if i < 0 || is_dir_sep name i then 0
72-
else if name.[i] = '.' then check i (i - 1)
73-
else search_dot (i - 1)
74-
in
75-
search_dot (String.length name - 1)
76-
77-
let extension name =
78-
let l = extension_len name in
79-
if l = 0 then "" else String.sub name (String.length name - l) l
80-
81-
let remove_extension name =
82-
let l = extension_len name in
83-
if l = 0 then name else String.sub name 0 (String.length name - l)
84-
#endif
85-
end
86-
87-
module List = struct
88-
include List
89-
90-
#if OCAML_VERSION < (4, 8, 0)
91-
let filter_map f =
92-
let rec aux accu = function
93-
| [] -> rev accu
94-
| x :: l ->
95-
match f x with
96-
| None -> aux accu l
97-
| Some v -> aux (v :: accu) l
98-
in
99-
aux []
100-
#endif
101-
102-
#if OCAML_VERSION < (4, 6, 0)
103-
let rec init_aux i n f =
104-
if i >= n then []
105-
else (f i) :: init_aux (i+1) n f
106-
107-
let init n f = init_aux 0 n f
108-
#endif
109-
110-
#if OCAML_VERSION < (4, 5, 0)
111-
let rec find_opt p = function
112-
| [] -> None
113-
| x :: l -> if p x then Some x else find_opt p l
114-
115-
let rec compare_length_with l n =
116-
match l with
117-
| [] ->
118-
if n = 0 then 0 else
119-
if n > 0 then -1 else 1
120-
| _ :: l ->
121-
if n <= 0 then 1 else
122-
compare_length_with l (n-1)
123-
#endif
124-
125-
#if OCAML_VERSION < (4, 3, 0)
126-
let cons x xs = x :: xs
127-
#endif
128-
end
129-
130-
module Warnings = struct
131-
include Warnings
132-
133-
#if OCAML_VERSION < (4, 3, 0)
134-
(* Can't be overriden *)
135-
let reset_fatal () = ()
136-
#endif
137-
end
138-
139-
module Lexer = struct
140-
include Lexer
141-
142-
#if OCAML_VERSION < (4, 3, 0)
143-
let handle_docstrings = ref true
144-
#endif
145-
end
146-
147-
#if OCAML_VERSION < (4, 4, 0)
148-
module Env = struct
149-
include Env
150-
151-
(* Can't be overriden *)
152-
let without_cmis f x = f x
153-
end
154-
#endif
155-
15617
#if OCAML_VERSION >= (4, 9, 0)
15718
let init_path () = Compmisc.init_path ()
15819
#else

lib/dep.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*)
1616

17-
open Compat
18-
1917
type t = File of string | Dir of string
2018

2119
let of_block block =

lib/label.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*)
1616

17-
open Compat
1817
open Result
1918

2019
module Relation = struct

lib/lexer_top.mll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ and phrase acc buf = parse
2222
for _ = 1 to (String.length nl) do
2323
newline lexbuf
2424
done;
25-
let nl = Compat.List.init (String.length nl) (fun _ -> "") in
25+
let nl = List.init (String.length nl) (fun _ -> "") in
2626
phrase (nl @ Buffer.contents buf :: acc) (Buffer.create 8) lexbuf }
2727
| eol { newline lexbuf; List.rev (Buffer.contents buf :: acc) }
2828
| ";;" eol { newline lexbuf; List.rev ((Buffer.contents buf ^ ";;") :: acc) }

lib/mli_parser.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ let parse_mli file_contents =
133133
(slice lines ~start:!cursor ~end_:code_block.location.start)
134134
in
135135
let column = code_block.location.start.column in
136-
let contents = Compat.String.split_on_char '\n' code_block.contents in
136+
let contents = String.split_on_char '\n' code_block.contents in
137137
let block =
138138
match
139139
Block.mk ~loc ~section:None ~labels:[] ~header:(Some OCaml)
@@ -162,7 +162,7 @@ let parse_mli file_contents =
162162
in
163163
if eof_is_beyond_location !cursor then
164164
let remainder = slice lines ~start:!cursor ~end_:eof in
165-
if not (Compat.String.equal remainder "") then tokens @ [ Text remainder ]
165+
if not (String.equal remainder "") then tokens @ [ Text remainder ]
166166
else tokens
167167
else tokens
168168

lib/mli_parser.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
open! Compat
2-
31
val parse_mli : string -> (Document.line list, [ `Msg of string ]) Result.result
42
(** Slice an mli file into its [Text] and [Block] parts. *)

lib/output.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*)
1616

1717
open Misc
18-
open Compat
1918

2019
type t = [ `Output of string | `Ellipsis ]
2120

0 commit comments

Comments
 (0)