package sexp
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=bde6acfd2814bcc38a0d3cacb42e513d8932595152dd9798419559fb0e026f4e
doc/sexp.sexp_app/Sexp_app/Utils/index.html
Module Sexp_app.Utils
Source
get_fields sexp field
searches for field recursively
get_one_field sexp field
searches for field recursively and returns the value, or error if there is not exactly one result.
get_immediate_fields sexp
returns an association list of field names to field values, or error if the sexp does not conform to the normal structure of an ocaml record.
to_record_sexp by_field
converts an association list of field names to field values into a record-like sexp.
val sexp_rewrite :
Core.Sexp.t ->
f:(Core.Sexp.t -> [ `Unchanged | `Changed of Core.Sexp.t ]) ->
Core.Sexp.t
sexp_rewrite sexp ~f
returns the rewritten sexp where f is applied to sexp and its descendents.
val replace_field :
field:string ->
value:Core.Sexp.t ->
Core.Sexp.t ->
[ `Immediate | `Recursive ] ->
Core.Sexp.t Core.Or_error.t
replace_field ~field ~value sexp scope
replaces either the field with the given value, or returns an error if no match is found in the designated scope. If `Recursive is chosen, it will replace as many instances as appear, or error if none are found.