comparison src/urweb.grm @ 341:389399d65331

Crud update form
author Adam Chlipala <adamc@hcoop.net>
date Sun, 14 Sep 2008 19:03:55 -0400
parents 075b36dbb1a4
children f55034419a07
comparison
equal deleted inserted replaced
340:5ccb1c6412e4 341:389399d65331
41 | _ => t 41 | _ => t
42 42
43 datatype select_item = 43 datatype select_item =
44 Field of con * con 44 Field of con * con
45 | Exp of con * exp 45 | Exp of con * exp
46 | Fields of con * con
46 47
47 datatype select = 48 datatype select =
48 Star 49 Star
49 | Items of select_item list 50 | Items of select_item list
50 51
64 val c = (CRecord ([(fx, (CWild (KType, loc), loc))]), loc) 65 val c = (CRecord ([(fx, (CWild (KType, loc), loc))]), loc)
65 66
66 val (tabs, found) = ListUtil.foldlMap (fn ((tx', c'), found) => 67 val (tabs, found) = ListUtil.foldlMap (fn ((tx', c'), found) =>
67 if eqTnames (tx, tx') then 68 if eqTnames (tx, tx') then
68 ((tx', (CConcat (c, c'), loc)), true) 69 ((tx', (CConcat (c, c'), loc)), true)
70 else
71 ((tx', c'), found))
72 false tabs
73 in
74 if found then
75 ()
76 else
77 ErrorMsg.errorAt loc "Select of field from unbound table";
78
79 (tabs, exps)
80 end
81 | Fields (tx, fs) =>
82 let
83 val (tabs, found) = ListUtil.foldlMap (fn ((tx', c'), found) =>
84 if eqTnames (tx, tx') then
85 ((tx', (CConcat (fs, c'), loc)), true)
69 else 86 else
70 ((tx', c'), found)) 87 ((tx', c'), found))
71 false tabs 88 false tabs
72 in 89 in
73 if found then 90 if found then
1039 fident : CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright)) 1056 fident : CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
1040 | LBRACE cexp RBRACE (cexp) 1057 | LBRACE cexp RBRACE (cexp)
1041 1058
1042 seli : tident DOT fident (Field (tident, fident)) 1059 seli : tident DOT fident (Field (tident, fident))
1043 | sqlexp AS fident (Exp (fident, sqlexp)) 1060 | sqlexp AS fident (Exp (fident, sqlexp))
1061 | tident DOT LBRACE LBRACE cexp RBRACE RBRACE (Fields (tident, cexp))
1044 1062
1045 selis : seli ([seli]) 1063 selis : seli ([seli])
1046 | seli COMMA selis (seli :: selis) 1064 | seli COMMA selis (seli :: selis)
1047 1065
1048 select : STAR (Star) 1066 select : STAR (Star)