package sexp
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c0ad559a13c4eed11f25446016fc776ea147527d186d5b713fcc8d201d26ce6b
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.
val remove_field :
field:string ->
Core.Sexp.t ->
[ `Immediate | `Recursive ] ->
Core.Sexp.t Core.Or_error.t
remove_field ~field sexp scope
removes the field if it exists in the designated scope. If `Recursive is chosen, it will replace as many instances as appear. It will not error if the field is not in scope