Code for managing s-expressions.
include sig ... endval bin_t : t Bin_prot.Type_class.tval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (Core_kernel__.Import.int ‑> t) Bin_prot.Read.readerval bin_reader_t : t Bin_prot.Type_class.readerval bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_writer_t : t Bin_prot.Type_class.writerval bin_shape_t : Bin_prot.Shape.tval hash_fold_t : Base.Hash.state ‑> t ‑> Base.Hash.stateval hash : t ‑> Base.Hash.hash_valueval t_of_sexp : Base.Sexp.t ‑> tval sexp_of_t : t ‑> Base.Sexp.tmodule O : sig ... endinclude Core_kernel.Comparable.S with type t := tinclude Core_kernel__.Comparable_intf.S_commoninclude Base.Comparable.Sinclude Base__.Comparable_intf.Polymorphic_compareascending is identical to compare. descending x y = ascending y x. These are
intended to be mnemonic when used like List.sort ~compare:ascending and List.sort
~cmp:descending, since they cause the list to be sorted in ascending or descending
order, respectively.
clamp_exn t ~min ~max returns t', the closest value to t such that
between t' ~low:min ~high:max is true.
Raises if not (min <= max).
val clamp : t ‑> min:t ‑> max:t ‑> t Base.Or_error.tinclude Base.Comparator.S with type t := tval comparator : (t, comparator_witness) Base.Comparator.comparatorinclude Base__.Comparable_intf.Validate with type t := tval validate_lbound : min:t Base.Maybe_bound.t ‑> t Base.Validate.checkval validate_ubound : max:t Base.Maybe_bound.t ‑> t Base.Validate.checkval validate_bound : min:t Base.Maybe_bound.t ‑> max:t Base.Maybe_bound.t ‑> t Base.Validate.checkmodule Replace_polymorphic_compare : Core_kernel__.Comparable_intf.Polymorphic_compare with type t := tmodule Map : Core_kernel.Map.S with type Key.t = t with type Key.comparator_witness = comparator_witnessmodule Set : Core_kernel.Set.S with type Elt.t = t with type Elt.comparator_witness = comparator_witnessinclude Core_kernel__.Import.Stringable.S with type t := tval of_string : string ‑> tval to_string : t ‑> stringinclude module type of sig ... end with type t := tval size : t ‑> int * intval scan_sexp : ?buf:Buffer.t ‑> Lexing.lexbuf ‑> tval scan_sexps : ?buf:Buffer.t ‑> Lexing.lexbuf ‑> t listval scan_rev_sexps : ?buf:Buffer.t ‑> Lexing.lexbuf ‑> t listval scan_sexp_opt : ?buf:Buffer.t ‑> Lexing.lexbuf ‑> t optionval scan_iter_sexps : ?buf:Buffer.t ‑> f:(t ‑> unit) ‑> Lexing.lexbuf ‑> unitval scan_fold_sexps : ?buf:Buffer.t ‑> f:('a ‑> t ‑> 'a) ‑> init:'a ‑> Lexing.lexbuf ‑> 'aval scan_sexps_conv : ?buf:Buffer.t ‑> f:(t ‑> 'a) ‑> Lexing.lexbuf ‑> 'a listmodule Parse_pos = Sexplib__Sexp.Parse_posmodule Cont_state = Sexplib__Sexp.Cont_statetype ('a, 't) parse_result = ('a, 't) Sexplib.Pre_sexp.parse_result = | Done of 't * Parse_pos.t |
| Cont of Cont_state.t * ('a, 't) parse_fun |
module Annotated = Sexplib__Sexp.Annotatedtype parse_error = Sexplib.Pre_sexp.parse_error = {err_msg : string; |
parse_state : [ `Annot of Annotated.stack parse_state | `Sexp of t list list parse_state ]; |
}exception Parse_error of parse_errorval parse : ?parse_pos:Parse_pos.t ‑> ?len:int ‑> string ‑> (string, t) parse_resultval parse_bigstring : ?parse_pos:Parse_pos.t ‑> ?len:int ‑> bigstring ‑> (bigstring, t) parse_resultval input_sexp : ?parse_pos:Parse_pos.t ‑> Pervasives.in_channel ‑> tval input_sexps : ?parse_pos:Parse_pos.t ‑> ?buf:bytes ‑> Pervasives.in_channel ‑> t listval input_rev_sexps : ?parse_pos:Parse_pos.t ‑> ?buf:bytes ‑> Pervasives.in_channel ‑> t listval load_sexp : ?strict:bool ‑> ?buf:bytes ‑> string ‑> tval load_sexps : ?buf:bytes ‑> string ‑> t listval load_rev_sexps : ?buf:bytes ‑> string ‑> t listval load_sexp_conv : ?strict:bool ‑> ?buf:bytes ‑> string ‑> (t ‑> 'a) ‑> 'a Annotated.convval load_sexp_conv_exn : ?strict:bool ‑> ?buf:bytes ‑> string ‑> (t ‑> 'a) ‑> 'aval load_sexps_conv : ?buf:bytes ‑> string ‑> (t ‑> 'a) ‑> 'a Annotated.conv listval load_sexps_conv_exn : ?buf:bytes ‑> string ‑> (t ‑> 'a) ‑> 'a listval output_hum : Pervasives.out_channel ‑> t ‑> unitval output_hum_indent : int ‑> Pervasives.out_channel ‑> t ‑> unitval output_mach : Pervasives.out_channel ‑> t ‑> unitval output : Pervasives.out_channel ‑> t ‑> unitval save_hum : ?perm:int ‑> string ‑> t ‑> unitval save_mach : ?perm:int ‑> string ‑> t ‑> unitval save : ?perm:int ‑> string ‑> t ‑> unitval save_sexps_hum : ?perm:int ‑> string ‑> t list ‑> unitval save_sexps_mach : ?perm:int ‑> string ‑> t list ‑> unitval save_sexps : ?perm:int ‑> string ‑> t list ‑> unitval pp_hum : Format.formatter ‑> t ‑> unitval pp_hum_indent : int ‑> Format.formatter ‑> t ‑> unitval pp_mach : Format.formatter ‑> t ‑> unitval pp : Format.formatter ‑> t ‑> unitval of_string : string ‑> tval of_string_conv : string ‑> (t ‑> 'a) ‑> 'a Annotated.convval of_string_conv_exn : string ‑> (t ‑> 'a) ‑> 'aval of_bigstring_conv : bigstring ‑> (t ‑> 'a) ‑> 'a Annotated.convval to_string_hum : ?indent:int ‑> t ‑> stringval to_string_mach : t ‑> stringval to_string : t ‑> stringval to_buffer_hum : buf:Buffer.t ‑> ?indent:int ‑> t ‑> unitval to_buffer_mach : buf:Buffer.t ‑> t ‑> unitval to_buffer : buf:Buffer.t ‑> t ‑> unitval to_buffer_gen : buf:'buffer ‑> add_char:('buffer ‑> char ‑> unit) ‑> add_string:('buffer ‑> string ‑> unit) ‑> t ‑> unitval unit : tval is_unit : t ‑> boolval search_physical : t ‑> contained:t ‑> search_resultmodule With_layout = Sexplib__Sexp.With_layoutexception Of_sexp_error of Core_kernel__.Import.exn * tval of_float_style : [ `Underscores | `No_underscores ] Core_kernel__.Import.refval of_int_style : [ `Underscores | `No_underscores ] Core_kernel__.Import.reftype 'a no_raise = 'ano_raise is the identity, but by using 'a no_raise in a sexpable type, the
resulting use sexp_of_no_raise protects the conversion of 'a to a sexp so that if
it fails, one gets a sexp with an error message about the failure, rather than an
exception being raised.
WARNING: The resulting no_raise_of_sexp can still raise.
include sig ... endval bin_no_raise : 'a Bin_prot.Type_class.t ‑> 'a no_raise Bin_prot.Type_class.tval bin_read_no_raise : 'a Bin_prot.Read.reader ‑> 'a no_raise Bin_prot.Read.readerval __bin_read_no_raise__ : 'a Bin_prot.Read.reader ‑> (Core_kernel__.Import.int ‑> 'a no_raise) Bin_prot.Read.readerval bin_reader_no_raise : 'a Bin_prot.Type_class.reader ‑> 'a no_raise Bin_prot.Type_class.readerval bin_size_no_raise : 'a Bin_prot.Size.sizer ‑> 'a no_raise Bin_prot.Size.sizerval bin_write_no_raise : 'a Bin_prot.Write.writer ‑> 'a no_raise Bin_prot.Write.writerval bin_writer_no_raise : 'a Bin_prot.Type_class.writer ‑> 'a no_raise Bin_prot.Type_class.writerval bin_shape_no_raise : Bin_prot.Shape.t ‑> Bin_prot.Shape.tval no_raise_of_sexp : (Base.Sexp.t ‑> 'a) ‑> Base.Sexp.t ‑> 'a no_raiseval sexp_of_no_raise : ('a ‑> Base.Sexp.t) ‑> 'a no_raise ‑> Base.Sexp.tmodule Sexp_maybe : sig ... endIf sexp_of_t fails, it returns Error rather than raising. You can convert values
of this type to and from sexp in processes that can or cannot parse the underlying
sexp in any combination and still recover the original value. Also, the Error case
contains a human-readable description of the error.
module With_text : sig ... endA With_text.t is a value paired with the full textual representation of its sexp.
This is useful for dealing with the case where you want to keep track of a value along
with the format of the s-expression it was generated from, which allows you to
maintain formatting details, comments, etc.
val of_sexp_allow_extra_fields : (Base.Sexp.t ‑> 'a) ‑> Base.Sexp.t ‑> 'aof_sexp_allow_extra_fields of_sexp sexp uses of_sexp to convert sexp to a
value, but will not fail if there are any extra fields in a record (even deeply
nested records).
The implementation uses global state, so it is not thread safe.