Parser for CUDF related documents
a CUDF parser opened on some input source
Dispose a CUDF parser.
Afterwards, the parser should not be used any longer
"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).
parse a CUDF document (or a universe) as a whole
preamble, packages, requestwhere preamble and request are returned only if actually met in the parsed document. Note that a document with no request part is not a valid CUDF document (but might still be used to represent solver solutions, for instance).
Parse_errorwhen an error during parsing is encountered (might be a syntax error, a type error, ..)
Note: to load compact universes (i.e. only containing package names, versions, and installed status) that will be tested as solutions you should use Cudf_parser.load_solution instead: the present function does not expand missing metadata with respect to the initial status.
Parse_erroras [root:Cudf_parser].parse does
Cudf.Constraint_violationas [root:Cudf].load_universe does
Parse the next information item (either a package description, a user request, or a preamble) from the given input channel.
Beware that parsing is stateful; in particular when the preamble is parsed, the list of allowed properties for future package stanzas is internally updated.
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.
End_of_fileif no other stanza is available due to reached EOF
Cudf_types.Syntax_errorwhen a syntax error is encountered
Type check an untyped stanza according to a given set of type declarations. Also take care of default values, adding missing properties where needed; fail if a required property is missing.
Syntax_errorif a property does not match its declared type; this exception is also raised when an undeclared property is encountered
Type_errorwhen a property has a value of the wrong type