Module OpamFormat.I
val file : (OpamTypes.opamfile, OpamTypes.filename * OpamTypes.opamfile_item list) OpamPp.tval map_file : (OpamTypes.opamfile_item list, 'a) OpamPp.t -> (OpamTypes.opamfile, OpamTypes.filename * 'a) OpamPp.tval item : (OpamTypes.opamfile_item, string * OpamTypes.value) OpamPp.tval items : (OpamTypes.opamfile_item list, (string * OpamTypes.value) list) OpamPp.tval anonymous_section : ('a, 'b) OpamPp.t -> ((string option * 'a) list, 'b) OpamPp.tSuitable for the
fieldssectionsargument, when the sections are anonymous (section_name = None)
type ('a, 'value) fields_def= (string * ('a, 'value) OpamPp.field_parser) list
val fields : ?name:string -> empty:'a -> ?sections:('a, (string option * OpamTypes.opamfile_item list) list) fields_def -> ?mandatory_fields:string list -> ('a, OpamTypes.value) fields_def -> (OpamTypes.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_formatlist. 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 raisesBad_format_listifstrict, and otherwise prints warnings for all the errors. The errors are then dropped when parsing, and initialised to empty when printing.strictis taken from the global settings if unspecified.conditionmay be added to only show the errors when it returnstrue, 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 : (string -> bool) -> (OpamTypes.opamfile_item list, OpamTypes.opamfile_item list * OpamTypes.opamfile_item list) OpamPp.tPartitions items in an opamfile base on a condition on the variable names
val partition : (OpamTypes.opamfile_item -> bool) -> (OpamTypes.opamfile_item list, OpamTypes.opamfile_item list * OpamTypes.opamfile_item list) OpamPp.tPartitions items in an opamfile base on a generic condition on the items
val field : string -> (pos:OpamTypes.pos -> OpamTypes.value -> 'a) -> (OpamTypes.opamfile_item list, 'a option * OpamTypes.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 -> (OpamTypes.opamfile_item, string option * OpamTypes.opamfile_item list) OpamPp.tParse a single section with the given "kind", towards its name and contents
val extract_field : string -> (OpamTypes.opamfile_item list, OpamTypes.value option * OpamTypes.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 -> ?f:(OpamTypes.opam_version -> bool) -> unit -> (OpamTypes.opamfile_item list, OpamTypes.opamfile_item list) OpamPp.tChecks the
opam_versionfield; otherwise the identity
type signature= string * string * stringA signature is a keyid, an algorithm and the signature proper
val signature : (OpamTypes.value, signature) OpamPp.t
exceptionInvalid_signature of OpamTypes.pos * (string * string * string) list option
val signed : check:(signature list -> string -> bool) -> (OpamTypes.opamfile_item list, signature list * OpamTypes.opamfile_item list) OpamPp.tPp for signed files. Will assert fail if attempting to write a file with an invalid signature.