From f6ff6b85c401a8d8b65c86c4316a4b32b55cfafc Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Mon, 27 Apr 2020 11:30:59 +0200 Subject: [PATCH] add ligo_string in simple_utils --- vendors/ligo-utils/simple-utils/simple_utils.ml | 2 +- vendors/ligo-utils/simple-utils/x_string.ml | 11 +++++++++++ vendors/ligo-utils/simple-utils/x_string.mli | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 vendors/ligo-utils/simple-utils/x_string.ml create mode 100644 vendors/ligo-utils/simple-utils/x_string.mli diff --git a/vendors/ligo-utils/simple-utils/simple_utils.ml b/vendors/ligo-utils/simple-utils/simple_utils.ml index 1db630bb7..c0748367b 100644 --- a/vendors/ligo-utils/simple-utils/simple_utils.ml +++ b/vendors/ligo-utils/simple-utils/simple_utils.ml @@ -14,4 +14,4 @@ module Tree = Tree module Region = Region module Pos = Pos module Var = Var - +module Ligo_string = X_string diff --git a/vendors/ligo-utils/simple-utils/x_string.ml b/vendors/ligo-utils/simple-utils/x_string.ml new file mode 100644 index 000000000..f7155375c --- /dev/null +++ b/vendors/ligo-utils/simple-utils/x_string.ml @@ -0,0 +1,11 @@ +type t = + Standard of string +| Verbatim of string + +let pp ppf = function + Standard s -> Format.fprintf ppf "%S" s + | Verbatim v -> Format.fprintf ppf "{|%s|}" v + +let extract = function + Standard s -> s + | Verbatim v -> v diff --git a/vendors/ligo-utils/simple-utils/x_string.mli b/vendors/ligo-utils/simple-utils/x_string.mli new file mode 100644 index 000000000..5ded5f73f --- /dev/null +++ b/vendors/ligo-utils/simple-utils/x_string.mli @@ -0,0 +1,11 @@ +(* +Ligo_string represent string as they are writen in a ligo program, +delimited either with double quotes (standard) or with `{|...|}` (Varbatim) +*) + +type t = + Standard of string +| Verbatim of string + +val pp : Format.formatter -> t -> unit +val extract : t -> string