package sexp

  1. Overview
  2. Docs

Module Sexp_app.UtilsSource

Sourceval simple_query : Syntax.Query.t -> Core.Sexp.t -> Core.Sexp.t list
Sourceval get_fields : Core.Sexp.t -> string -> Core.Sexp.t list

get_fields sexp field searches for field recursively

Sourceval 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.

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.

Sourceval 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.

Sourceval 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.

Sourceval 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.

Sourceval 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

OCaml

Innovation. Community. Security.