comparison src/monoize.sml @ 1192:9c82548c97e9

Subquery FROM items
author Adam Chlipala <adamc@hcoop.net>
date Thu, 25 Mar 2010 16:06:04 -0400
parents 61c3139eab12
children aff5e661b5f8
comparison
equal deleted inserted replaced
1191:61c3139eab12 1192:9c82548c97e9
1880 (L'.EPrim (Prim.String ""), loc))], 1880 (L'.EPrim (Prim.String ""), loc))],
1881 {disc = b, result = s}), loc), 1881 {disc = b, result = s}), loc),
1882 strcatComma (map (fn (x, t) => 1882 strcatComma (map (fn (x, t) =>
1883 strcat [ 1883 strcat [
1884 (L'.EField (gf "SelectExps", x), loc), 1884 (L'.EField (gf "SelectExps", x), loc),
1885 sc (" AS _" ^ x) 1885 sc (" AS uw_" ^ x)
1886 ]) sexps 1886 ]) sexps
1887 @ map (fn (x, xts) => 1887 @ map (fn (x, xts) =>
1888 strcatComma 1888 strcatComma
1889 (map (fn (x', _) => 1889 (map (fn (x', _) =>
1890 sc ("T_" ^ x 1890 sc ("T_" ^ x
2057 ((L'.EAbs ("tab", s, s, 2057 ((L'.EAbs ("tab", s, s,
2058 strcat [(L'.ERel 0, loc), 2058 strcat [(L'.ERel 0, loc),
2059 (L'.EPrim (Prim.String (" AS T_" ^ name)), loc)]), loc), 2059 (L'.EPrim (Prim.String (" AS T_" ^ name)), loc)]), loc),
2060 fm) 2060 fm)
2061 end 2061 end
2062 | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "sql_from_query"), _), _),
2063 _), _), _),
2064 (L.CName name, _)) =>
2065 let
2066 val s = (L'.TFfi ("Basis", "string"), loc)
2067 fun sc s = (L'.EPrim (Prim.String s), loc)
2068 in
2069 ((L'.EAbs ("q", s, s,
2070 strcat [sc "(",
2071 (L'.ERel 0, loc),
2072 sc (") AS T_" ^ name)]), loc),
2073 fm)
2074 end
2062 | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "sql_from_comma"), _), _), _), _), _), _) => 2075 | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "sql_from_comma"), _), _), _), _), _), _) =>
2063 let 2076 let
2064 val s = (L'.TFfi ("Basis", "string"), loc) 2077 val s = (L'.TFfi ("Basis", "string"), loc)
2065 in 2078 in
2066 ((L'.EAbs ("tab1", s, (L'.TFun (s, s), loc), 2079 ((L'.EAbs ("tab1", s, (L'.TFun (s, s), loc),
2315 (L.EFfi ("Basis", "sql_exp"), _), 2328 (L.EFfi ("Basis", "sql_exp"), _),
2316 _), _), 2329 _), _),
2317 _), _), 2330 _), _),
2318 _), _), 2331 _), _),
2319 _), _), 2332 _), _),
2320 (L.CName nm, _)) => ((L'.EPrim (Prim.String ("_" ^ lowercaseFirst nm)), loc), fm) 2333 (L.CName nm, _)) => ((L'.EPrim (Prim.String ("uw_" ^ lowercaseFirst nm)), loc), fm)
2321 2334
2322 | L.ECApp ( 2335 | L.ECApp (
2323 (L.ECApp ( 2336 (L.ECApp (
2324 (L.ECApp ( 2337 (L.ECApp (
2325 (L.ECApp ( 2338 (L.ECApp (