diff src/cjrize.sml @ 704:70cbdcf5989b

UNIQUE constraints
author Adam Chlipala <adamc@hcoop.net>
date Tue, 07 Apr 2009 12:24:31 -0400
parents 500e93aa436f
children d8217b4cb617
line wrap: on
line diff
--- a/src/cjrize.sml	Sun Apr 05 16:17:32 2009 -0400
+++ b/src/cjrize.sml	Tue Apr 07 12:24:31 2009 -0400
@@ -524,7 +524,7 @@
             (NONE, SOME (ek, "/" ^ s, n, ts, t, L'.ServerAndPullAndPush), sm)
         end
 
-      | L.DTable (s, xts) =>
+      | L.DTable (s, xts, e) =>
         let
             val (xts, sm) = ListUtil.foldlMap (fn ((x, t), sm) =>
                                                   let
@@ -532,8 +532,18 @@
                                                   in
                                                       ((x, t), sm)
                                                   end) sm xts
+
+            fun flatten e =
+                case #1 e of
+                    L.ERecord [] => []
+                  | L.ERecord [(x, (L.EPrim (Prim.String v), _), _)] => [(x, v)]
+                  | L.EStrcat (e1, e2) => flatten e1 @ flatten e2
+                  | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined";
+                          Print.prefaces "Undetermined constraint"
+                          [("e", MonoPrint.p_exp MonoEnv.empty e)];
+                          [])
         in
-            (SOME (L'.DTable (s, xts), loc), NONE, sm)
+            (SOME (L'.DTable (s, xts, flatten e), loc), NONE, sm)
         end
       | L.DSequence s =>
         (SOME (L'.DSequence s, loc), NONE, sm)