package core_extended

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Core.Sexp end
type t = Base.Sexp.t =
  1. | Atom of Base.String.t
  2. | List of t Base.List.t
include sig ... end
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (Base.Int.t -> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_shape_t : Bin_prot.Shape.t
val hash_fold_t : Ppx_hash_lib.Std.Hash.state -> t -> Ppx_hash_lib.Std.Hash.state
val hash : t -> Ppx_hash_lib.Std.Hash.hash_value
module O = Core.Sexp.O
include Core_kernel.Comparable.S with type t := t
include Base.Comparable_intf.S with type t := t
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val equal : t -> t -> bool
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
val clamp_exn : t -> min:t -> max:t -> t
val clamp : t -> min:t -> max:t -> t Base__.Or_error.t
type comparator_witness = Core.Sexp.comparator_witness
val comparator : (t, comparator_witness) Base__.Comparator.comparator
val validate_lbound : min:t Base__.Maybe_bound.t -> t Base__.Validate.check
val validate_ubound : max:t Base__.Maybe_bound.t -> t Base__.Validate.check
val validate_bound : min:t Base__.Maybe_bound.t -> max:t Base__.Maybe_bound.t -> t Base__.Validate.check
module Replace_polymorphic_compare = Core.Sexp.Replace_polymorphic_compare
module Map = Core.Sexp.Map
module Set = Core.Sexp.Set
include module type of struct include Sexplib.Sexp end with type t := t
type bigstring = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
val compare : t -> t -> int
val default_indent : int Pervasives.ref
val size : t -> int * int
val scan_sexp : ?buf:Buffer.t -> Lexing.lexbuf -> t
val scan_sexps : ?buf:Buffer.t -> Lexing.lexbuf -> t list
val scan_rev_sexps : ?buf:Buffer.t -> Lexing.lexbuf -> t list
val scan_sexp_opt : ?buf:Buffer.t -> Lexing.lexbuf -> t option
val scan_iter_sexps : ?buf:Buffer.t -> f:(t -> unit) -> Lexing.lexbuf -> unit
val scan_fold_sexps : ?buf:Buffer.t -> f:('a -> t -> 'a) -> init:'a -> Lexing.lexbuf -> 'a
val scan_sexps_conv : ?buf:Buffer.t -> f:(t -> 'a) -> Lexing.lexbuf -> 'a list
module Parse_pos = Core.Sexp.Parse_pos
module Cont_state = Core.Sexp.Cont_state
type (!'a, !'t) parse_result = ('a, 't) Sexplib.Pre_sexp.parse_result =
  1. | Done of 't * Parse_pos.t
  2. | Cont of Cont_state.t * ('a, 't) parse_fun
and (!'a, !'t) parse_fun = pos:int -> len:int -> 'a -> ('a, 't) parse_result
module Annotated = Core.Sexp.Annotated
type !'t parse_state = private 't Sexplib.Pre_sexp.parse_state = {
  1. parse_pos : Parse_pos.t;
  2. mutable pstack : 't;
  3. pbuf : Buffer.t;
}
type parse_error = Sexplib.Pre_sexp.parse_error = {
  1. location : string;
  2. err_msg : string;
  3. parse_state : [ `Annot of Annotated.stack parse_state | `Sexp of t list list parse_state ];
}
exception Parse_error of parse_error
val parse : ?parse_pos:Parse_pos.t -> ?len:int -> string -> (string, t) parse_result
val parse_bigstring : ?parse_pos:Parse_pos.t -> ?len:int -> bigstring -> (bigstring, t) parse_result
val input_sexp : ?parse_pos:Parse_pos.t -> Pervasives.in_channel -> t
val input_sexps : ?parse_pos:Parse_pos.t -> ?buf:bytes -> Pervasives.in_channel -> t list
val input_rev_sexps : ?parse_pos:Parse_pos.t -> ?buf:bytes -> Pervasives.in_channel -> t list
val load_sexp : ?strict:bool -> ?buf:bytes -> string -> t
val load_sexps : ?buf:bytes -> string -> t list
val load_rev_sexps : ?buf:bytes -> string -> t list
val load_sexp_conv : ?strict:bool -> ?buf:bytes -> string -> (t -> 'a) -> 'a Annotated.conv
val load_sexp_conv_exn : ?strict:bool -> ?buf:bytes -> string -> (t -> 'a) -> 'a
val load_sexps_conv : ?buf:bytes -> string -> (t -> 'a) -> 'a Annotated.conv list
val load_sexps_conv_exn : ?buf:bytes -> string -> (t -> 'a) -> 'a list
val output_hum : Pervasives.out_channel -> t -> unit
val output_hum_indent : int -> Pervasives.out_channel -> t -> unit
val output_mach : Pervasives.out_channel -> t -> unit
val output : Pervasives.out_channel -> t -> unit
val save_hum : ?perm:int -> string -> t -> unit
val save_mach : ?perm:int -> string -> t -> unit
val save : ?perm:int -> string -> t -> unit
val save_sexps_hum : ?perm:int -> string -> t list -> unit
val save_sexps_mach : ?perm:int -> string -> t list -> unit
val save_sexps : ?perm:int -> string -> t list -> unit
val pp_hum : Format.formatter -> t -> unit
val pp_hum_indent : int -> Format.formatter -> t -> unit
val pp_mach : Format.formatter -> t -> unit
val pp : Format.formatter -> t -> unit
module Of_string_conv_exn = Core.Sexp.Of_string_conv_exn
val of_string : string -> t
val of_string_conv : string -> (t -> 'a) -> 'a Annotated.conv
val of_string_conv_exn : string -> (t -> 'a) -> 'a
val of_bigstring : bigstring -> t
val of_bigstring_conv : bigstring -> (t -> 'a) -> 'a Annotated.conv
val of_bigstring_conv_exn : bigstring -> (t -> 'a) -> 'a
val to_string_hum : ?indent:int -> t -> string
val to_string_mach : t -> string
val to_string : t -> string
val to_buffer_hum : buf:Buffer.t -> ?indent:int -> t -> unit
val to_buffer_mach : buf:Buffer.t -> t -> unit
val to_buffer : buf:Buffer.t -> t -> unit
val to_buffer_gen : buf:'buffer -> add_char:('buffer -> char -> unit) -> add_string:('buffer -> string -> unit) -> t -> unit
val unit : t
val is_unit : t -> bool
val sexp_of_t : t -> t
val t_of_sexp : t -> t
type found = [
  1. | `Found
  2. | `Pos of int * found
]
type search_result = [
  1. | `Found
  2. | `Not_found
  3. | `Pos of int * found
]
val search_physical : t -> contained:t -> search_result
val subst_found : t -> subst:t -> found -> t
module With_layout = Core.Sexp.With_layout
exception Of_sexp_error of Base.Exn.t * t
val of_float_style : [ `Underscores | `No_underscores ] Base.Ref.t
val of_int_style : [ `Underscores | `No_underscores ] Base.Ref.t
type 'a no_raise = 'a

no_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 ... end
val bin_read_no_raise : 'a Bin_prot.Read.reader -> 'a no_raise Bin_prot.Read.reader
val __bin_read_no_raise__ : 'a Bin_prot.Read.reader -> (Base.Int.t -> 'a no_raise) Bin_prot.Read.reader
val bin_size_no_raise : 'a Bin_prot.Size.sizer -> 'a no_raise Bin_prot.Size.sizer
val bin_write_no_raise : 'a Bin_prot.Write.writer -> 'a no_raise Bin_prot.Write.writer
val bin_shape_no_raise : Bin_prot.Shape.t -> Bin_prot.Shape.t
val no_raise_of_sexp : (Sexplib.Sexp.t -> 'a) -> Sexplib.Sexp.t -> 'a no_raise
val sexp_of_no_raise : ('a -> Sexplib.Sexp.t) -> 'a no_raise -> Sexplib.Sexp.t
module Sexp_maybe = Core.Sexp.Sexp_maybe

If 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 = Core.Sexp.With_text

A 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 -> 'a

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

include module type of struct include Extended_sexp end

Extensions to Sexplib.Sexp.

val is_atom : Core.Sexp.t -> bool
val is_list : Core.Sexp.t -> bool

Constructors

val atom : string -> Core.Sexp.t
val list : Core.Sexp.t list -> Core.Sexp.t
val to_string_hum' : Core.Sexp.t -> string

The ocaml pretty printer (used by sexplib) is a speed daemon but is, sadly enough, produces wrong output (e.g it overflows in places where this could have avoided). This uses a printer from wadler's a prettier printer to output strings suited to human consumption.

val format : Core.Sexp.t -> Pp.t
val pp_hum' : Format.formatter -> Core.Sexp.t -> unit

A more readable but less compact pretty printer than the one bundled by sexplib. This is going through a test period at which point it might make it in sexplib. It uses ocaml's pretty-printing library so it is both fast and broken.

val comment : string -> string

Takes a string and returns the same string but commented according to sexp's syntax

module Diff = Extended_sexp.Diff
val print_diff : ?oc:Core.Out_channel.t -> original:Core.Sexp.t -> updated:Core.Sexp.t -> unit -> unit
val summarize : Core.Sexp.t -> sub_sexp:Core.Sexp.t -> size:[ `depth of int | `string of int ] -> Core.Sexp.t

Returns a smaller sexp by replacing sections with "...". Will try to show parts of the sexp "near" sub_sexp.

Limiting size to length a string length is less efficient than a certain depth. The meaning of a given depth is arbitrary except that more depth gives you a bigger sexp. Try 100 or so.

Transforming sexp parsers

module Records_table = Extended_sexp.Records_table
module Make_explicit_sexp_option = Extended_sexp.Make_explicit_sexp_option
val load_sexp_conv_exn_sample : ?strict:bool -> ?buf:Core.Bytes.t -> ?on_non_existence:[ `Exit | `Raise ] -> ?name:string -> string -> sexp_of_t:('a -> Core.Sexp.t) -> t_of_sexp:(Core.Sexp.t -> 'a) -> sample:'a -> 'a
module Comprehension = Extended_sexp.Comprehension
OCaml

Innovation. Community. Security.