Mercurial > urweb
comparison src/lacweb.grm @ 219:5292c0113024
SQL comparison operators
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 16 Aug 2008 17:18:00 -0400 |
parents | ba4d7c33a45f |
children | 2b665e822e9a |
comparison
equal
deleted
inserted
replaced
218:a3413288cce1 | 219:5292c0113024 |
---|---|
77 val e = (EApp ((EVar (["Basis"], "sql_inject"), loc), (v, loc)), loc) | 77 val e = (EApp ((EVar (["Basis"], "sql_inject"), loc), (v, loc)), loc) |
78 in | 78 in |
79 (EApp (e, (t, loc)), loc) | 79 (EApp (e, (t, loc)), loc) |
80 end | 80 end |
81 | 81 |
82 fun sql_compare (oper, sqlexp1, sqlexp2, loc) = | |
83 let | |
84 val e = (EVar (["Basis"], "sql_comparison"), loc) | |
85 val e = (EApp (e, (EVar (["Basis"], "sql_" ^ oper), loc)), loc) | |
86 val e = (EApp (e, sqlexp1), loc) | |
87 val e = (EApp (e, sqlexp2), loc) | |
88 in | |
89 (EApp (e, (EWild, loc)), loc) | |
90 end | |
91 | |
82 %% | 92 %% |
83 %header (functor LacwebLrValsFn(structure Token : TOKEN)) | 93 %header (functor LacwebLrValsFn(structure Token : TOKEN)) |
84 | 94 |
85 %term | 95 %term |
86 EOF | 96 EOF |
87 | STRING of string | INT of Int64.int | FLOAT of Real64.real | 97 | STRING of string | INT of Int64.int | FLOAT of Real64.real |
88 | SYMBOL of string | CSYMBOL of string | 98 | SYMBOL of string | CSYMBOL of string |
89 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE | 99 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE |
90 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER | BAR | 100 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER | BAR |
91 | DIVIDE | GT | DOTDOTDOT | 101 | DIVIDE | DOTDOTDOT |
92 | CON | LTYPE | VAL | REC | AND | FOLD | UNIT | KUNIT | CLASS | 102 | CON | LTYPE | VAL | REC | AND | FOLD | UNIT | KUNIT | CLASS |
93 | DATATYPE | OF | 103 | DATATYPE | OF |
94 | TYPE | NAME | 104 | TYPE | NAME |
95 | ARROW | LARROW | DARROW | STAR | 105 | ARROW | LARROW | DARROW | STAR |
96 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE | 106 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE |
102 | NOTAGS of string | 112 | NOTAGS of string |
103 | BEGIN_TAG of string | END_TAG of string | 113 | BEGIN_TAG of string | END_TAG of string |
104 | 114 |
105 | SELECT | FROM | AS | CWHERE | 115 | SELECT | FROM | AS | CWHERE |
106 | TRUE | FALSE | 116 | TRUE | FALSE |
117 | NE | LT | LE | GT | GE | |
107 | 118 |
108 %nonterm | 119 %nonterm |
109 file of decl list | 120 file of decl list |
110 | decls of decl list | 121 | decls of decl list |
111 | decl of decl | 122 | decl of decl |
190 %nonassoc IF THEN ELSE | 201 %nonassoc IF THEN ELSE |
191 %nonassoc DARROW | 202 %nonassoc DARROW |
192 %nonassoc COLON | 203 %nonassoc COLON |
193 %nonassoc DCOLON TCOLON | 204 %nonassoc DCOLON TCOLON |
194 %right COMMA | 205 %right COMMA |
206 %nonassoc EQ NE LT LE GT GE | |
195 %right ARROW LARROW | 207 %right ARROW LARROW |
196 %right PLUSPLUS MINUSMINUS | 208 %right PLUSPLUS MINUSMINUS |
197 %right STAR | 209 %right STAR |
198 %nonassoc TWIDDLE | 210 %nonassoc TWIDDLE |
199 %nonassoc DOLLAR | 211 %nonassoc DOLLAR |
649 s (TRUEleft, TRUEright))) | 661 s (TRUEleft, TRUEright))) |
650 | FALSE (sql_inject (EVar (["Basis"], "False"), | 662 | FALSE (sql_inject (EVar (["Basis"], "False"), |
651 EVar (["Basis"], "sql_bool"), | 663 EVar (["Basis"], "sql_bool"), |
652 s (FALSEleft, FALSEright))) | 664 s (FALSEleft, FALSEright))) |
653 | 665 |
666 | sqlexp EQ sqlexp (sql_compare ("eq", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) | |
667 | sqlexp NE sqlexp (sql_compare ("ne", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) | |
668 | sqlexp LT sqlexp (sql_compare ("lt", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) | |
669 | sqlexp LE sqlexp (sql_compare ("le", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) | |
670 | sqlexp GT sqlexp (sql_compare ("gt", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) | |
671 | sqlexp GE sqlexp (sql_compare ("ge", sqlexp1, sqlexp2, s (sqlexp1left, sqlexp2right))) | |
672 | |
654 | LBRACE eexp RBRACE (sql_inject (#1 eexp, | 673 | LBRACE eexp RBRACE (sql_inject (#1 eexp, |
655 EWild, | 674 EWild, |
656 s (LBRACEleft, RBRACEright))) | 675 s (LBRACEleft, RBRACEright))) |
657 | 676 |
658 wopt : (sql_inject (EVar (["Basis"], "True"), | 677 wopt : (sql_inject (EVar (["Basis"], "True"), |