Module Cudf_parser


module Cudf_parser: sig .. end
Parser for CUDF related documents

type cudf_parser 
val from_in_channel : Pervasives.in_channel -> cudf_parser
val close : cudf_parser -> unit
exception Parse_error of int * string
Parse error. Arguments: line numnber and error message

Full CUDF document parsing

"parse_*" functions offer plain syntax parsing, with no semantic interpretation of what is being parsed. "load_*" functions offer the latter, hence also checking for semantic constraints (such as the lack of key duplication).

val parse : cudf_parser -> Cudf.package list * Cudf.request option
parse a CUDF document (or a universe) as a whole
Returns a pair packages, Some req if a complete CUDF (i.e., with a request part) is found, otherwise return a pair package, None if the request part is missing. Note that a document with no request part is not a valid CUDF document.
val load : cudf_parser -> Cudf.universe * Cudf.request option
same as Cudf_parser.parse, but additionally loads the package list as an abstract Cudf.universe
val parse_from_file : string -> Cudf.package list * Cudf.request option
shorthand: parse a file given its name
val load_from_file : string -> Cudf.universe * Cudf.request option
shorthand: load from a file given its name

Item-by-item CUDF parsing

val parse_item : cudf_parser ->
[ `Package of Cudf.package | `Request of Cudf.request ]
parse the next information item (either a package description or a user request) from the given input channel.

Low-level parsing functions

val parse_stanza : cudf_parser -> (string * string) list
Parse a file stanza (i.e., a RFC822-like stanza, with the notable simplification that all field/value pairs are one-liners). Strip any heading blanks lines leading to the first available field/value pair.
Returns an associative list mapping field name to field values