Module Adaptor.Key_value_section

module Key_value_section: sig .. end
Adaptor module for key-value property lists with section headings. This is like 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 -> Adaptor.adaptor
Adaptor to parse a key-value file with sections. 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 lines. 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 lines. The other optional arguments are as in Adaptor.Key_value.

val fitting : ?comment:string ->
?delim:char -> ?end_section:string -> string -> Adaptor.fitting_adaptor
Fitting for key-value files with sections.
val reader : ?comment:string -> Reader.t
Read key-value raw lines.
val splitter : ?delim:char -> ?end_section:string -> string -> Adaptor.splitter
Split key-value lines with sections and fill in Line.Key_value, including Line.Key_value.section.

Functorial Interface


module type SPEC = sig .. end
Input signature for Adaptor.Key_value_section.Make.
module type S = sig .. end
Output signature for Adaptor.Key_value_section.Make.
module Make: 
functor (Spec : SPEC-> S
Functor to create custom key-value-section adaptors.