comparison 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
comparison
equal deleted inserted replaced
220:2b665e822e9a 221:79819a6346e2
228 %right STAR 228 %right STAR
229 %left NOT 229 %left NOT
230 %nonassoc TWIDDLE 230 %nonassoc TWIDDLE
231 %nonassoc DOLLAR 231 %nonassoc DOLLAR
232 %left DOT 232 %left DOT
233 %nonassoc LBRACE RBRACE
233 234
234 %% 235 %%
235 236
236 file : decls (decls) 237 file : decls (decls)
237 | SIG sgis ([(DSgn ("?", (SgnConst sgis, s (SIGleft, sgisright))), 238 | SIG sgis ([(DSgn ("?", (SgnConst sgis, s (SIGleft, sgisright))),
657 | LBRACE cexp RBRACE (cexp) 658 | LBRACE cexp RBRACE (cexp)
658 659
659 table : SYMBOL ((CName SYMBOL, s (SYMBOLleft, SYMBOLright)), 660 table : SYMBOL ((CName SYMBOL, s (SYMBOLleft, SYMBOLright)),
660 (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright))) 661 (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright)))
661 | SYMBOL AS tname (tname, (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright))) 662 | SYMBOL AS tname (tname, (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright)))
662 | LBRACE eexp RBRACE AS tname (tname, eexp) 663 | LBRACE LBRACE eexp RBRACE RBRACE AS tname (tname, eexp)
663 664
664 tident : SYMBOL (CName SYMBOL, s (SYMBOLleft, SYMBOLright)) 665 tident : SYMBOL (CName SYMBOL, s (SYMBOLleft, SYMBOLright))
665 | CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright)) 666 | CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
666 | LBRACE cexp RBRACE (cexp) 667 | LBRACE LBRACE cexp RBRACE RBRACE (cexp)
667 668
668 fident : CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright)) 669 fident : CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
669 | LBRACE cexp RBRACE (cexp) 670 | LBRACE cexp RBRACE (cexp)
670 671
671 seli : tident DOT fident (Field (tident, fident)) 672 seli : tident DOT fident (Field (tident, fident))
681 s (TRUEleft, TRUEright))) 682 s (TRUEleft, TRUEright)))
682 | FALSE (sql_inject (EVar (["Basis"], "False"), 683 | FALSE (sql_inject (EVar (["Basis"], "False"),
683 EVar (["Basis"], "sql_bool"), 684 EVar (["Basis"], "sql_bool"),
684 s (FALSEleft, FALSEright))) 685 s (FALSEleft, FALSEright)))
685 686
687 | tident DOT fident (let
688 val loc = s (tidentleft, fidentright)
689 val e = (EVar (["Basis"], "sql_field"), loc)
690 val e = (ECApp (e, tident), loc)
691 in
692 (ECApp (e, fident), loc)
693 end)
694
686 | sqlexp EQ sqlexp (sql_compare ("eq", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) 695 | sqlexp EQ sqlexp (sql_compare ("eq", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))
687 | sqlexp NE sqlexp (sql_compare ("ne", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) 696 | sqlexp NE sqlexp (sql_compare ("ne", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))
688 | sqlexp LT sqlexp (sql_compare ("lt", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) 697 | sqlexp LT sqlexp (sql_compare ("lt", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))
689 | sqlexp LE sqlexp (sql_compare ("le", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) 698 | sqlexp LE sqlexp (sql_compare ("le", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))
690 | sqlexp GT sqlexp (sql_compare ("gt", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) 699 | sqlexp GT sqlexp (sql_compare ("gt", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right)))