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