From b50d96ec2b07cc8a916b475a787303b84b29ccd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Wed, 7 Mar 2018 08:40:02 +0100 Subject: [PATCH] Fix compilation with recent 're' Re.Str --- src/lib_base/cli_entries.ml | 14 +++++++------- src/lib_base/tezos-base.opam | 1 + src/lib_client_base/client_keys.ml | 4 ++-- .../lib_protocol/test/test_michelson.ml | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/lib_base/cli_entries.ml b/src/lib_base/cli_entries.ml index 11185a0c4..08098af40 100644 --- a/src/lib_base/cli_entries.ml +++ b/src/lib_base/cli_entries.ml @@ -158,18 +158,18 @@ let print_highlight highlight_strings formatter str = let rec print_string = function | [] -> Format.fprintf formatter "%s" str | regex :: tl -> - begin match Re_str.full_split regex str with + begin match Re.Str.full_split regex str with | [] - | [ Re_str.Text _ ] -> print_string tl + | [ Re.Str.Text _ ] -> print_string tl | list -> List.iter (function - | Re_str.Text text -> Format.fprintf formatter "%s" text - | Re_str.Delim delimiter -> + | Re.Str.Text text -> Format.fprintf formatter "%s" text + | Re.Str.Delim delimiter -> Format.fprintf formatter "@{%s@}" delimiter) list end - in print_string (List.map Re_str.regexp_string highlight_strings) + in print_string (List.map Re.Str.regexp_string highlight_strings) let print_commandline ppf (highlights, options, args) = let rec print @@ -746,7 +746,7 @@ let string ~name ~desc next = let string_contains ~needle ~haystack = try - Some (Re_str.search_forward (Re_str.regexp_string needle) haystack 0) + Some (Re.Str.search_forward (Re.Str.regexp_string needle) haystack 0) with Not_found -> None @@ -1093,7 +1093,7 @@ let autocompletion ~script ~cur_arg ~prev_arg ~args ~global_options commands cct end end >>|? fun completions -> List.filter - (fun completion -> Re_str.(string_match (regexp_string cur_arg) completion 0)) + (fun completion -> Re.Str.(string_match (regexp_string cur_arg) completion 0)) completions let parse_global_options global_options ctx args = diff --git a/src/lib_base/tezos-base.opam b/src/lib_base/tezos-base.opam index 3e7e235c4..2c8b71c20 100644 --- a/src/lib_base/tezos-base.opam +++ b/src/lib_base/tezos-base.opam @@ -19,6 +19,7 @@ depends: [ "ezjsonm" { >= "0.5.0" } "ipaddr" "mtime" { >= "1.0.0" } + "re" { >= "1.7.2" } ] build: [ [ "jbuilder" "build" "-p" name "-j" jobs ] diff --git a/src/lib_client_base/client_keys.ml b/src/lib_client_base/client_keys.ml index a9d6728e6..4acfa8b44 100644 --- a/src/lib_client_base/client_keys.ml +++ b/src/lib_client_base/client_keys.ml @@ -202,8 +202,8 @@ let gen_keys_containing ?(prefix=false) ?(force=false) ~containing ~name (cctxt String.sub key 0 (String.length containing) = containing) containing_tz1) else - let re = Re_str.regexp (String.concat "\\|" containing) in - (fun key -> try ignore (Re_str.search_forward re key 0); true + let re = Re.Str.regexp (String.concat "\\|" containing) in + (fun key -> try ignore (Re.Str.search_forward re key 0); true with Not_found -> false) in let rec loop attempts = let seed = Ed25519.Seed.generate () in diff --git a/src/proto_alpha/lib_protocol/test/test_michelson.ml b/src/proto_alpha/lib_protocol/test/test_michelson.ml index 24bd2828a..ea9968249 100644 --- a/src/proto_alpha/lib_protocol/test/test_michelson.ml +++ b/src/proto_alpha/lib_protocol/test/test_michelson.ml @@ -55,7 +55,7 @@ let parse_execute sb ?tc code_str param_str storage_str = let test ctxt ?tc (file_name: string) (storage: string) (input: string) = let full_path = contract_path // file_name ^ ".tz" in let file = Helpers_misc.read_file full_path in - let spaced_file = Re_str.(global_replace (regexp_string "\n") "\n " file) in + let spaced_file = Re.Str.(global_replace (regexp_string "\n") "\n " file) in let program = "{" ^ spaced_file ^ "}" in parse_execute ctxt ?tc program input storage