package yocaml

  1. Overview
  2. Docs

Module Yocaml.SexpSource

include module type of Sexp

Definition

An S-Expression is a data structure with an extremely simple recursive syntax tree. It is made up of atoms (character strings) and nodes (also S-Expressions).

Sourcetype t =
  1. | Atom of string
  2. | Node of t list

S-Expression AST.

Sourcetype parsing_error =
  1. | Nonterminated_node of int
  2. | Nonterminated_atom of int
  3. | Expected_number_or_colon of char * int
  4. | Expected_number of char * int
  5. | Unexepected_character of char * int
  6. | Premature_end_of_atom of int * int

Errors that can occur when parsing S-expressions.

Sourcetype invalid =
  1. | Invalid_sexp of t * string

Used to describe an invalid S-expression (correctly parsed but does not respect a schema).

Sourceval atom : string -> t

atom x lift a given string, x, into a t.

Sourceval node : t list -> t

nod x lift a given list of t, x, into a t.

Serialization

Tools for serializing a Sexp.

Sourceval to_string : t -> string

convert a S-expression to a string (with indent).

Deserialization

Sourceval from_string : string -> (t, parsing_error) result

from_string str Try deserializing a string in Sexp.

Sourceval from_seq : char Seq.t -> (t, parsing_error) result

from_string str Try deserializing a string in Sexp.

Sourcemodule Canonical : sig ... end

S-Canonical expression used to describe compressed data sources.

Utils

Sourceval equal : t -> t -> bool

Equality between t.

Sourceval pp : Format.formatter -> t -> unit

Pretty-printer for t (mostly used for debugging issue).

Sourceval pp_pretty : Format.formatter -> t -> unit

Pretty-printer for t with indentation.

Sourcemodule Provider : sig ... end
OCaml

Innovation. Community. Security.