summaryrefslogtreecommitdiff
path: root/src/cjrize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-28 15:04:37 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-28 15:04:37 -0400
commit51f2a80dac5c3cd25a27fb5abfdfa50d813ab0b2 (patch)
treee4e2246dc15a7cbbf067401a21197b6fd17ea95b /src/cjrize.sml
parentcaf010bca085bea65037d194c3eb21ca8b83c23b (diff)
A view query works
Diffstat (limited to 'src/cjrize.sml')
-rw-r--r--src/cjrize.sml28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cjrize.sml b/src/cjrize.sml
index ee2ecdb6..19aeee4e 100644
--- a/src/cjrize.sml
+++ b/src/cjrize.sml
@@ -562,6 +562,34 @@ fun cifyDecl ((d, loc), sm) =
end
| L.DSequence s =>
(SOME (L'.DSequence s, loc), NONE, sm)
+ | L.DView (s, xts, e) =>
+ let
+ val (xts, sm) = ListUtil.foldlMap (fn ((x, t), sm) =>
+ let
+ val (t, sm) = cifyTyp (t, sm)
+ in
+ ((x, t), sm)
+ end) sm xts
+
+ fun flatten e =
+ case #1 e of
+ L.ERecord [] => []
+ | L.ERecord [(x, (L.EPrim (Prim.String v), _), _)] => [(x, v)]
+ | L.EStrcat (e1, e2) => flatten e1 @ flatten e2
+ | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined";
+ Print.prefaces "Undetermined constraint"
+ [("e", MonoPrint.p_exp MonoEnv.empty e)];
+ [])
+
+ val e = case #1 e of
+ L.EPrim (Prim.String s) => s
+ | _ => (ErrorMsg.errorAt loc "VIEW query has not been fully determined";
+ Print.prefaces "Undetermined VIEW query"
+ [("e", MonoPrint.p_exp MonoEnv.empty e)];
+ "")
+ in
+ (SOME (L'.DView (s, xts, e), loc), NONE, sm)
+ end
| L.DDatabase s => (SOME (L'.DDatabase s, loc), NONE, sm)
| L.DJavaScript s => (SOME (L'.DJavaScript s, loc), NONE, sm)
| L.DCookie args => (SOME (L'.DCookie args, loc), NONE, sm)