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.

positive or null integer

Trimmed string

Command arguments, i.e. strings or idents

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

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

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

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

Arguments in commands (term + optional filter)

Dependency constraints mixed with filters

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

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 ] -> (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

Sourceval formula_items : name:string -> [< `Conj | `Disj ] -> ?only:[ `And | `Or ] -> (OpamParserTypes.FullPos.value, 'a) OpamPp.t -> (OpamParserTypes.FullPos.value list, 'b) OpamPp.t -> (OpamParserTypes.FullPos.value list, ('a * 'b) OpamFormula.formula) OpamPp.t

Generic package_formula_items pp

Environment variable updates syntax

OCaml

Innovation. Community. Security.