diff src/urweb.grm @ 750:059074c8d2fc

LEFT JOIN
author Adam Chlipala <adamc@hcoop.net>
date Tue, 28 Apr 2009 11:05:28 -0400
parents 16bfd9e244cd
children f95d652086cd
line wrap: on
line diff
--- a/src/urweb.grm	Tue Apr 28 10:11:56 2009 -0400
+++ b/src/urweb.grm	Tue Apr 28 11:05:28 2009 -0400
@@ -213,7 +213,7 @@
  | CURRENT_TIMESTAMP
  | NE | LT | LE | GT | GE
  | CCONSTRAINT | UNIQUE | CHECK | PRIMARY | FOREIGN | KEY | ON | NO | ACTION | RESTRICT | CASCADE | REFERENCES
- | JOIN | INNER | CROSS
+ | JOIN | INNER | CROSS | LEFT
 
 %nonterm
    file of decl list
@@ -361,7 +361,7 @@
 %nonassoc DCOLON TCOLON
 %left UNION INTERSECT EXCEPT
 %right COMMA
-%right JOIN INNER CROSS
+%right JOIN INNER CROSS LEFT
 %right OR
 %right CAND
 %nonassoc EQ NE LT LE GT GE IS
@@ -1468,6 +1468,16 @@
                                              (#1 fitem1 @ #1 fitem2,
                                               (EApp (e, tru), loc))
                                          end)
+       | fitem LEFT JOIN fitem ON sqlexp (let
+                                             val loc = s (fitem1left, sqlexpright)
+                                                       
+                                             val e = (EVar (["Basis"], "sql_left_join", Infer), loc)
+                                             val e = (EApp (e, #2 fitem1), loc)
+                                             val e = (EApp (e, #2 fitem2), loc)
+                                         in
+                                             (#1 fitem1 @ #1 fitem2,
+                                              (EApp (e, sqlexp), loc))
+                                         end)
 
 tname  : CSYMBOL                        (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
        | LBRACE cexp RBRACE             (cexp)