Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 07882a52 authored by POTTIER Francois's avatar POTTIER Francois

Introduce `Misc.array_for_all` as a replacement for `Array.for_all`,

which does not exist in OCaml 4.02.
parent 3342a1ae
......@@ -679,7 +679,7 @@ module Production = struct
production_level.(k) <- branch.branch_production_level;
prec_decl.(k) <- branch.branch_prec_annotation;
positions.(k) <- [ branch.branch_position ];
if not (Array.for_all Symbol.non_error rhs) then
if not (Misc.array_for_all Symbol.non_error rhs) then
grammar_uses_error_token := true;
k+1
) k branches in
......
......@@ -382,3 +382,14 @@ let nth = function
| 2 -> "second"
| 3 -> "third"
| i -> Printf.sprintf "%dth" i
(* To keep compatibility with OCaml 4.02,
we copy [Array.for_all], which appeared
in 4.03. *)
let array_for_all p a =
let n = Array.length a in
let rec loop i =
if i = n then true
else if p (Array.unsafe_get a i) then loop (succ i)
else false in
loop 0
......@@ -188,3 +188,7 @@ end
(* A nice way of printing "nth" in English, for concrete values of [n]. *)
val nth: int -> string
(* [Array.for_all] *)
val array_for_all : ('a -> bool) -> 'a array -> bool
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment