diff src/urweb.grm @ 1572:5530a8075b62

IF THEN ELSE conditional for SQL.
author Karn Kallio <kkallio@eka>
date Fri, 14 Oct 2011 02:33:03 -0430
parents a0caa991cdad
children 644558d9c756
line wrap: on
line diff
--- a/src/urweb.grm	Sat Oct 08 17:23:58 2011 -0400
+++ b/src/urweb.grm	Fri Oct 14 02:33:03 2011 -0430
@@ -249,6 +249,7 @@
  | NE | LT | LE | GT | GE
  | CCONSTRAINT | UNIQUE | CHECK | PRIMARY | FOREIGN | KEY | ON | NO | ACTION | RESTRICT | CASCADE | REFERENCES
  | JOIN | INNER | CROSS | OUTER | LEFT | RIGHT | FULL
+ | CIF | CTHEN | CELSE
 
 %nonterm
    file of decl list
@@ -1828,6 +1829,13 @@
                                                     sqlexp), loc)
                                          end)
 
+       | CIF sqlexp CTHEN sqlexp CELSE sqlexp (let
+                                                   val loc = s (CIFleft, sqlexp3right)
+                                                   val e = (EVar (["Basis"], "sql_if_then_else", Infer), loc) 
+                                               in
+                                                   (EApp ((EApp ((EApp (e, sqlexp1), loc), sqlexp2), loc), sqlexp3), loc)
+                                               end)
+
        | LBRACE LBRACK eexp RBRACK RBRACE  (sql_inject (#1 eexp,
                                                         s (LBRACEleft, RBRACEright)))
        | LPAREN sqlexp RPAREN           (sqlexp)