summaryrefslogtreecommitdiff
path: root/src/elab_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-03-28 17:34:57 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-03-28 17:34:57 -0400
commite9b1040a1f27a07afc7b2bf33522b1058163bf2b (patch)
tree07693c3eaedb3b11fb52fdfa8bcf8cc7c8aaecf8 /src/elab_print.sml
parenta6d534b172ccb8eadc24e0e903b196085869800e (diff)
Fun with records
Diffstat (limited to 'src/elab_print.sml')
-rw-r--r--src/elab_print.sml55
1 files changed, 46 insertions, 9 deletions
diff --git a/src/elab_print.sml b/src/elab_print.sml
index 83e8f814..c11b0da1 100644
--- a/src/elab_print.sml
+++ b/src/elab_print.sml
@@ -115,15 +115,26 @@ fun p_con' par env (c, _) =
| CName s => box [string "#", string s]
- | CRecord (k, xcs) => parenIf par (box [string "[",
- p_list (fn (x, c) =>
- box [p_con env x,
- space,
- string "=",
- space,
- p_con env c]) xcs,
- string "]::",
- p_kind k])
+ | CRecord (k, xcs) =>
+ if !debug then
+ parenIf par (box [string "[",
+ p_list (fn (x, c) =>
+ box [p_con env x,
+ space,
+ string "=",
+ space,
+ p_con env c]) xcs,
+ string "]::",
+ p_kind k])
+ else
+ parenIf par (box [string "[",
+ p_list (fn (x, c) =>
+ box [p_con env x,
+ space,
+ string "=",
+ space,
+ p_con env c]) xcs,
+ string "]"])
| CConcat (c1, c2) => parenIf par (box [p_con' true env c1,
space,
string "++",
@@ -181,6 +192,32 @@ fun p_exp' par env (e, _) =
space,
p_exp (E.pushCRel env x k) e])
+ | ERecord xes => box [string "{",
+ p_list (fn (x, e) =>
+ box [p_con env x,
+ space,
+ string "=",
+ space,
+ p_exp env e]) xes,
+ string "}"]
+ | EField (e, c, {field, rest}) =>
+ if !debug then
+ box [p_exp' true env e,
+ string ".",
+ p_con' true env c,
+ space,
+ string "[",
+ p_con env field,
+ space,
+ string " in ",
+ space,
+ p_con env rest,
+ string "]"]
+ else
+ box [p_exp' true env e,
+ string ".",
+ p_con' true env c]
+
| EError => string "<ERROR>"
and p_exp env = p_exp' false env