module Key_value_section:Adaptor module for key-value property lists with section headings. This is likesig
..end
Adaptor.Key_value
, but we also provide a pattern for
recognizing when new sections starts and, optionally, when they end.val adaptor : ?comment:string ->
?delim:char ->
?end_section:string ->
string ->
(< delim : 'a; fstab : 'b; group : 'c; key_value : Line.absent; mailcap : 'd;
passwd : 'e; ps : 'f; seq : 'g; source : 'h; stat : 'i > ->
< delim : 'a; fstab : 'b; group : 'c;
key_value : < section : Line.present >; mailcap : 'd; passwd : 'e;
ps : 'f; seq : 'g; source : 'h; stat : 'i >)
Adaptor.adaptor
Key_value_section.adaptor pat
creates an adaptor for key-value
files, using pat
to recognize sections. In particular, pat
must be Perl-compatible regular expression containing exactly one
parenthesized back-reference form, for example, "\[(.+)\]"
or
"Host (.+)"
, in which case the matched substring becomes the
section heading for subsequent records. At the beginning of
parsing, before pat
has matched, the current section heading is
""
.
The optional argument ?end_section
gives a Perl-compatible
regular expression that, if it matches a line, indicates the end of
the current section. When this happens, the section reverts to the
empty string for subsequent records. The other optional arguments
are as in Adaptor.Key_value
.
val fitting : ?comment:string ->
?delim:char ->
?end_section:string ->
string ->
(< delim : 'a; fstab : 'b; group : 'c; key_value : Line.absent; mailcap : 'd;
passwd : 'e; ps : 'f; seq : 'g; source : 'h; stat : 'i > ->
< delim : 'a; fstab : 'b; group : 'c;
key_value : < section : Line.present >; mailcap : 'd; passwd : 'e;
ps : 'f; seq : 'g; source : 'h; stat : 'i >)
Adaptor.fitting_adaptor
val reader : ?comment:string -> Reader.t
val splitter : ?delim:char ->
?end_section:string ->
string ->
(< delim : 'a; fstab : 'b; group : 'c; key_value : Line.absent; mailcap : 'd;
passwd : 'e; ps : 'f; seq : 'g; source : 'h; stat : 'i > ->
< delim : 'a; fstab : 'b; group : 'c;
key_value : < section : Line.present >; mailcap : 'd; passwd : 'e;
ps : 'f; seq : 'g; source : 'h; stat : 'i >)
Adaptor.splitter
module type SPEC =sig
..end
Adaptor.Key_value_section.Make
.
module type S =sig
..end
Adaptor.Key_value_section.Make
.
module Make: