From d88b51aea64199a7670d2804694832c66ee35518 Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Mon, 26 Sep 2016 11:31:39 +0200 Subject: Add a compatibility flag for 8.6 and refactor. --- lib/flags.ml | 24 ++++++++++++++---------- lib/flags.mli | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/flags.ml b/lib/flags.ml index 13525165ab..df00eba7ba 100644 --- a/lib/flags.ml +++ b/lib/flags.ml @@ -108,20 +108,23 @@ let we_are_parsing = ref false (* Current means no particular compatibility consideration. For correct comparisons, this constructor should remain the last one. *) -type compat_version = V8_2 | V8_3 | V8_4 | V8_5 | Current +type compat_version = V8_2 | V8_3 | V8_4 | V8_5 | V8_6 | Current let compat_version = ref Current let version_strictly_greater v = match !compat_version, v with -| V8_2, (V8_2 | V8_3 | V8_4 | V8_5 | Current) -> false -| V8_3, (V8_3 | V8_4 | V8_5 | Current) -> false -| V8_4, (V8_4 | V8_5 | Current) -> false -| V8_5, (V8_5 | Current) -> false -| Current, Current -> false -| V8_3, V8_2 -> true -| V8_4, (V8_2 | V8_3) -> true -| V8_5, (V8_2 | V8_3 | V8_4) -> true -| Current, (V8_2 | V8_3 | V8_4 | V8_5) -> true +| _ , Current -> false +| Current , _ -> true +| _ , V8_6 -> false +| V8_6 , _ -> true +| _ , V8_5 -> false +| V8_5 , _ -> true +| _ , V8_4 -> false +| V8_4 , _ -> true +| _ , V8_3 -> false +| v8_3 , _ -> true +| V8_2 , V8_2 -> false + let version_less_or_equal v = not (version_strictly_greater v) @@ -130,6 +133,7 @@ let pr_version = function | V8_3 -> "8.3" | V8_4 -> "8.4" | V8_5 -> "8.5" + | V8_6 -> "8.6" | Current -> "current" (* Translate *) diff --git a/lib/flags.mli b/lib/flags.mli index 8fe64d24fa..e498dc6b5b 100644 --- a/lib/flags.mli +++ b/lib/flags.mli @@ -62,7 +62,7 @@ val raw_print : bool ref val record_print : bool ref val univ_print : bool ref -type compat_version = V8_2 | V8_3 | V8_4 | V8_5 | Current +type compat_version = V8_2 | V8_3 | V8_4 | V8_5 | V8_6 | Current val compat_version : compat_version ref val version_strictly_greater : compat_version -> bool val version_less_or_equal : compat_version -> bool -- cgit v1.2.3 From daae678047ee2a1c53d4dc423976f77e40ba753f Mon Sep 17 00:00:00 2001 From: Matej Kosik Date: Wed, 28 Sep 2016 16:08:40 +0200 Subject: FIX: a bug in the pattern matching --- lib/flags.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/flags.ml b/lib/flags.ml index df00eba7ba..40b7a29d26 100644 --- a/lib/flags.ml +++ b/lib/flags.ml @@ -122,7 +122,7 @@ let version_strictly_greater v = match !compat_version, v with | _ , V8_4 -> false | V8_4 , _ -> true | _ , V8_3 -> false -| v8_3 , _ -> true +| V8_3 , _ -> true | V8_2 , V8_2 -> false -- cgit v1.2.3 From a75770eb41e8a3bbfb44cb65d04bb3af29448fe7 Mon Sep 17 00:00:00 2001 From: Matej Kosik Date: Wed, 28 Sep 2016 16:19:23 +0200 Subject: CLEANUP: remove the definition of the "CString.map" function. We will use the official "String.map" function instead. --- lib/cString.ml | 7 ------- lib/cString.mli | 3 --- 2 files changed, 10 deletions(-) (limited to 'lib') diff --git a/lib/cString.ml b/lib/cString.ml index 0c2ed2e7c0..61ed03083e 100644 --- a/lib/cString.ml +++ b/lib/cString.ml @@ -17,7 +17,6 @@ sig val explode : string -> string list val implode : string list -> string val strip : string -> string - val map : (char -> char) -> string -> string val drop_simple_quotes : string -> string val string_index_from : string -> int -> string -> int val string_contains : where:string -> what:string -> bool @@ -78,12 +77,6 @@ let strip s = let a = lstrip_rec 0 and b = rstrip_rec (n-1) in String.sub s a (b-a+1) -let map f s = - let l = String.length s in - let r = String.create l in - for i = 0 to (l - 1) do r.[i] <- f (s.[i]) done; - r - let drop_simple_quotes s = let n = String.length s in if n > 2 && s.[0] = '\'' && s.[n-1] = '\'' then String.sub s 1 (n-2) else s diff --git a/lib/cString.mli b/lib/cString.mli index 5292b34d0a..65edfbbe68 100644 --- a/lib/cString.mli +++ b/lib/cString.mli @@ -32,9 +32,6 @@ sig val strip : string -> string (** Remove the surrounding blank characters from a string *) - val map : (char -> char) -> string -> string - (** Apply a function on a string character-wise. *) - val drop_simple_quotes : string -> string (** Remove the eventual first surrounding simple quotes of a string. *) -- cgit v1.2.3