Version française
Home     About     Download     Resources     Contact us    
Browse thread
Escaped string in sexplib
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] Escaped string in sexplib
On Tue, Jun 8, 2010 at 14:52, Hugo Ferreira <hmf@inescporto.pt> wrote:
> My apologies but I did not explain myself correctly. The problem here is
> that I am trying to automate the conversion to string of the data
> structure read from the s-expressions. I have the following:
>
> let string_of_experiment_data data =
>  let data = sexp_of_experiment_data data in
>  Sexplib.Sexp.to_string_hum data
>
> The problem here is that the "to_string_hum" escapes certain characters,
> but I need to have the strings "not escaped". So my question is: is
> their any way I can tell sexplib to output a string but not escape
> it? Otherwise I will have to hand encode this stuff 8-(

Sexplib does not support any other way of printing S-expressions.
There would not be any reliable way to read back data without
escaping.

If you want to write your own printers, this should still be very
easy.  S-expressions are either a Sexp.Atom or Sexp.List.  It should
only require a handful of lines to convert these to whatever other
string representation you prefer.  Writing a corresponding parser may
be more effort.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com