Module OpamFormat.V

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

positive or null integer

val string : (OpamParserTypes.FullPos.value, string) OpamPp.t
val string_tr : (OpamParserTypes.FullPos.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}"

val map_list : ?depth:int -> (OpamParserTypes.FullPos.value'a) OpamPp.t -> (OpamParserTypes.FullPos.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

Maps on the two terms of an option constructor.

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

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

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

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

Specialised url parser when the backend is already known

val compiler_version : (OpamParserTypes.FullPos.value, string) OpamPp.t
val filter_ident : (OpamParserTypes.FullPos.valueOpamTypes.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

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

val package_formula : [< `Conj | `Disj ] -> (OpamParserTypes.FullPos.value list'a) OpamPp.t -> (OpamParserTypes.FullPos.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.

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

Like package_formula, but takes the list items directly

Environment variable updates syntax

val os_constraint : (OpamParserTypes.FullPos.value(bool * string) OpamFormula.formula) OpamPp.t