From b029d32dfb68f955f78e2a26709f5622049dcd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Dimino?= Date: Wed, 7 Mar 2018 15:01:46 +0000 Subject: [PATCH] fix String_with_vars.sexp_of_t (#595) --- src/string_with_vars.ml | 5 +++-- src/string_with_vars.mli | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/string_with_vars.ml b/src/string_with_vars.ml index cd1c740b..f69365e0 100644 --- a/src/string_with_vars.ml +++ b/src/string_with_vars.ml @@ -85,8 +85,7 @@ let sexp_of_item = | Var (vs, s) -> List [sexp_of_var_syntax vs ; Sexp.atom_or_quoted_string s] -let sexp_of_t t = Sexp.To_sexp.list sexp_of_item t.items - +let sexp_of_ast t = Sexp.To_sexp.list sexp_of_item t.items let fold t ~init ~f = List.fold_left t.items ~init ~f:(fun acc item -> @@ -197,3 +196,5 @@ let to_string t = | Text s -> s | Var (syntax, v) -> string_of_var syntax v) |> String.concat ~sep:"" + +let sexp_of_t t = Sexp.To_sexp.string (to_string t) diff --git a/src/string_with_vars.mli b/src/string_with_vars.mli index 09abce1e..0b02380b 100644 --- a/src/string_with_vars.mli +++ b/src/string_with_vars.mli @@ -18,6 +18,10 @@ val loc : t -> Loc.t val sexp_of_t : t -> Sexp.t +(** Same as [sexp_of_t] but the S-expression encodes the internal + structure of [t]. *) +val sexp_of_ast : t -> Sexp.t + val to_string : t -> string (** [t] generated by the OCaml code. The first argument should be