Commit d7aee078 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Rename [Pervasives.compare] in order to avoid a warning in OCaml 4.09.

parent 4f08ad19
Pipeline #114918 passed with stages
in 26 seconds
(******************************************************************************)
(* *)
(* Menhir *)
(* *)
(* François Pottier, Inria Paris *)
(* Yann Régis-Gianas, PPS, Université Paris Diderot *)
(* *)
(* Copyright Inria. All rights reserved. This file is distributed under the *)
(* terms of the GNU General Public License version 2, as described in the *)
(* file LICENSE. *)
(* *)
(******************************************************************************)
(* Because the generic comparison function is named [Pervasives.compare] in
early versions of OCaml and [Stdlib.compare] in recent versions, we cannot
refer to it under either name. The following definition allows us to refer
to it under the name [Generic.compare]. *)
let compare =
compare
......@@ -49,7 +49,7 @@ let same_input_file file1 file2 =
(* could also use physical equality [file1 == file2] *)
let compare_input_files file1 file2 =
Pervasives.compare file1.input_file_index file2.input_file_index
Generic.compare file1.input_file_index file2.input_file_index
(* Ideally, this function should NOT be used, as it reflects the
order of the input files on the command line. As of 2016/08/25,
it is used by [BasicPrinter], for lack of a better
......
......@@ -408,7 +408,7 @@ end = struct
(* Compare the two positions first. This can be done without going
through [Trie.decode], by directly comparing the two integer
identities. *)
let c = Pervasives.compare (identity fact1) (identity fact2) in
let c = Generic.compare (identity fact1) (identity fact2) in
if debug then assert (c = Trie.compare (position fact1) (position fact2));
if c <> 0 then c else
let z = lookahead fact1 in
......
......@@ -196,7 +196,7 @@ module Make (X : sig end) = struct
!c
let compare t1 t2 =
Pervasives.compare t1.identity t2.identity
Generic.compare t1.identity t2.identity
let source t =
t.source
......
......@@ -266,7 +266,7 @@ let compare_tokens (_token, prop) (_token', prop') =
| PrecedenceLevel _, UndefinedPrecedence ->
1
| PrecedenceLevel (m, v, _, _), PrecedenceLevel (m', v', _, _) ->
compare_pairs InputFile.compare_input_files Pervasives.compare (m, v) (m', v')
compare_pairs InputFile.compare_input_files Generic.compare (m, v) (m', v')
let print_tokens f g =
(* Print the %token declarations. *)
......@@ -345,7 +345,7 @@ let print_branch f g branch =
let compare_branch_production_levels bpl bpl' =
match bpl, bpl' with
| ProductionLevel (m, l), ProductionLevel (m', l') ->
compare_pairs InputFile.compare_input_files Pervasives.compare (m, l) (m', l')
compare_pairs InputFile.compare_input_files Generic.compare (m, l) (m', l')
let compare_branches (b : branch) (b' : branch) =
compare_branch_production_levels b.branch_production_level b'.branch_production_level
......
......@@ -390,9 +390,9 @@ module Terminal = struct
" "
(fun f -> String.iter f w)
(* [Pervasives.compare] implements a lexicographic ordering on strings. *)
(* [Generic.compare] implements a lexicographic ordering on strings. *)
let compare i1 i2 =
Pervasives.compare (decode i1) (decode i2)
Generic.compare (decode i1) (decode i2)
end
......
......@@ -566,7 +566,7 @@ module Make (X : Endianness.S) = struct
| None ->
raise (Got 1)
| Some (key2, data2) ->
let c = Pervasives.compare key1 key2 in
let c = Generic.compare key1 key2 in
if c <> 0 then
raise (Got c)
else
......@@ -939,7 +939,7 @@ module Domain = struct
| None ->
raise (Got 1)
| Some x2 ->
let c = Pervasives.compare x1 x2 in
let c = Generic.compare x1 x2 in
if c <> 0 then
raise (Got c)
) s1;
......@@ -1086,4 +1086,3 @@ end
module Little = Make(Endianness.Little)
module Big = Make(Endianness.Big)
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