From b12e9a5baaf99342540a134904b855076dc0560e Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Mon, 1 Jun 2020 19:17:59 +0200 Subject: [PATCH] Aligned printing of tuples of expressions on CameLIGO. --- src/passes/1-parser/pascaligo/Pretty.ml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/passes/1-parser/pascaligo/Pretty.ml b/src/passes/1-parser/pascaligo/Pretty.ml index ce53e5a94..7fc70a4bd 100644 --- a/src/passes/1-parser/pascaligo/Pretty.ml +++ b/src/passes/1-parser/pascaligo/Pretty.ml @@ -356,7 +356,18 @@ and pp_selection = function FieldName _ -> string "TODO:pp_selection:FieldName" | Component cmp -> cmp.value |> snd |> Z.to_string |> string -and pp_tuple_expr tuple = pp_par (pp_nsepseq "," pp_expr) tuple +and pp_tuple_expr {value; _} = + let head, tail = value.inside in + let rec app = function + [] -> empty + | [e] -> group (break 1 ^^ pp_expr e) + | e::items -> + group (break 1 ^^ pp_expr e ^^ string ",") ^^ app items in + let components = + if tail = [] + then pp_expr head + else pp_expr head ^^ string "," ^^ app (List.map snd tail) + in string "(" ^^ nest 1 (components ^^ string ")") and pp_fun_call {value; _} = let lambda, arguments = value in