Page
Library
Module
Module type
Parameter
Class
Class type
Source
Cudf_parser
SourceParser for CUDF related documents
a CUDF parser opened on some input source
Error during parsing (syntax error, type error, ...). Arguments are error message and error location.
create a CUDF parser reading data from an input channel
create a CUDF parser reading data from an Extlib input channel
create a CUDF parser reading data from a file
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).
All full parsing function are granted to raise only Cudf_parser.Parse_error
; finer grained exception are mapped to it.
parse a CUDF document (or a universe) as a whole
same as Cudf_parser.parse
, but additionally loads the package list as an abstract Cudf.universe
.
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.
Load a solution wrt to a given CUDF document, whose universe is given.
Solution format is as per Appendix B of CUDF 2.0 spec
val parse_from_file :
?typedecl:Cudf_conf.stanza_typedecl ->
string ->
Cudf.preamble option * Cudf.package list * Cudf.request option
Shorthand: parse a file given its name
val load_from_file :
?typedecl:Cudf_conf.stanza_typedecl ->
string ->
Cudf.preamble option * Cudf.universe * Cudf.request option
Shorthand: load from a file given its name
Shorthand: load a solution from a file given its name
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.
The following parsing function usually raise fine grained exceptions such as Cudf_types.Syntax_error
and Cudf_types.Type_error
.
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.
val type_check_stanza :
?locs:loc_map ->
string Cudf_types.stanza ->
Cudf_types.typedecl ->
Cudf_types.typed_value Cudf_types.stanza
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.