package sexp

  1. Overview
  2. Docs
val simple_query : Syntax.Query.t -> Core.Sexp.t -> Core.Sexp.t list
val get_fields : Core.Sexp.t -> string -> Core.Sexp.t list

get_fields sexp field searches for field recursively

val get_one_field : Core.Sexp.t -> string -> Core.Sexp.t Core.Or_error.t

get_one_field sexp field searches for field recursively and returns the value, or error if there is not exactly one result.

val immediate_fields : Core.Sexp.t -> (string, Core.Sexp.t) Core.List.Assoc.t Core.Or_error.t

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.

val to_record_sexp : (string, Core.Sexp.t) Core.List.Assoc.t -> Core.Sexp.t

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.