Sturgeon_sexpThis is an implementation of (a subset of) Emacs s-expressions.
Recursively transform a sexp. map function is applied on each atom and at the root of each list
Recursively transform a sexp. map function is applied on each atom and each cons-cell
val sym_nil : 'a sexpnil constant: S "nil"
val sym_t : 'a sexpt constant: S "t"
Build a sexp list, -> nil x :: xs -> C (x, sexp_of_list xs)
val void : void -> 'aval tell_sexp : (string -> unit) -> basic -> unitSerialize an s-exp by repetively calling a string printing function.
val read_sexp : (unit -> char) -> basic * charRead an basic by repetively calling a character reading function.
The character reading function can return '\000' to signal EOF.
Returns the basic and, if any, the last character read but not part of the sexp, or '\000'.
If the basic is not well-formed, a Failure is raised. You can catch it and add relevant location information. The error is always due to the last call to the reading function, which should be enough to locate the erroneous input, except for unterminated string.
val to_string : basic -> stringval of_string : string -> basicval of_file_descr :
on_read:(Unix.file_descr -> unit) ->
Unix.file_descr ->
unit ->
basic optionRead from a file descriptor.
on_read is called before a potentially blocking read is done, so that you can act before blocking (select, notify scheduler ...).
Partial application (stopping before the last ()) allows to read a stream of sexp.
val of_channel : in_channel -> unit -> basic optionRead from a channel.
Partial application (stopping before the last ()) allows to read a stream of sexp.