module Reader:sig..end
Reader.t need not be concerned with the meaning of
data in a line. Its goal is merely to determine boundaires. Given
an in_channel from which to read, a reader reads some data, and
produces a Reader.raw_line record. It should keep track of any
non-data (formatting or record separators) that it encounters, using
the before and after fields, making its operation somewhat
invertible.type raw_line = {
|
content : |
(* |
The data of the line
| *) |
|
before : |
(* |
Delimiting text from before the data
| *) |
|
after : |
(* |
Delimiting text from after the data
| *) |
typet =Pervasives.in_channel -> raw_line
Reader.raw_lines from an input
channel.val raw_of_string : ?before:string -> ?after:string -> string -> raw_line?before defaults to "" and ?after defaults to
"\n".val make : [ `Buf of eof:bool -> Buffer.t -> raw_line option
| `Char of char
| `Fixed of int * int
| `Set of string ] -> t`Char c means that raw lines are terminated by the character c.`Set s means that raw lines are separated by a sequence of one or
more characters from the string s. Line separator characters may
be returned in either the preceding or following Reader.raw_line.`Fixed (n, m) means that raw lines comprise n characters of data
followed by m characters of garbage.`Buf f uses the function f to determine whether the input
buffer contains a complete raw line. If f returns Some r, then r
is returns the buffer is flushed; otherwise, one more character is
read and then f is tried again. At end-of-file, f is passed
~eof:true.Reader.make are stateless between calls.
val lines : t
Reader transformers add behavior to a reader.
val ignore_if : (string -> bool) -> t -> tval join_on : char -> t -> tval empty : string -> boolval blank : string -> boolval starts_with : string -> string -> boolstarts_with patt s returns whether s starts with the string patt.
Allows additional leading white space in the subject string.val ends_with : string -> string -> boolends_with patt s returns whether s ends with the string patt.
Allows additional trailing white space in the subject string.val contains : ?regexp:bool -> string -> string -> boolcontains patt s returns whether the string s contains the
string patt. Calling contains ~regexp:true patt s
returns whether the string s matches the Perl-compatible regular
expression patt.