comparison src/urweb.grm @ 1427:541673c3161d

sql_arith_option; 'ALL' for relational operators
author Adam Chlipala <adam@chlipala.net>
date Fri, 25 Feb 2011 11:27:16 -0500
parents 139d019c7237
children 6f046b4bad24
comparison
equal deleted inserted replaced
1426:6365d10cd326 1427:541673c3161d
143 val e = (EApp (e, (EVar (["Basis"], "sql_" ^ oper, Infer), loc)), loc) 143 val e = (EApp (e, (EVar (["Basis"], "sql_" ^ oper, Infer), loc)), loc)
144 in 144 in
145 (EApp (e, sqlexp), loc) 145 (EApp (e, sqlexp), loc)
146 end 146 end
147 147
148 fun sql_relop (oper, sqlexp1, sqlexp2, loc) = 148 fun sql_relop (oper, all, sqlexp1, sqlexp2, loc) =
149 let 149 let
150 val e = (EVar (["Basis"], "sql_relop", Infer), loc) 150 val e = (EVar (["Basis"], "sql_relop", Infer), loc)
151 val e = (EApp (e, (EVar (["Basis"], "sql_" ^ oper, Infer), loc)), loc) 151 val e = (EApp (e, (EVar (["Basis"], "sql_" ^ oper, Infer), loc)), loc)
152 val e = (EApp (e, (EVar (["Basis"], if all then "True" else "False", Infer), loc)), loc)
152 val e = (EApp (e, sqlexp1), loc) 153 val e = (EApp (e, sqlexp1), loc)
153 in 154 in
154 (EApp (e, sqlexp2), loc) 155 (EApp (e, sqlexp2), loc)
155 end 156 end
156 157
401 %nonassoc DARROW 402 %nonassoc DARROW
402 %left ANDALSO 403 %left ANDALSO
403 %left ORELSE 404 %left ORELSE
404 %nonassoc COLON 405 %nonassoc COLON
405 %nonassoc DCOLON TCOLON DCOLONWILD TCOLONWILD 406 %nonassoc DCOLON TCOLON DCOLONWILD TCOLONWILD
406 %left UNION INTERSECT EXCEPT 407 %left UNION INTERSECT EXCEPT ALL
407 %right COMMA 408 %right COMMA
408 %right JOIN INNER CROSS OUTER LEFT RIGHT FULL 409 %right JOIN INNER CROSS OUTER LEFT RIGHT FULL
409 %right OR 410 %right OR
410 %right CAND 411 %right CAND
411 %nonassoc EQ NE LT LE GT GE IS 412 %nonassoc EQ NE LT LE GT GE IS
1598 1599
1599 val e = (EApp (e, re), loc) 1600 val e = (EApp (e, re), loc)
1600 in 1601 in
1601 e 1602 e
1602 end) 1603 end)
1603 | query1 UNION query1 (sql_relop ("union", query11, query12, s (query11left, query12right))) 1604 | query1 UNION query1 (sql_relop ("union", false, query11, query12, s (query11left, query12right)))
1604 | query1 INTERSECT query1 (sql_relop ("intersect", query11, query12, s (query11left, query12right))) 1605 | query1 INTERSECT query1 (sql_relop ("intersect", false, query11, query12, s (query11left, query12right)))
1605 | query1 EXCEPT query1 (sql_relop ("except", query11, query12, s (query11left, query12right))) 1606 | query1 EXCEPT query1 (sql_relop ("except", false, query11, query12, s (query11left, query12right)))
1607 | query1 UNION ALL query1 (sql_relop ("union", true, query11, query12, s (query11left, query12right)))
1608 | query1 INTERSECT ALL query1 (sql_relop ("intersect", true, query11, query12, s (query11left, query12right)))
1609 | query1 EXCEPT ALL query1 (sql_relop ("except", true, query11, query12, s (query11left, query12right)))
1606 | LBRACE LBRACE LBRACE eexp RBRACE RBRACE RBRACE (eexp) 1610 | LBRACE LBRACE LBRACE eexp RBRACE RBRACE RBRACE (eexp)
1607 1611
1608 tables : fitem (fitem) 1612 tables : fitem (fitem)
1609 | fitem COMMA tables (let 1613 | fitem COMMA tables (let
1610 val loc = s (fitemleft, tablesright) 1614 val loc = s (fitemleft, tablesright)