Base: use Re_str
instead of non-thread-safe library Str
This commit is contained in:
parent
227232e6c7
commit
62f436eda9
@ -299,7 +299,7 @@ let help_group =
|
||||
|
||||
let string_contains ~needle ~haystack =
|
||||
try
|
||||
Some (Str.search_forward (Str.regexp_string needle) haystack 0)
|
||||
Some Re_str.(search_forward (regexp_string needle) haystack 0)
|
||||
with Not_found ->
|
||||
None
|
||||
|
||||
@ -615,18 +615,18 @@ let print_highlight highlight_strings formatter str =
|
||||
let rec print_string = function
|
||||
| [] -> Format.fprintf formatter "%s" str
|
||||
| regex :: tl ->
|
||||
begin match Str.full_split regex str with
|
||||
begin match Re_str.full_split regex str with
|
||||
| []
|
||||
| [ Str.Text _ ] -> print_string tl
|
||||
| [ Re_str.Text _ ] -> print_string tl
|
||||
| list ->
|
||||
List.iter
|
||||
(function
|
||||
| Str.Text text -> Format.fprintf formatter "%s" text
|
||||
| Str.Delim delimiter ->
|
||||
| Re_str.Text text -> Format.fprintf formatter "%s" text
|
||||
| Re_str.Delim delimiter ->
|
||||
Format.fprintf formatter "@{<hilight>%s@}" delimiter)
|
||||
list
|
||||
end
|
||||
in print_string (List.map 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
|
||||
@ -1121,7 +1121,7 @@ let autocomplete ~script ~cur_arg ~prev_arg ~args ~tree ~global_options cctxt =
|
||||
end
|
||||
end >>|? fun completions ->
|
||||
List.filter
|
||||
(fun completion -> Str.string_match (Str.regexp_string cur_arg) completion 0)
|
||||
(fun completion -> Re_str.(string_match (regexp_string cur_arg) completion 0))
|
||||
completions
|
||||
|
||||
(* Try a list of commands on a list of arguments *)
|
||||
|
@ -18,6 +18,7 @@
|
||||
tezos-rpc
|
||||
tezos-micheline
|
||||
tezos-protocol-environment-sigs
|
||||
re.str
|
||||
calendar
|
||||
ezjsonm
|
||||
lwt.unix
|
||||
|
@ -91,7 +91,7 @@ class file_wallet dir : wallet = object (self)
|
||||
method private filename alias_name =
|
||||
Filename.concat
|
||||
dir
|
||||
(Str.(global_replace (regexp_string " ") "_" alias_name) ^ "s")
|
||||
(Re_str.(global_replace (regexp_string " ") "_" alias_name) ^ "s")
|
||||
|
||||
method load : type a. string -> default:a -> a Data_encoding.encoding -> a tzresult Lwt.t =
|
||||
fun alias_name ~default encoding ->
|
||||
|
@ -197,8 +197,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 = Str.regexp (String.concat "\\|" containing) in
|
||||
(fun key -> try ignore (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
|
||||
|
@ -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 = Str.global_replace (Str.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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user