comparison src/urweb.grm @ 303:7204fab29486

Parsing UPDATE
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 14:15:16 -0400
parents bc89dfdbc495
children 148ba06f3e67
comparison
equal deleted inserted replaced
302:bc89dfdbc495 303:7204fab29486
281 | sqlagg of string 281 | sqlagg of string
282 282
283 | texp of exp 283 | texp of exp
284 | fields of con list 284 | fields of con list
285 | sqlexps of exp list 285 | sqlexps of exp list
286 | fsets of (con * exp) list
286 287
287 288
288 %verbose (* print summary of errors *) 289 %verbose (* print summary of errors *)
289 %pos int (* positions *) 290 %pos int (* positions *)
290 %start file 291 %start file
745 ErrorMsg.errorAt loc "Length mismatch in INSERT field specification" 746 ErrorMsg.errorAt loc "Length mismatch in INSERT field specification"
746 else 747 else
747 (); 748 ();
748 (EApp (e, (ERecord (ListPair.zip (fields, sqlexps)), loc)), loc) 749 (EApp (e, (ERecord (ListPair.zip (fields, sqlexps)), loc)), loc)
749 end) 750 end)
751 | LPAREN UPDATE texp SET fsets CWHERE sqlexp RPAREN
752 (let
753 val loc = s (LPARENleft, RPARENright)
754
755 val e = (EVar (["Basis"], "update"), loc)
756 val e = (EApp (e, (ERecord fsets, loc)), loc)
757 val e = (EApp (e, texp), loc)
758 in
759 (EApp (e, sqlexp), loc)
760 end)
750 761
751 | UNDER (EWild, s (UNDERleft, UNDERright)) 762 | UNDER (EWild, s (UNDERleft, UNDERright))
752 763
753 texp : SYMBOL (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright)) 764 texp : SYMBOL (EVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright))
754 | LBRACE LBRACE eexp RBRACE RBRACE (eexp) 765 | LBRACE LBRACE eexp RBRACE RBRACE (eexp)
756 fields : fident ([fident]) 767 fields : fident ([fident])
757 | fident COMMA fields (fident :: fields) 768 | fident COMMA fields (fident :: fields)
758 769
759 sqlexps: sqlexp ([sqlexp]) 770 sqlexps: sqlexp ([sqlexp])
760 | sqlexp COMMA sqlexps (sqlexp :: sqlexps) 771 | sqlexp COMMA sqlexps (sqlexp :: sqlexps)
772
773 fsets : fident EQ sqlexp ([(fident, sqlexp)])
774 | fident EQ sqlexp COMMA fsets ((fident, sqlexp) :: fsets)
761 775
762 idents : ident ([ident]) 776 idents : ident ([ident])
763 | ident DOT idents (ident :: idents) 777 | ident DOT idents (ident :: idents)
764 778
765 etuple : eexp COMMA eexp ([eexp1, eexp2]) 779 etuple : eexp COMMA eexp ([eexp1, eexp2])