Library
Module
Module type
Parameter
Class
Class type
CUDF type library
Implement core CUDF types (see CUDF spec. §2.2.2).
For parsing and pretty printing of CUDF types see Cudf_types_pp
.
type vpkglist = vpkg list
type vpkgformula = vpkg list list
CNF formula. Inner lists are OR-ed, outer AND-ed. E.g.:
[ foo ] ; [ bar ; baz ]
[]
type veqpkglist = veqpkg list
type typ = [
| `Int
| `Posint
| `Nat
| `Bool
| `String
| `Enum of string list
| `Pkgname
| `Ident
| `Vpkg
| `Vpkgformula
| `Vpkglist
| `Veqpkg
| `Veqpkglist
| `Typedecl
]
CUDF types
val keep_type : typ
type typedecl1 = [
| `Int of int option
| `Posint of int option
| `Nat of int option
| `Bool of bool option
| `String of string option
| `Pkgname of string option
| `Ident of string option
| `Enum of string list * string option
enums, default enum
*)| `Vpkg of vpkg option
| `Vpkgformula of vpkgformula option
| `Vpkglist of vpkglist option
| `Veqpkg of veqpkg option
| `Veqpkglist of veqpkglist option
| `Typedecl of typedecl option
]
(Single) type declaration: each variant denotes a type, its argument the default value, None if missing
and typedecl = (string * typedecl1) list
type typed_value = [
| `Int of int
| `Posint of int
| `Nat of int
| `Bool of bool
| `String of string
| `Pkgname of string
| `Ident of string
| `Enum of string list * string
| `Vpkg of vpkg
| `Vpkgformula of vpkgformula
| `Vpkglist of vpkglist
| `Veqpkg of veqpkg
| `Veqpkglist of veqpkglist
| `Typedecl of typedecl
]
Typed value in the value space of all CUDF types
val typedecl_of_value : typed_value -> typedecl1
Create a (single) type declaration having as default value the given typed value (i.e. apply the "Some" monad to typed values)
val value_of_typedecl : typedecl1 -> typed_value option
Extract the default value from a type declaration (or return None
)
val type_of_value : typed_value -> typ
val cast : typ -> typed_value -> typed_value
cast ty v
attempt a runtime cast of a given (typed) value to a different type.
Types used in parsing, before values are injected into the CUDF type system.
RFC-822-like stanza, i.e. an associative list mapping property names to property values.
Values are typed according to the type variable 'ty
. Usually, libCUDF uses either string stanza
(for untyped stanzas) or Cudf_types.typed_value stanza
(for typed stanzas).
exception Parse_error_822 of string * Lexing.position * Lexing.position
Error while parsing RFC822-like syntax of CUDF documents.
arguments: error message and file range, respectively.
exception Syntax_error of string * Lexing.position * Lexing.position
Syntax error while parsing some literal value
arguments: error message and file range, respectively
exception Type_error of typ * typed_value * Lexing.position * Lexing.position
Type error: mismatch between typed value and expected type
arguments: expected type, found value
val is_eq_formula : vpkgformula -> bool
Check whether a formula uses only equality tests over package versions.