package sexplib0

  1. Overview
  2. Docs
module Kind : sig ... end
module Fields : sig ... end
val record_of_sexp : caller:string -> fields:'a Fields.t -> index_of_field:(string -> int) -> allow_extra_fields:bool -> create:('a -> 'b) -> Sexp.t -> 'b

Parses a record from a sexp that must be a list of fields.

Uses caller as the source for error messages. Parses using the given fields. Uses index_of_field to look up field names found in sexps. If allow_extra_fields is true, extra fields are allowed and discarded without error. create is used to construct the final returned value.

val record_of_sexps : caller:string -> context:Sexp.t -> fields:'a Fields.t -> index_of_field:(string -> int) -> allow_extra_fields:bool -> create:('a -> 'b) -> Sexp.t list -> 'b

Like record_of_sexp, but for a list of sexps with no List wrapper. Used, for example, to parse arguments to a variant constructor with an inlined record argument. Reports context for parse errors when no more specific sexp is applicable.