diff 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
line wrap: on
line diff
--- a/src/source_print.sml	Sun Jul 13 20:25:25 2008 -0400
+++ b/src/source_print.sml	Thu Jul 17 10:09:34 2008 -0400
@@ -329,6 +329,23 @@
       | SgnProj (m, ms, x) => p_list_sep (string ".") string (m :: ms @ [x])
                                    
 
+fun p_vali (x, co, e) =
+    case co of
+        NONE => box [string x,
+                     space,
+                     string "=",
+                     space,
+                     p_exp e]
+      | SOME t => box [string x,
+                       space,
+                       string ":",
+                       space,
+                       p_con t,
+                       space,
+                       string "=",
+                       space,
+                       p_exp e]
+
 fun p_decl ((d, _) : decl) =
     case d of
         DCon (x, NONE, c) => box [string "con",
@@ -349,24 +366,14 @@
                                     string "=",
                                     space,
                                     p_con c]
-      | DVal (x, NONE, e) => box [string "val",
-                                  space,
-                                  string x,
-                                  space,
-                                  string "=",
-                                  space,
-                                  p_exp e]
-      | DVal (x, SOME t, e) => box [string "val",
-                                    space,
-                                    string x,
-                                    space,
-                                    string ":",
-                                    space,
-                                    p_con t,
-                                    space,
-                                    string "=",
-                                    space,
-                                    p_exp e]
+      | DVal vi => box [string "val",
+                        space,
+                        p_vali vi]
+      | DValRec vis => box [string "val",
+                            space,
+                            string "rec",
+                            space,
+                            p_list_sep (box [newline, string "and", space]) p_vali vis]
 
       | DSgn (x, sgn) => box [string "signature",
                               space,