OpamFormat.Ival file : (OpamParserTypes.FullPos.opamfile, OpamTypes.filename * OpamParserTypes.FullPos.opamfile_item list) OpamPp.tval map_file : (OpamParserTypes.FullPos.opamfile_item list, 'a) OpamPp.t -> (OpamParserTypes.FullPos.opamfile, OpamTypes.filename * 'a) OpamPp.tval item : (OpamParserTypes.FullPos.opamfile_item, string * OpamParserTypes.FullPos.value) OpamPp.tval items : (OpamParserTypes.FullPos.opamfile_item list, (string * OpamParserTypes.FullPos.value) list) OpamPp.tSuitable for the fields sections argument, when the sections are anonymous (section_name = None)
type ('a, 'value) fields_def = (string * ('a, 'value) OpamPp.field_parser) listval fields : ?name:string -> empty:'a ->
?sections:('a, (string option * OpamParserTypes.FullPos.opamfile_item list) list) fields_def -> ?mandatory_fields:string list
-> ('a, OpamParserTypes.FullPos.value) fields_def -> (OpamParserTypes.FullPos.opamfile_item list, 'a * (string * OpamPp.bad_format) list) OpamPp.tParses an item list into a record using a fields_def; errors in a field cause the field to be ignored, and are aggregated into the returned field, bad_format list. Errors are ignored when printing back.
val show_errors : ?name:string -> ?strict:bool -> ?condition:('a -> bool) ->
unit -> ('a * (string * OpamPp.bad_format) list, 'a) OpamPp.tIntended to be piped after fields. If the errors list is non-empty, this raises Bad_format_list if strict, and otherwise prints warnings for all the errors. The errors are then dropped when parsing, and initialised to empty when printing. strict is taken from the global settings if unspecified. condition may be added to only show the errors when it returns true, and only log them otherwise.
val on_errors : ?name:string ->
('a -> (string * OpamPp.bad_format) -> 'a) -> ('a * (string * OpamPp.bad_format) list, 'a) OpamPp.tIntended to be piped after fields, this processes the given function on the errors, then drops them when parsing. When printing, just sets empty errors.
val partition_fields : ?section:bool ->
(string -> bool) -> (OpamParserTypes.FullPos.opamfile_item list, OpamParserTypes.FullPos.opamfile_item list * OpamParserTypes.FullPos.opamfile_item list) OpamPp.tPartitions items in an opamfile base on a condition on the variable names. If a section is encountered, it is kept in the second list (as filter returning false), unless section is true.
val partition : (OpamParserTypes.FullPos.opamfile_item -> bool) -> (OpamParserTypes.FullPos.opamfile_item list, OpamParserTypes.FullPos.opamfile_item list * OpamParserTypes.FullPos.opamfile_item list) OpamPp.tPartitions items in an opamfile base on a generic condition on the items
val field : string -> (pos:OpamParserTypes.FullPos.pos -> OpamParserTypes.FullPos.value -> 'a) -> (OpamParserTypes.FullPos.opamfile_item list, 'a option * OpamParserTypes.FullPos.opamfile_item list) OpamPp.tParse a single field from a file, return the result and the unchanged item list. The single field is ignored when printing back.
val section : string -> (OpamParserTypes.FullPos.opamfile_item, string option * OpamParserTypes.FullPos.opamfile_item list) OpamPp.tParse a single section with the given "kind", towards its name and contents
val extract_field : string -> (OpamParserTypes.FullPos.opamfile_item list, OpamParserTypes.FullPos.value option * OpamParserTypes.FullPos.opamfile_item list) OpamPp.tExtracts a single item with the given variable name from an item list. The item is removed from the returned item list, and the two are re-combined when printing
val check_opam_version : ?optional:bool -> format_version:OpamTypes.opam_version -> ?f:(OpamTypes.opam_version -> bool) ->
unit -> (OpamParserTypes.FullPos.opamfile_item list, OpamParserTypes.FullPos.opamfile_item list) OpamPp.tChecks the opam_version field; otherwise the identity
Signature handling (wip)
A signature is a keyid, an algorithm and the signature proper
val signature : (OpamParserTypes.FullPos.value, signature) OpamPp.texception Invalid_signature of OpamParserTypes.FullPos.pos * (string * string * string) list optionval signed : check:(signature list -> string -> bool) -> (OpamParserTypes.FullPos.opamfile_item list, signature list * OpamParserTypes.FullPos.opamfile_item list) OpamPp.tPp for signed files. Will assert fail if attempting to write a file with an invalid signature.