From 42c7f8899c9b1a4e011053487a97cf7eab312d5f Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sat, 6 Apr 2019 14:05:39 +0700 Subject: [PATCH] Add back previously removed functions Signed-off-by: Rudi Grinberg --- lib/core.ml | 6 ++++++ lib/core.mli | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/core.ml b/lib/core.ml index 5299b9c..99cf99c 100644 --- a/lib/core.ml +++ b/lib/core.ml @@ -1177,6 +1177,7 @@ let witness t = | End_of_str -> "" in witness (handle_case false t) +type 'a seq = 'a Seq.t module Seq = Rseq module List = Rlist module Group = Group @@ -1189,6 +1190,11 @@ let matches_gen = Gen.matches let split_gen = Gen.split let split_full_gen = Gen.split_full +let all_seq = Seq.all +let matches_seq = Seq.matches +let split_seq = Seq.split +let split_full_seq = Seq.split_full + type substrings = Group.t diff --git a/lib/core.mli b/lib/core.mli index ae4e6df..a79464b 100644 --- a/lib/core.mli +++ b/lib/core.mli @@ -125,6 +125,8 @@ type split_token = | `Delim of Group.t (** Delimiter *) ] +type 'a seq = 'a Seq.t + module Seq : sig val all : ?pos:int -> (** Default: 0 *) @@ -162,6 +164,9 @@ type 'a gen = unit -> 'a option val all_gen : ?pos:int -> ?len:int -> re -> string -> Group.t gen [@@ocaml.deprecated "Use Seq.all"] +val all_seq : ?pos:int -> ?len:int -> re -> string -> Group.t seq +[@@ocaml.deprecated "Use Seq.all"] + val matches : ?pos:int -> ?len:int -> re -> string -> string list (** Same as {!all}, but extracts the matched substring rather than returning the whole group. This basically iterates over matched strings *) @@ -169,6 +174,9 @@ val matches : ?pos:int -> ?len:int -> re -> string -> string list val matches_gen : ?pos:int -> ?len:int -> re -> string -> string gen [@@ocaml.deprecated "Use Seq.matches"] +val matches_seq : ?pos:int -> ?len:int -> re -> string -> string seq +[@@ocaml.deprecated "Use Seq.matches"] + val split : ?pos:int -> ?len:int -> re -> string -> string list (** [split re s] splits [s] into chunks separated by [re]. It yields the chunks themselves, not the separator. For instance this can be used with a @@ -177,6 +185,9 @@ val split : ?pos:int -> ?len:int -> re -> string -> string list val split_gen : ?pos:int -> ?len:int -> re -> string -> string gen [@@ocaml.deprecated "Use Seq.split"] +val split_seq : ?pos:int -> ?len:int -> re -> string -> string seq +[@@ocaml.deprecated "Use Seq.split"] + val split_full : ?pos:int -> ?len:int -> re -> string -> split_token list (** [split re s] splits [s] into chunks separated by [re]. It yields the chunks along with the separators. For instance this can be used with a @@ -185,6 +196,9 @@ val split_full : ?pos:int -> ?len:int -> re -> string -> split_token list val split_full_gen : ?pos:int -> ?len:int -> re -> string -> split_token gen [@@ocaml.deprecated "Use Seq.split_full"] +val split_full_seq : ?pos:int -> ?len:int -> re -> string -> split_token seq +[@@ocaml.deprecated "Use Seq.split_full"] + val replace : ?pos:int -> (** Default: 0 *) ?len:int ->