Module CCSexp
Handling S-expressions
type 'a or_error= ('a, string) Result.resulttype 'a sequence= ('a -> unit) -> unittype 'a gen= unit -> 'a option
Basics
val equal : t -> t -> boolval compare : t -> t -> intval hash : t -> intval atom : string -> tBuild an atom directly from a string.
val of_int : int -> tval of_bool : bool -> tval of_list : t list -> tval of_rev_list : t list -> tReverse the list.
val of_float : float -> tReverse the list.
Printing
val to_buf : Buffer.t -> t -> unitval to_string : t -> stringval to_file : string -> t -> unitval to_file_seq : string -> t sequence -> unitPrint the given sequence of expressions to a file.
val to_chan : Pervasives.out_channel -> t -> unitval pp : Format.formatter -> t -> unitPretty-printer nice on human eyes (including indentation).
val pp_noindent : Format.formatter -> t -> unitRaw, direct printing as compact as possible.
Parsing
type 'a parse_result=|Yield of 'a|Fail of string|EndA parser of
'acan returnYield xwhen it parsed a value, orFail ewhen a parse error was encountered, orEndif the input was empty.
module Decoder : sig ... endval parse_chan : Pervasives.in_channel -> t or_errorParse a S-expression from the given channel. Can read more data than necessary, so don't use this if you need finer-grained control (e.g. to read something else after the S-exp).
val parse_chan_gen : Pervasives.in_channel -> t or_error genParse a channel into a generator of S-expressions.