diff src/urweb.grm @ 341:389399d65331

Crud update form
author Adam Chlipala <adamc@hcoop.net>
date Sun, 14 Sep 2008 19:03:55 -0400
parents 075b36dbb1a4
children f55034419a07
line wrap: on
line diff
--- a/src/urweb.grm	Sun Sep 14 15:20:53 2008 -0400
+++ b/src/urweb.grm	Sun Sep 14 19:03:55 2008 -0400
@@ -43,6 +43,7 @@
 datatype select_item =
          Field of con * con
        | Exp of con * exp
+       | Fields of con * con
 
 datatype select =
          Star
@@ -77,6 +78,22 @@
             
             (tabs, exps)
         end
+      | Fields (tx, fs) =>
+        let
+            val (tabs, found) = ListUtil.foldlMap (fn ((tx', c'), found) =>
+                                                      if eqTnames (tx, tx') then
+                                                          ((tx', (CConcat (fs, c'), loc)), true)
+                                                      else
+                                                          ((tx', c'), found))
+                                                  false tabs
+        in
+            if found then
+                ()
+            else
+                ErrorMsg.errorAt loc "Select of field from unbound table";
+            
+            (tabs, exps)
+        end
       | Exp (c, e) => (tabs, (c, e) :: exps)
 
 fun amend_group loc (gi, tabs) =
@@ -1041,6 +1058,7 @@
 
 seli   : tident DOT fident              (Field (tident, fident))
        | sqlexp AS fident               (Exp (fident, sqlexp))
+       | tident DOT LBRACE LBRACE cexp RBRACE RBRACE (Fields (tident, cexp))
 
 selis  : seli                           ([seli])
        | seli COMMA selis               (seli :: selis)