This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,2 @@
(library
(name supported_version))

View file

@ -0,0 +1,26 @@
type t = int * int
let all =
[
(4, 08);
(4, 09);
(4, 10);
(4, 11);
(4, 12);
(4, 13);
(4, 14);
(5, 0);
(5, 1);
(5, 2);
(5, 3);
(5, 4);
]
let to_string (a, b) =
if a < 5 then Printf.sprintf "%d.%02d" a b else Printf.sprintf "%d.%d" a b
let to_int (a, b) = (a * 100) + b
let of_string s =
let t = Scanf.sscanf s "%u.%u" (fun a b -> (a, b)) in
if List.mem t all then Some t else None

View file

@ -0,0 +1,14 @@
(** Supported versions of the OCaml AST *)
type t
val all : t list
val to_string : t -> string
(** Return a string such as "4.02" *)
val to_int : t -> int
(** Return an integer such as [402] *)
val of_string : string -> t option
(** Parse a string as reported by [ocamlc -version] *)