comparison src/source_print.sml @ 174:7ee424760d2f

Elaborating module constructor patterns; parsing record patterns
author Adam Chlipala <adamc@hcoop.net>
date Thu, 31 Jul 2008 11:28:55 -0400
parents 8221b95cc24c
children b2d752455182
comparison
equal deleted inserted replaced
173:8221b95cc24c 174:7ee424760d2f
169 | PPrim p => Prim.p_t p 169 | PPrim p => Prim.p_t p
170 | PCon (ms, x, NONE) => p_list_sep (string ".") string (ms @ [x]) 170 | PCon (ms, x, NONE) => p_list_sep (string ".") string (ms @ [x])
171 | PCon (ms, x, SOME p) => parenIf par (box [p_list_sep (string ".") string (ms @ [x]), 171 | PCon (ms, x, SOME p) => parenIf par (box [p_list_sep (string ".") string (ms @ [x]),
172 space, 172 space,
173 p_pat' true p]) 173 p_pat' true p])
174 174 | PRecord (xps, flex) =>
175 val p_pat = p_pat' false 175 let
176 val pps = map (fn (x, p) => box [string "x", space, string "=", space, p_pat p]) xps
177 in
178 box [string "{",
179 p_list_sep (box [string ",", space]) (fn x => x)
180 (if flex then
181 pps
182 else
183 pps @ [string "..."]),
184 string "}"]
185 end
186
187 and p_pat x = p_pat' false x
176 188
177 fun p_exp' par (e, _) = 189 fun p_exp' par (e, _) =
178 case e of 190 case e of
179 EAnnot (e, t) => box [string "(", 191 EAnnot (e, t) => box [string "(",
180 p_exp e, 192 p_exp e,