module Reader:Readers are responsible for breaking input data into records. A reader need not be concerned with the meaning of data in a record. Its goal is merely to determine record boundaring. Given ansig
..end
in_channel
from which to read, a reader must produce a string
containing one record from the channel, and should also keep track of
any non-data (formatting or record separators) that it encounters,
making its operation somewhat invertible.type
raw_line = {
|
content : |
(* | Readers are responsible for breaking input data into records.
A reader need not be concerned with the meaning of data in a
record. Its goal is merely to determine record boundaring. Given an
in_channel from which to read, a reader must produce a string
containing one record from the channel, and should also keep track of
any non-data (formatting or record separators) that it encounters,
making its operation somewhat invertible. | *) |
|
before : |
(* | Readers are responsible for breaking input data into records.
A reader need not be concerned with the meaning of data in a
record. Its goal is merely to determine record boundaring. Given an
in_channel from which to read, a reader must produce a string
containing one record from the channel, and should also keep track of
any non-data (formatting or record separators) that it encounters,
making its operation somewhat invertible. | *) |
|
after : |
(* | Readers are responsible for breaking input data into records.
A reader need not be concerned with the meaning of data in a
record. Its goal is merely to determine record boundaring. Given an
in_channel from which to read, a reader must produce a string
containing one record from the channel, and should also keep track of
any non-data (formatting or record separators) that it encounters,
making its operation somewhat invertible. | *) |
typet =
Pervasives.in_channel -> raw_line
Reader.raw_line
s from an input
channel.
Readers are responsible for breaking input data into records.
A reader need not be concerned with the meaning of data in a
record. Its goal is merely to determine record boundaring. Given an
in_channel
from which to read, a reader must produce a string
containing one record from the channel, and should also keep track of
any non-data (formatting or record separators) that it encounters,
making its operation somewhat invertible.
val raw_of_string : ?before:string -> ?after:string -> string -> raw_line
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 records are terminated by the character c
.`Set s
means that records are separated by a sequence of one or
more characters from the string s
. Record separator characters may
be returned in either the preceding or following Reader.raw_line
.`Fixed (n, m)
means that records 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 record. 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
val ignore_if : (string -> bool) -> t -> t
val join_on : char -> t -> t
val empty : string -> bool
val blank : string -> bool
val starts_with : string -> string -> bool
starts_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 -> bool
ends_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 -> bool
contains 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
.