Page
Library
Module
Module type
Parameter
Class
Class type
Source
Sturgeon_sexpSourceThis 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
Build a sexp list, -> nil x :: xs -> C (x, sexp_of_list xs)
Serialize an s-exp by repetively calling a string printing function.
Read 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 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.
Read from a channel.
Partial application (stopping before the last ()) allows to read a stream of sexp.