sig
type input = unit -> (Bytes.t * int * int) option
val input_of_string : string -> Sexpm.input
val input_of_in_channel :
?bytes:Bytes.t -> Pervasives.in_channel -> Sexpm.input
type output = (Bytes.t * int * int) option -> unit
val output_of_buffer : Buffer.t -> Sexpm.output
val output_of_out_channel : Pervasives.out_channel -> Sexpm.output
type pos = int * int
type range = Sexpm.pos * Sexpm.pos
val pp_range : Format.formatter -> Sexpm.range -> unit
type error =
[ `Codec of string
| `Illegal_bytes of string
| `Illegal_escape of
[ `Exp_hex of Uchar.t
| `Exp_hex_rbrace of Uchar.t
| `Exp_lbrace of Uchar.t
| `Exp_rbrace of Uchar.t
| `Not_esc of Uchar.t
| `Not_uchar of int ]
| `Illegal_uchar of Uchar.t
| `Unclosed of [ `Escape | `List | `Quoted_token ]
| `Unexpected_le ]
val pp_error : Format.formatter -> Sexpm.error -> unit
type decoder
val decoder : ?layout:bool -> Sexpm.input -> Sexpm.decoder
val decoder_layout : Sexpm.decoder -> bool
val decoded_range : Sexpm.decoder -> Sexpm.range
val decoded_sexp_range : Sexpm.decoder -> Sexpm.range
type encoder
type encoder_style = [ `Minify | `Pp | `Raw ]
val encoder :
?bytes:Bytes.t ->
?nl:bool ->
?quote:bool ->
?style:Sexpm.encoder_style -> Sexpm.output -> Sexpm.encoder
val decode_custom :
atom:(Sexpm.decoder -> string -> 'a) ->
list:(Sexpm.decoder -> 'a list -> 'a) ->
Sexpm.decoder -> ('a option, Sexpm.error * Sexpm.range) Pervasives.result
val encode_custom :
('a -> [ `Atom of string | `List of 'a list ]) ->
Sexpm.encoder -> 'a option -> unit
type 'a t = [ `Atom of string | `List of 'a Sexpm.t list ] * 'a
type 'a tagger =
Sexpm.decoder ->
[ `Atom of string | `List of 'a Sexpm.t list ] -> 'a Sexpm.t
val unit_tag : unit Sexpm.tagger
val range_tag : Sexpm.range Sexpm.tagger
val decode_tagged :
tag:'a Sexpm.tagger ->
Sexpm.decoder ->
('a Sexpm.t option, Sexpm.error * Sexpm.range) Pervasives.result
val encode_tagged : Sexpm.encoder -> 'a Sexpm.t option -> unit
type lexeme =
White of string
| Comment of string
| Ls
| Le
| Atom of string * string option
val pp_lexeme : Format.formatter -> Sexpm.lexeme -> unit
val decode_lexeme :
Sexpm.decoder ->
(Sexpm.lexeme option, Sexpm.error * Sexpm.range) Pervasives.result
val peek_lexeme :
Sexpm.decoder ->
(Sexpm.lexeme option, Sexpm.error * Sexpm.range) Pervasives.result
val encode_lexeme : Sexpm.encoder -> Sexpm.lexeme option -> unit
val escape : ?quote:bool -> string -> string
type trace = Sexpm.lexeme list
type 'a codec
val codec_with_default : 'a -> 'a Sexpm.codec -> 'a Sexpm.codec
val codec_with_codec :
?eq:('a -> 'a -> bool) -> ?default:'a -> 'a Sexpm.codec -> 'a Sexpm.codec
type 'a c
val encode_value : 'a Sexpm.c -> Sexpm.encoder -> 'a option -> unit
val encode_traced_value :
'a Sexpm.codec -> Sexpm.encoder -> ('a * 'a) option * Sexpm.trace -> unit
val decode_traced_value :
'a Sexpm.codec ->
Sexpm.decoder ->
('a option * Sexpm.trace, Sexpm.error * Sexpm.range) Pervasives.result
val unit : unit Sexpm.codec
val bool : bool Sexpm.codec
val int : int Sexpm.codec
val float : float Sexpm.codec
val float_fmt :
(float -> string, unit, string) Pervasives.format -> float Sexpm.codec
val float_hex : float Sexpm.codec
val string : string Sexpm.codec
val result :
ok:'a Sexpm.codec ->
error:'b Sexpm.codec -> ('a, 'b) Pervasives.result Sexpm.codec
val t2 : 'a Sexpm.codec -> 'b Sexpm.codec -> ('a * 'b) Sexpm.codec
val list : 'a Sexpm.codec -> 'a list Sexpm.codec
val set :
(module Set.S with type elt = 'a and type t = 'b) ->
'a Sexpm.codec -> 'b Sexpm.codec
end