comparison src/cjrize.sml @ 2211:ef766ef6e242

Merge.
author Ziv Scully <ziv@mit.edu>
date Sat, 13 Sep 2014 19:16:07 -0400
parents a9159911c3ba
children 278e10629ba1
comparison
equal deleted inserted replaced
2210:69c0f36255cb 2211:ef766ef6e242
240 240
241 fun cifyExp (eAll as (e, loc), sm) = 241 fun cifyExp (eAll as (e, loc), sm) =
242 let 242 let
243 fun fail msg = 243 fun fail msg =
244 (ErrorMsg.errorAt loc msg; 244 (ErrorMsg.errorAt loc msg;
245 ((L'.EPrim (Prim.String ""), loc), sm)) 245 ((L'.EPrim (Prim.String (Prim.Normal, "")), loc), sm))
246 in 246 in
247 case e of 247 case e of
248 L.EPrim p => ((L'.EPrim p, loc), sm) 248 L.EPrim p => ((L'.EPrim p, loc), sm)
249 | L.ERel n => ((L'.ERel n, loc), sm) 249 | L.ERel n => ((L'.ERel n, loc), sm)
250 | L.ENamed n => ((L'.ENamed n, loc), sm) 250 | L.ENamed n => ((L'.ENamed n, loc), sm)
630 end) sm xts 630 end) sm xts
631 631
632 fun flatten e = 632 fun flatten e =
633 case #1 e of 633 case #1 e of
634 L.ERecord [] => [] 634 L.ERecord [] => []
635 | L.ERecord [(x, (L.EPrim (Prim.String v), _), _)] => [(x, v)] 635 | L.ERecord [(x, (L.EPrim (Prim.String (_, v)), _), _)] => [(x, v)]
636 | L.EStrcat (e1, e2) => flatten e1 @ flatten e2 636 | L.EStrcat (e1, e2) => flatten e1 @ flatten e2
637 | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined"; 637 | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined";
638 Print.prefaces "Undetermined constraint" 638 Print.prefaces "Undetermined constraint"
639 [("e", MonoPrint.p_exp MonoEnv.empty e)]; 639 [("e", MonoPrint.p_exp MonoEnv.empty e)];
640 []) 640 [])
641 641
642 val pe = case #1 pe of 642 val pe = case #1 pe of
643 L.EPrim (Prim.String s) => s 643 L.EPrim (Prim.String (_, s)) => s
644 | _ => (ErrorMsg.errorAt loc "Primary key has not been fully determined"; 644 | _ => (ErrorMsg.errorAt loc "Primary key has not been fully determined";
645 Print.prefaces "Undetermined constraint" 645 Print.prefaces "Undetermined constraint"
646 [("e", MonoPrint.p_exp MonoEnv.empty pe)]; 646 [("e", MonoPrint.p_exp MonoEnv.empty pe)];
647 "") 647 "")
648 in 648 in
660 end) sm xts 660 end) sm xts
661 661
662 fun flatten e = 662 fun flatten e =
663 case #1 e of 663 case #1 e of
664 L.ERecord [] => [] 664 L.ERecord [] => []
665 | L.ERecord [(x, (L.EPrim (Prim.String v), _), _)] => [(x, v)] 665 | L.ERecord [(x, (L.EPrim (Prim.String (_, v)), _), _)] => [(x, v)]
666 | L.EStrcat (e1, e2) => flatten e1 @ flatten e2 666 | L.EStrcat (e1, e2) => flatten e1 @ flatten e2
667 | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined"; 667 | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined";
668 Print.prefaces "Undetermined constraint" 668 Print.prefaces "Undetermined constraint"
669 [("e", MonoPrint.p_exp MonoEnv.empty e)]; 669 [("e", MonoPrint.p_exp MonoEnv.empty e)];
670 []) 670 [])
671 671
672 val e = case #1 e of 672 val e = case #1 e of
673 L.EPrim (Prim.String s) => s 673 L.EPrim (Prim.String (_, s)) => s
674 | _ => (ErrorMsg.errorAt loc "VIEW query has not been fully determined"; 674 | _ => (ErrorMsg.errorAt loc "VIEW query has not been fully determined";
675 Print.prefaces "Undetermined VIEW query" 675 Print.prefaces "Undetermined VIEW query"
676 [("e", MonoPrint.p_exp MonoEnv.empty e)]; 676 [("e", MonoPrint.p_exp MonoEnv.empty e)];
677 "") 677 "")
678 in 678 in
728 in 728 in
729 (dsF, ds, ps, Sm.clearDeclares sm) 729 (dsF, ds, ps, Sm.clearDeclares sm)
730 end) 730 end)
731 ([], [], [], Sm.empty) ds 731 ([], [], [], Sm.empty) ds
732 732
733 val sideInfo = foldl (fn ((n, mode), mp) => IM.insert (mp, n, mode)) IM.empty sideInfo 733 val sideInfo = foldl (fn ((n, mode, dbmode), mp) => IM.insert (mp, n, (mode, dbmode))) IM.empty sideInfo
734 734
735 val ps = map (fn (ek, s, n, ts, t, _, b) => 735 val ps = map (fn (ek, s, n, ts, t, _, b) =>
736 (ek, s, n, ts, t, 736 let
737 getOpt (IM.find (sideInfo, n), L'.ServerOnly), 737 val (side, db) = getOpt (IM.find (sideInfo, n), (L'.ServerOnly, L'.AnyDb))
738 b)) ps 738 in
739 (ek, s, n, ts, t, side, db, b)
740 end) ps
739 in 741 in
740 (List.revAppend (dsF, rev ds), 742 (List.revAppend (dsF, rev ds),
741 ps) 743 ps)
742 end 744 end
743 745