Mercurial > urweb
comparison src/urweb.grm @ 302:bc89dfdbc495
Parsing INSERT
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 07 Sep 2008 14:07:10 -0400 |
parents | cde1ec47f3af |
children | 7204fab29486 |
comparison
equal
deleted
inserted
replaced
301:54282db31a9b | 302:bc89dfdbc495 |
---|---|
177 | UNION | INTERSECT | EXCEPT | 177 | UNION | INTERSECT | EXCEPT |
178 | LIMIT | OFFSET | ALL | 178 | LIMIT | OFFSET | ALL |
179 | TRUE | FALSE | CAND | OR | NOT | 179 | TRUE | FALSE | CAND | OR | NOT |
180 | COUNT | AVG | SUM | MIN | MAX | 180 | COUNT | AVG | SUM | MIN | MAX |
181 | ASC | DESC | 181 | ASC | DESC |
182 | INSERT | INTO | VALUES | UPDATE | SET | DELETE | |
182 | NE | LT | LE | GT | GE | 183 | NE | LT | LE | GT | GE |
183 | 184 |
184 %nonterm | 185 %nonterm |
185 file of decl list | 186 file of decl list |
186 | decls of decl list | 187 | decls of decl list |
276 | diropt of exp | 277 | diropt of exp |
277 | lopt of exp | 278 | lopt of exp |
278 | ofopt of exp | 279 | ofopt of exp |
279 | sqlint of exp | 280 | sqlint of exp |
280 | sqlagg of string | 281 | sqlagg of string |
282 | |
283 | texp of exp | |
284 | fields of con list | |
285 | sqlexps of exp list | |
281 | 286 |
282 | 287 |
283 %verbose (* print summary of errors *) | 288 %verbose (* print summary of errors *) |
284 %pos int (* positions *) | 289 %pos int (* positions *) |
285 %start file | 290 %start file |
723 | 728 |
724 | XML_BEGIN xml XML_END (xml) | 729 | XML_BEGIN xml XML_END (xml) |
725 | XML_BEGIN XML_END (EApp ((EVar (["Basis"], "cdata"), s (XML_BEGINleft, XML_ENDright)), | 730 | XML_BEGIN XML_END (EApp ((EVar (["Basis"], "cdata"), s (XML_BEGINleft, XML_ENDright)), |
726 (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))), | 731 (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))), |
727 s (XML_BEGINleft, XML_ENDright)) | 732 s (XML_BEGINleft, XML_ENDright)) |
733 | |
728 | LPAREN query RPAREN (query) | 734 | LPAREN query RPAREN (query) |
729 | LPAREN CWHERE sqlexp RPAREN (sqlexp) | 735 | LPAREN CWHERE sqlexp RPAREN (sqlexp) |
736 | |
737 | LPAREN INSERT INTO texp LPAREN fields RPAREN VALUES LPAREN sqlexps RPAREN RPAREN | |
738 (let | |
739 val loc = s (LPAREN1left, RPAREN3right) | |
740 | |
741 val e = (EVar (["Basis"], "insert"), loc) | |
742 val e = (EApp (e, texp), loc) | |
743 in | |
744 if length fields <> length sqlexps then | |
745 ErrorMsg.errorAt loc "Length mismatch in INSERT field specification" | |
746 else | |
747 (); | |
748 (EApp (e, (ERecord (ListPair.zip (fields, sqlexps)), loc)), loc) | |
749 end) | |
750 | |
730 | UNDER (EWild, s (UNDERleft, UNDERright)) | 751 | UNDER (EWild, s (UNDERleft, UNDERright)) |
752 | |
753 texp : SYMBOL (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright)) | |
754 | LBRACE LBRACE eexp RBRACE RBRACE (eexp) | |
755 | |
756 fields : fident ([fident]) | |
757 | fident COMMA fields (fident :: fields) | |
758 | |
759 sqlexps: sqlexp ([sqlexp]) | |
760 | sqlexp COMMA sqlexps (sqlexp :: sqlexps) | |
731 | 761 |
732 idents : ident ([ident]) | 762 idents : ident ([ident]) |
733 | ident DOT idents (ident :: idents) | 763 | ident DOT idents (ident :: idents) |
734 | 764 |
735 etuple : eexp COMMA eexp ([eexp1, eexp2]) | 765 etuple : eexp COMMA eexp ([eexp1, eexp2]) |