package cudf

  1. Overview
  2. Docs

Module Cudf_types_ppSource

CUDF type library: parsing and pretty printing

Implement parsing and pretty printing of CUDF types (see CUDF spec. §2.2.2).

For the actual CUDF type definition see Cudf_types.

For pretty printing of macro-components see Cudf_printer.

Errors
Parsers
Public types

All parsing function are granted to raise only Cudf_types_pp.Type_error, lower lever exception (e.g. syntax errors) are wrapped into it

Sourceval parse_int : string -> int
Sourceval parse_posint : string -> int
Sourceval parse_nat : string -> int
Sourceval parse_bool : string -> bool
Sourceval parse_string : string -> string
Sourceval parse_pkgname : string -> Cudf_types.pkgname
Sourceval parse_ident : string -> string
Sourceval parse_enum : enums:string list -> string -> string
Sourceval parse_vpkg : string -> Cudf_types.vpkg
Sourceval parse_vpkglist : string -> Cudf_types.vpkglist
Sourceval parse_vpkgformula : string -> Cudf_types.vpkgformula
Sourceval parse_veqpkg : string -> Cudf_types.veqpkg
Sourceval parse_veqpkglist : string -> Cudf_types.veqpkglist
Sourceval parse_typedecl : string -> Cudf_types.typedecl
Parsing of other CUDF entities

Mostly for application relying on CUDF conventions

Sourceval parse_qstring : string -> string

Parse a quoted string, enclosed by double quotes as it happens within the "property" property of preamble stanzas. The only place where such strings are allowed in CUDF are within type declarations; see Cudf_types_pp.parse_typedecl.

  • returns

    the parsed string after having resolved escaping and removed surrounding double quotes

Sourceval parse_type : string -> Cudf_types.typ

Parse a CUDF type expression.

At present it can be either a typename or an enum with its values.

Sourceval parse_keep : string -> Cudf_types.enum_keep

Parse the enum value corresponding to the "keep" core property of package stanzas. Shorthand to avoid parsing the corresponding `Enum and then casting to Cudf_types.enum_keep

Sourceval parse_value : Cudf_types.typ -> string -> Cudf_types.typed_value

generic, type-based parsing

Pretty printers
Pretty print to string
Sourceval string_of_int : int -> string
Sourceval string_of_posint : int -> string
Sourceval string_of_nat : int -> string
Sourceval string_of_bool : bool -> string
Sourceval string_of_keep : Cudf_types.enum_keep -> string
Sourceval string_of_pkgname : Cudf_types.pkgname -> string
Sourceval string_of_version : Cudf_types.version -> string
Sourceval string_of_vpkg : Cudf_types.vpkg -> string
Sourceval string_of_vpkglist : Cudf_types.vpkglist -> string
Sourceval string_of_vpkgformula : Cudf_types.vpkgformula -> string
Sourceval string_of_veqpkg : Cudf_types.veqpkg -> string
Sourceval string_of_veqpkglist : Cudf_types.veqpkglist -> string
Sourceval string_of_typedecl : Cudf_types.typedecl -> string
Sourceval string_of_type : Cudf_types.typ -> string
Sourceval string_of_value : Cudf_types.typed_value -> string
OCaml

Innovation. Community. Security.