aboutsummaryrefslogtreecommitdiff
path: root/printing/miscprint.ml
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2017-06-01 05:42:14 +0200
committerEmilio Jesus Gallego Arias2017-06-01 05:42:14 +0200
commita0ea7ebf4838903c3ed9a9b885716cf14134a0c8 (patch)
tree8a073c4a47c29d0f9b19aec6d28c0c62dbe8a3d5 /printing/miscprint.ml
parenteed90d1bd867dce59f6bf1b2bf769fff188f128b (diff)
[printing] Remove duplicated printing function.
It seems there were 4 copies of the same function in the code base.
Diffstat (limited to 'printing/miscprint.ml')
-rw-r--r--printing/miscprint.ml25
1 files changed, 25 insertions, 0 deletions
diff --git a/printing/miscprint.ml b/printing/miscprint.ml
index 360843711c..a4ecbdf5e5 100644
--- a/printing/miscprint.ml
+++ b/printing/miscprint.ml
@@ -47,3 +47,28 @@ let pr_move_location pr_id = function
| MoveBefore id -> brk(1,1) ++ str "before " ++ pr_id id
| MoveFirst -> str " at top"
| MoveLast -> str " at bottom"
+
+(** Printing of bindings *)
+let pr_binding prc = function
+ | loc, (NamedHyp id, c) -> hov 1 (Names.Id.print id ++ str " := " ++ cut () ++ prc c)
+ | loc, (AnonHyp n, c) -> hov 1 (int n ++ str " := " ++ cut () ++ prc c)
+
+let pr_bindings prc prlc = function
+ | ImplicitBindings l ->
+ brk (1,1) ++ str "with" ++ brk (1,1) ++
+ pr_sequence prc l
+ | ExplicitBindings l ->
+ brk (1,1) ++ str "with" ++ brk (1,1) ++
+ pr_sequence (fun b -> str"(" ++ pr_binding prlc b ++ str")") l
+ | NoBindings -> mt ()
+
+let pr_bindings_no_with prc prlc = function
+ | ImplicitBindings l ->
+ brk (0,1) ++ prlist_with_sep spc prc l
+ | ExplicitBindings l ->
+ brk (0,1) ++ prlist_with_sep spc (fun b -> str"(" ++ pr_binding prlc b ++ str")") l
+ | NoBindings -> mt ()
+
+let pr_with_bindings prc prlc (c,bl) =
+ hov 1 (prc c ++ pr_bindings prc prlc bl)
+