Mercurial > urweb
comparison src/source_print.sml @ 123:e3041657d653
Parsing and elaborating (non-mutual) 'val rec'
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Jul 2008 10:09:34 -0400 |
parents | 813e5a52063d |
children | 7420fa18d657 |
comparison
equal
deleted
inserted
replaced
122:f7c6ceb87bbd | 123:e3041657d653 |
---|---|
327 space, | 327 space, |
328 p_con c] | 328 p_con c] |
329 | SgnProj (m, ms, x) => p_list_sep (string ".") string (m :: ms @ [x]) | 329 | SgnProj (m, ms, x) => p_list_sep (string ".") string (m :: ms @ [x]) |
330 | 330 |
331 | 331 |
332 fun p_vali (x, co, e) = | |
333 case co of | |
334 NONE => box [string x, | |
335 space, | |
336 string "=", | |
337 space, | |
338 p_exp e] | |
339 | SOME t => box [string x, | |
340 space, | |
341 string ":", | |
342 space, | |
343 p_con t, | |
344 space, | |
345 string "=", | |
346 space, | |
347 p_exp e] | |
348 | |
332 fun p_decl ((d, _) : decl) = | 349 fun p_decl ((d, _) : decl) = |
333 case d of | 350 case d of |
334 DCon (x, NONE, c) => box [string "con", | 351 DCon (x, NONE, c) => box [string "con", |
335 space, | 352 space, |
336 string x, | 353 string x, |
347 p_kind k, | 364 p_kind k, |
348 space, | 365 space, |
349 string "=", | 366 string "=", |
350 space, | 367 space, |
351 p_con c] | 368 p_con c] |
352 | DVal (x, NONE, e) => box [string "val", | 369 | DVal vi => box [string "val", |
353 space, | 370 space, |
354 string x, | 371 p_vali vi] |
355 space, | 372 | DValRec vis => box [string "val", |
356 string "=", | 373 space, |
357 space, | 374 string "rec", |
358 p_exp e] | 375 space, |
359 | DVal (x, SOME t, e) => box [string "val", | 376 p_list_sep (box [newline, string "and", space]) p_vali vis] |
360 space, | |
361 string x, | |
362 space, | |
363 string ":", | |
364 space, | |
365 p_con t, | |
366 space, | |
367 string "=", | |
368 space, | |
369 p_exp e] | |
370 | 377 |
371 | DSgn (x, sgn) => box [string "signature", | 378 | DSgn (x, sgn) => box [string "signature", |
372 space, | 379 space, |
373 string x, | 380 string x, |
374 space, | 381 space, |