package opam-format

  1. Overview
  2. Docs

Module OpamFormat.VSource

These base converters raise Unexpected when not run on the right input (which is then converted to Bad_format by the parser.

Sourceval bool : (OpamTypes.value, bool) OpamPp.t
Sourceval pos_int : (OpamTypes.value, int) OpamPp.t

positive or null integer

Sourceval ident : (OpamTypes.value, string) OpamPp.t
Sourceval string : (OpamTypes.value, string) OpamPp.t
Sourceval string_tr : (OpamTypes.value, string) OpamPp.t

Trimmed string

Command arguments, i.e. strings or idents

Strings or bools

"a b c"; also allows just "a" to be parsed as a singleton list

"(a b c)"

Options in the value type sense, i.e. a value with an optional list of parameters in braces: "value op1 op2"

Sourceval map_group : (OpamTypes.value, 'a) OpamPp.t -> (OpamTypes.value, 'a list) OpamPp.t
Sourceval map_list : ?depth:int -> (OpamTypes.value, 'a) OpamPp.t -> (OpamTypes.value, 'a list) OpamPp.t

An expected list depth may be specified to enable removal of extra brackets (never use ~depth for an inner list)

Normalises to the given list depth when parsing, and removes brackets that can be made implicit when printing

Sourceval map_option : (OpamTypes.value, 'a) OpamPp.t -> (OpamTypes.value list, 'b) OpamPp.t -> (OpamTypes.value, 'a * 'b) OpamPp.t

Maps on the two terms of an option constructor.

Sourceval map_options_2 : (OpamTypes.value, 'a) OpamPp.t -> (OpamTypes.value list, 'b) OpamPp.t -> (OpamTypes.value list, 'c) OpamPp.t -> (OpamTypes.value, 'a * 'b * 'c) OpamPp.t

Maps over two options (e.g. v {op1} {op2})

Sourceval map_options_3 : (OpamTypes.value, 'a) OpamPp.t -> (OpamTypes.value list, 'b) OpamPp.t -> (OpamTypes.value list, 'c) OpamPp.t -> (OpamTypes.value list, 'd) OpamPp.t -> (OpamTypes.value, 'a * 'b * 'c * 'd) OpamPp.t

Maps over three options (e.g. v {op1} {op2} {op3})

A pair is simply a list with two elements in the value type

Sourceval map_triple : (OpamTypes.value, 'a) OpamPp.t -> (OpamTypes.value, 'b) OpamPp.t -> (OpamTypes.value, 'c) OpamPp.t -> (OpamTypes.value, 'a * 'b * 'c) OpamPp.t

A triple is simply a list with three elements in the value type

Specialised url parser when the backend is already known

Sourceval compiler_version : (OpamTypes.value, string) OpamPp.t
Sourceval filter_ident : (OpamTypes.value, OpamTypes.name option list * OpamTypes.variable * (string * string) option) OpamPp.t

Arguments in commands (term + optional filter)

Simple dependency constraints

Dependency constraints mixed with filters

Package versions

Package versions as filters, as they may appear in dependency (may be an expanded string or an ident)

A package name, encoded as a string, but with restrictions

Sourceval package_atom : (OpamTypes.value list, 'a) OpamPp.t -> (OpamTypes.value, OpamTypes.name * 'a) OpamPp.t

Returns an atom parser ("package" {>= "version"}) from a constraint and a version parser

Sourceval package_formula : [< `Conj | `Disj ] -> (OpamTypes.value list, 'a) OpamPp.t -> (OpamTypes.value, (OpamTypes.name * 'a) OpamFormula.formula) OpamPp.t

Takes a parser for constraints. Lists without operator will be understood as conjunctions or disjunctions depending on the first argument.

Sourceval package_formula_items : [< `Conj | `Disj ] -> (OpamTypes.value list, 'a) OpamPp.t -> (OpamTypes.value list, (OpamTypes.name * 'a) OpamFormula.formula) OpamPp.t

Like package_formula, but takes the list items directly

Environment variable updates syntax

Sourceval os_constraint : (OpamTypes.value, (bool * string) OpamFormula.formula) OpamPp.t
OCaml

Innovation. Community. Security.