package opam-lib
Install
dune-project
Dependency
Authors
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
AAnil Madhavapeddy <anil@recoil.org>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
Maintainers
Sources
sha256=625767c3465219cc8799aad1449c74279b31686db0821300cfdb92fbff17e9fd
md5=e0688c0cf9a55f93ee93f62d07cf6b74
doc/opam-lib.format/OpamFormat/index.html
Module OpamFormat
Format of OPAM configuration files.
val empty : OpamTypes.fileThe empty file
val map :
(string -> OpamTypes.value -> (string * OpamTypes.value) option) ->
OpamTypes.file ->
OpamTypes.filemap a file
val variables : OpamTypes.file_item list -> (string * OpamTypes.value) listGet all the variable definitions from a list of items
val sections :
OpamTypes.file_item list ->
(string * OpamTypes.file_section) listGet all the sections from a list of items
val is_valid :
?allow_extended:bool ->
OpamTypes.file_item list ->
string list ->
boolCheck whether a list of items contains only valid variable definitions.
val invalid_fields :
?allow_extended:bool ->
OpamTypes.file_item list ->
string list ->
string listFind all the invalid fields. If allow_extended is specified and true, fields starting with "x-" are not reported
Parsing functions
exception Bad_format of OpamTypes.pos option * string list * stringAll the following parsing function raise Bad_format in case the input does not have the right format.
val bad_format : ?pos:OpamTypes.pos -> ('a, unit, string, 'b) format4 -> 'aRaise Bad_format.
val string_of_bad_format : ?file:OpamTypes.filename -> exn -> stringval add_pos : OpamTypes.pos -> exn -> exnAdds a position to a Bad_format exception if it doesn't have one yet
val value_pos : OpamTypes.value -> OpamTypes.posGet the position out of a value
val values_pos : OpamTypes.value list -> OpamTypes.pos optionGet the position of the first element out of a value list
val parse_bool : OpamTypes.value -> boolParse a boolean
val parse_int : OpamTypes.value -> intParse an integer
val parse_ident : OpamTypes.value -> stringParse an ident
val parse_string : OpamTypes.value -> stringParse a string
val parse_list : (OpamTypes.value -> 'a) -> OpamTypes.value -> 'a listParse a list of 'things'
val parse_list_list : (OpamTypes.value -> 'a) -> OpamTypes.value -> 'a listParse a list of list of 'things'
val parse_group : (OpamTypes.value -> 'a) -> OpamTypes.value -> 'a listParse a group of 'things'
val parse_option :
(OpamTypes.value -> 'a) ->
(OpamTypes.value list -> 'b) ->
OpamTypes.value ->
'a * 'b optionParse a value and its option of 'things'
val parse_single_option :
(OpamTypes.value -> 'a) ->
(OpamTypes.value -> 'b) ->
OpamTypes.value ->
'a * 'b optionParse a value and a single optional value
val parse_string_option :
(OpamTypes.value list -> 'a) ->
OpamTypes.value ->
string * 'a optionParse a string with an optional argument
val parse_string_list : OpamTypes.value -> string listParse a list of strings
val parse_single_string : OpamTypes.value list -> stringParse a single string
val parse_pair :
(OpamTypes.value -> 'a) ->
(OpamTypes.value -> 'b) ->
OpamTypes.value ->
'a * 'bParse a pair of strings
val parse_or : (string * (OpamTypes.value -> 'a)) list -> OpamTypes.value -> 'aTry to parse the value using function from the list. All the parsing functions are tried until one succeeds. The first argument is a debug message.
Creation functions
val make_bool : bool -> OpamTypes.valueCreate a boolean
val make_int : int -> OpamTypes.valueCreate an integer
val make_ident : string -> OpamTypes.valueCreate an ident
val make_string : string -> OpamTypes.valueCreate a string
val make_list : ('a -> OpamTypes.value) -> 'a list -> OpamTypes.valueCreate a list of 'things'
val make_string_list : string list -> OpamTypes.valueCreate a list of strings
val make_group : ('a -> OpamTypes.value) -> 'a list -> OpamTypes.valueCreate a group of 'things'
val make_option :
('a -> OpamTypes.value) ->
('b -> OpamTypes.value list) ->
('a * 'b option) ->
OpamTypes.valueCreate a value and its optional arguments
val make_pair :
('a -> OpamTypes.value) ->
('b -> OpamTypes.value) ->
('a * 'b) ->
OpamTypes.valueCreate a pair
val make_string_pair : (string * string) -> OpamTypes.valueCreate a pair of strings
val make_section : OpamTypes.file_section -> OpamTypes.file_itemCreate a file section
val make_variable : (string * OpamTypes.value) -> OpamTypes.file_itemCreate a variable
Printing functions
val string_of_value : OpamTypes.value -> stringPrint a value
val string_of_values : OpamTypes.value list -> stringPrint a list of values
val string_of_file : simplify:bool -> OpamTypes.file -> stringPrint a file
Finding functions
val assoc : OpamTypes.file_item list -> string -> (OpamTypes.value -> 'a) -> 'aGet the value of a field
val assoc_option :
OpamTypes.file_item list ->
string ->
(OpamTypes.value -> 'a) ->
'a optionGet the value of a field. If the field does not exist, return None
val assoc_default :
'a ->
OpamTypes.file_item list ->
string ->
(OpamTypes.value -> 'a) ->
'aGet the value of a field. If the variable does not exist, return a default value
val assoc_list :
OpamTypes.file_item list ->
string ->
(OpamTypes.value -> 'a list) ->
'a listGet the value associated to a variable. If the variable does not exists, return
val assoc_string_list : OpamTypes.file_item list -> string -> string listGet the string list associated to a variable. If the variable does not exist, return
val get_section_by_kind :
OpamTypes.file_item list ->
string ->
OpamTypes.file_sectionGet one section of a certain kind
val get_all_section_by_kind :
OpamTypes.file_item list ->
string ->
OpamTypes.file_section listGet all the sections of a certain kind
val assoc_sections :
OpamTypes.file_item list ->
string ->
(OpamTypes.file_section -> 'a) ->
'a listGet sections
Formula
This section is dedicated to the parsing and creatin of dependency and conflict formaulas. It's maybe easier to do that directly in the parser ...
val parse_package_name :
?expected:OpamTypes.name ->
OpamTypes.value ->
OpamTypes.nameval parse_package_version :
?expected:OpamTypes.version ->
OpamTypes.value ->
OpamTypes.versionval parse_constraints : OpamTypes.value list -> OpamFormula.version_formulaParser for version constraints in formulas
val parse_ext_constraints :
OpamTypes.value list ->
OpamTypes.package_dep_flag list * OpamFormula.version_formulaParser for version constraints in formula with dependency flags
val make_constraints : OpamFormula.version_formula -> OpamTypes.value listBuilder for version constraints in formulas
val make_ext_constraints :
(OpamTypes.package_dep_flag list * OpamFormula.version_formula) ->
OpamTypes.value listBuilder for version constraints in formula with dependency flags
val parse_formula :
[ `Conj | `Disj ] ->
(OpamTypes.value list -> 'a) ->
OpamTypes.value ->
(OpamTypes.name * 'a) OpamTypes.generic_formulaParse package formula as a `Conjunction or `Disjunction, using the given parser for constraints
val make_formula :
[ `Conj | `Disj ] ->
('a -> OpamTypes.value list) ->
(OpamTypes.name * 'a) OpamTypes.generic_formula ->
OpamTypes.valueBuild a formula as a `Conjunction or `Disjunction, building constraints with the given function
val parse_compiler_version : OpamTypes.value -> OpamTypes.compiler_versionParse compiler versions
val parse_compiler_constraint :
OpamTypes.value ->
OpamTypes.compiler_constraintParse compiler constraints
val make_compiler_constraint : OpamTypes.compiler_constraint -> OpamTypes.valueBuild a compiler constraint
val parse_os_constraint :
OpamTypes.value ->
(bool * string) OpamTypes.generic_formulaParse an OS constraint
val make_os_constraint :
(bool * string) OpamTypes.generic_formula ->
OpamTypes.valueBuild an OS constraint
Environment variables
val parse_env_variable : OpamTypes.value -> string * string * stringParsing
val make_env_variable : (string * string * string) -> OpamTypes.valueMaking
filter expressions
val parse_filter : OpamTypes.value list -> OpamTypes.filterParsing
val make_filter : OpamTypes.filter -> OpamTypes.value listCreation
val parse_single_command : OpamTypes.value -> OpamTypes.arg listUnfiltered argument list
val make_single_command : OpamTypes.arg list -> OpamTypes.valueval parse_command : OpamTypes.value -> OpamTypes.commandParse a command
val make_command : OpamTypes.command -> OpamTypes.valueCreate a command
val parse_commands : OpamTypes.value -> OpamTypes.command listParse a list of commands
val make_commands : OpamTypes.command list -> OpamTypes.valueCreate a list of commands
val parse_messages : OpamTypes.value -> (string * OpamTypes.filter option) listParse a list of commands
val make_libraries : (string * OpamTypes.filter option) list -> OpamTypes.valueCreate a list of libraries/syntax
val parse_libraries :
OpamTypes.value ->
(string * OpamTypes.filter option) listParse a list of libraries/syntax
val make_flag : OpamTypes.package_flag -> OpamTypes.valueCreate a package flag
val parse_flag : OpamTypes.value -> OpamTypes.package_flagParse a package flag
Tags
val parse_tags : OpamTypes.value -> OpamTypes.tagsParse tags
val make_tags : OpamTypes.tags -> OpamTypes.valueMake tags
Features
val parse_features :
OpamTypes.value ->
(OpamVariable.t * string * OpamTypes.filter) listParse features list
val make_features :
(OpamVariable.t * string * OpamTypes.filter) list ->
OpamTypes.valueMake features list