module Cudf_types:sig
..end
Implement core CUDF types (see CUDF spec. ยง2.2.2).
For parsing and pretty printing of CUDF types see Cudf_types_pp
.
typeversion =
int
typerelop =
[ `Eq | `Geq | `Gt | `Leq | `Lt | `Neq ]
typeconstr =
(relop * version) option
typepkgname =
string
typevpkg =
pkgname * constr
typevpkglist =
vpkg list
typeenum_keep =
[ `Keep_feature | `Keep_none | `Keep_package | `Keep_version ]
typevpkgformula =
vpkg list list
[ foo ] ; [ bar ; baz ]
[]
typeveqpkg =
pkgname * ([ `Eq ] * version) option
typeveqpkglist =
veqpkg list
typetyp =
[ `Bool
| `Enum of string list
| `Ident
| `Int
| `Nat
| `Pkgname
| `Posint
| `String
| `Typedecl
| `Veqpkg
| `Veqpkglist
| `Vpkg
| `Vpkgformula
| `Vpkglist ]
val keep_type : typ
val keep_enums : string list
typetypedecl1 =
[ `Bool of bool option
| `Enum of string list * string option
| `Ident of string option
| `Int of int option
| `Nat of int option
| `Pkgname of string option
| `Posint of int option
| `String of string option
| `Typedecl of typedecl option
| `Veqpkg of veqpkg option
| `Veqpkglist of veqpkglist option
| `Vpkg of vpkg option
| `Vpkgformula of vpkgformula option
| `Vpkglist of vpkglist option ]
typetypedecl =
(string * typedecl1) list
typetyped_value =
[ `Bool of bool
| `Enum of string list * string
| `Ident of string
| `Int of int
| `Nat of int
| `Pkgname of string
| `Posint of int
| `String of string
| `Typedecl of typedecl
| `Veqpkg of veqpkg
| `Veqpkglist of veqpkglist
| `Vpkg of vpkg
| `Vpkgformula of vpkgformula
| `Vpkglist of vpkglist ]
val type_of_typedecl : typedecl1 -> typ
val typedecl_of_value : typed_value -> typedecl1
val value_of_typedecl : typedecl1 -> typed_value option
None
)val typedecl_of_type : typ -> typedecl1
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.Type_error
if casting is not possible
Types used in parsing, before values are injected into the CUDF type
system.
type'ty
stanza =(string * 'ty) list
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 * loc
arguments: error message and file range, respectively.
exception Syntax_error of string * loc
arguments: error message and file range, respectively
exception Type_error of typ * typed_value * loc
arguments: expected type, found value
val is_eq_formula : vpkgformula -> bool