Mercurial > urweb
comparison src/elab_print.sml @ 12:d89477f07c1e
Fun with records
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Fri, 28 Mar 2008 17:34:57 -0400 |
parents | e97c6d335869 |
children | 6049e2193bf2 |
comparison
equal
deleted
inserted
replaced
11:e97c6d335869 | 12:d89477f07c1e |
---|---|
113 space, | 113 space, |
114 p_con (E.pushCRel env x k) c]) | 114 p_con (E.pushCRel env x k) c]) |
115 | 115 |
116 | CName s => box [string "#", string s] | 116 | CName s => box [string "#", string s] |
117 | 117 |
118 | CRecord (k, xcs) => parenIf par (box [string "[", | 118 | CRecord (k, xcs) => |
119 p_list (fn (x, c) => | 119 if !debug then |
120 box [p_con env x, | 120 parenIf par (box [string "[", |
121 space, | 121 p_list (fn (x, c) => |
122 string "=", | 122 box [p_con env x, |
123 space, | 123 space, |
124 p_con env c]) xcs, | 124 string "=", |
125 string "]::", | 125 space, |
126 p_kind k]) | 126 p_con env c]) xcs, |
127 string "]::", | |
128 p_kind k]) | |
129 else | |
130 parenIf par (box [string "[", | |
131 p_list (fn (x, c) => | |
132 box [p_con env x, | |
133 space, | |
134 string "=", | |
135 space, | |
136 p_con env c]) xcs, | |
137 string "]"]) | |
127 | CConcat (c1, c2) => parenIf par (box [p_con' true env c1, | 138 | CConcat (c1, c2) => parenIf par (box [p_con' true env c1, |
128 space, | 139 space, |
129 string "++", | 140 string "++", |
130 space, | 141 space, |
131 p_con env c2]) | 142 p_con env c2]) |
179 space, | 190 space, |
180 string "=>", | 191 string "=>", |
181 space, | 192 space, |
182 p_exp (E.pushCRel env x k) e]) | 193 p_exp (E.pushCRel env x k) e]) |
183 | 194 |
195 | ERecord xes => box [string "{", | |
196 p_list (fn (x, e) => | |
197 box [p_con env x, | |
198 space, | |
199 string "=", | |
200 space, | |
201 p_exp env e]) xes, | |
202 string "}"] | |
203 | EField (e, c, {field, rest}) => | |
204 if !debug then | |
205 box [p_exp' true env e, | |
206 string ".", | |
207 p_con' true env c, | |
208 space, | |
209 string "[", | |
210 p_con env field, | |
211 space, | |
212 string " in ", | |
213 space, | |
214 p_con env rest, | |
215 string "]"] | |
216 else | |
217 box [p_exp' true env e, | |
218 string ".", | |
219 p_con' true env c] | |
220 | |
184 | EError => string "<ERROR>" | 221 | EError => string "<ERROR>" |
185 | 222 |
186 and p_exp env = p_exp' false env | 223 and p_exp env = p_exp' false env |
187 | 224 |
188 fun p_decl env ((d, _) : decl) = | 225 fun p_decl env ((d, _) : decl) = |