diff src/lacweb.grm @ 221:79819a6346e2

Fields in SQL expressions
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 17:46:26 -0400
parents 2b665e822e9a
children 36fef91a6bbf
line wrap: on
line diff
--- a/src/lacweb.grm	Sat Aug 16 17:35:28 2008 -0400
+++ b/src/lacweb.grm	Sat Aug 16 17:46:26 2008 -0400
@@ -230,6 +230,7 @@
 %nonassoc TWIDDLE
 %nonassoc DOLLAR
 %left DOT
+%nonassoc LBRACE RBRACE
 
 %%
 
@@ -659,11 +660,11 @@
 table  : SYMBOL                         ((CName SYMBOL, s (SYMBOLleft, SYMBOLright)),
                                          (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright)))
        | SYMBOL AS tname                (tname, (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright)))
-       | LBRACE eexp RBRACE AS tname    (tname, eexp)
+       | LBRACE LBRACE eexp RBRACE RBRACE AS tname    (tname, eexp)
 
 tident : SYMBOL                         (CName SYMBOL, s (SYMBOLleft, SYMBOLright))
        | CSYMBOL                        (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
-       | LBRACE cexp RBRACE             (cexp)
+       | LBRACE LBRACE cexp RBRACE RBRACE (cexp)
 
 fident : CSYMBOL                        (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
        | LBRACE cexp RBRACE             (cexp)
@@ -683,6 +684,14 @@
                                                      EVar (["Basis"], "sql_bool"),
                                                      s (FALSEleft, FALSEright)))
 
+       | tident DOT fident              (let
+                                             val loc = s (tidentleft, fidentright)
+                                             val e = (EVar (["Basis"], "sql_field"), loc)
+                                             val e = (ECApp (e, tident), loc)
+                                         in
+                                             (ECApp (e, fident), loc)
+                                         end)
+
        | sqlexp EQ sqlexp               (sql_compare ("eq", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))
        | sqlexp NE sqlexp               (sql_compare ("ne", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))
        | sqlexp LT sqlexp               (sql_compare ("lt", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))