summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/monoize.sml17
-rw-r--r--src/urweb.grm8
2 files changed, 23 insertions, 2 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index 9e5e1b38..5aebad63 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -1882,7 +1882,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
strcatComma (map (fn (x, t) =>
strcat [
(L'.EField (gf "SelectExps", x), loc),
- sc (" AS _" ^ x)
+ sc (" AS uw_" ^ x)
]) sexps
@ map (fn (x, xts) =>
strcatComma
@@ -2059,6 +2059,19 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(L'.EPrim (Prim.String (" AS T_" ^ name)), loc)]), loc),
fm)
end
+ | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "sql_from_query"), _), _),
+ _), _), _),
+ (L.CName name, _)) =>
+ let
+ val s = (L'.TFfi ("Basis", "string"), loc)
+ fun sc s = (L'.EPrim (Prim.String s), loc)
+ in
+ ((L'.EAbs ("q", s, s,
+ strcat [sc "(",
+ (L'.ERel 0, loc),
+ sc (") AS T_" ^ name)]), loc),
+ fm)
+ end
| L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "sql_from_comma"), _), _), _), _), _), _) =>
let
val s = (L'.TFfi ("Basis", "string"), loc)
@@ -2317,7 +2330,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
_), _),
_), _),
_), _),
- (L.CName nm, _)) => ((L'.EPrim (Prim.String ("_" ^ lowercaseFirst nm)), loc), fm)
+ (L.CName nm, _)) => ((L'.EPrim (Prim.String ("uw_" ^ lowercaseFirst nm)), loc), fm)
| L.ECApp (
(L.ECApp (
diff --git a/src/urweb.grm b/src/urweb.grm
index f11c3cd5..995d4664 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -1629,6 +1629,14 @@ fitem : table' ([#1 table'], #2 table')
(#1 fitem1 @ #1 fitem2,
(EApp (e, sqlexp), loc))
end)
+ | LPAREN query RPAREN AS tname (let
+ val loc = s (LPARENleft, RPARENright)
+
+ val e = (EVar (["Basis"], "sql_from_query", Infer), loc)
+ val e = (ECApp (e, tname), loc)
+ in
+ ([tname], (EApp (e, query), loc))
+ end)
tname : CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
| LBRACE cexp RBRACE (cexp)