aboutsummaryrefslogtreecommitdiffhomepage
path: root/printing
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2016-04-13 07:56:44 +0200
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2016-04-27 21:55:47 +0200
commitcbb917476e3920641352c108ec9ffaf6d1682217 (patch)
tree7267c5d833c8caa62597165593a379c1503b4589 /printing
parentd91a1aa62edad53b41fbb7cb6f6a841f03ebcde4 (diff)
Fixing printing of Instance.
Diffstat (limited to 'printing')
-rw-r--r--printing/ppconstr.ml12
-rw-r--r--printing/ppconstrsig.mli1
-rw-r--r--printing/ppvernac.ml5
3 files changed, 13 insertions, 5 deletions
diff --git a/printing/ppconstr.ml b/printing/ppconstr.ml
index 56fbdd5ff..ba70145b6 100644
--- a/printing/ppconstr.ml
+++ b/printing/ppconstr.ml
@@ -498,6 +498,11 @@ end) = struct
pr (lapp,L) a ++
prlist (fun a -> spc () ++ pr_expl_args pr a) l)
+ let pr_record_body_gen pr l =
+ spc () ++
+ prlist_with_sep pr_semicolon
+ (fun (id, c) -> h 1 (pr_reference id ++ spc () ++ str":=" ++ pr ltop c)) l
+
let pr_forall () = keyword "forall" ++ spc ()
let pr_fun () = keyword "fun" ++ spc ()
@@ -600,10 +605,7 @@ end) = struct
return (pr_app (pr mt) a l, lapp)
| CRecord (_,l) ->
return (
- hv 0 (str"{|" ++ spc () ++
- prlist_with_sep pr_semicolon
- (fun (id, c) -> h 1 (pr_reference id ++ spc () ++ str":=" ++ pr spc ltop c)) l
- ++ str" |}"),
+ hv 0 (str"{|" ++ pr_record_body_gen (pr spc) l ++ str" |}"),
latom
)
| CCases (_,LetPatternStyle,rtntypopt,[c,as_clause,in_clause],[(_,[(loc,[p])],b)]) ->
@@ -736,6 +738,8 @@ end) = struct
let pr_cases_pattern_expr = pr_patt ltop
+ let pr_record_body = pr_record_body_gen pr
+
let pr_binders = pr_undelimited_binders spc (pr ltop)
end
diff --git a/printing/ppconstrsig.mli b/printing/ppconstrsig.mli
index c711dd8f7..a59fc6d67 100644
--- a/printing/ppconstrsig.mli
+++ b/printing/ppconstrsig.mli
@@ -50,6 +50,7 @@ module type Pp = sig
('a * Names.Id.t) option * recursion_order_expr ->
std_ppcmds
+ val pr_record_body : (reference * constr_expr) list -> std_ppcmds
val pr_binders : local_binder list -> std_ppcmds
val pr_constr_pattern_expr : constr_pattern_expr -> std_ppcmds
val pr_lconstr_pattern_expr : constr_pattern_expr -> std_ppcmds
diff --git a/printing/ppvernac.ml b/printing/ppvernac.ml
index 396add264..42af0f2e6 100644
--- a/printing/ppvernac.ml
+++ b/printing/ppvernac.ml
@@ -895,9 +895,12 @@ module Make
| (_, Anonymous), _ -> mt ()) ++
pr_and_type_binders_arg sup ++
str":" ++ spc () ++
+ (match bk with Implicit -> str "! " | Explicit -> mt ()) ++
pr_constr cl ++ pr_priority pri ++
(match props with
- | Some (_,p) -> spc () ++ str":=" ++ spc () ++ pr_constr p
+ | Some (true,CRecord (_,l)) -> spc () ++ str":=" ++ spc () ++ str"{" ++ pr_record_body l ++ str "}"
+ | Some (true,_) -> assert false
+ | Some (false,p) -> spc () ++ str":=" ++ spc () ++ pr_constr p
| None -> mt()))
)