comparison src/cjrize.sml @ 707:d8217b4cb617

PRIMARY KEY
author Adam Chlipala <adamc@hcoop.net>
date Tue, 07 Apr 2009 16:14:31 -0400
parents 70cbdcf5989b
children f152f215a02c
comparison
equal deleted inserted replaced
706:1fb318c17546 707:d8217b4cb617
522 val (t, sm) = cifyTyp (t, sm) 522 val (t, sm) = cifyTyp (t, sm)
523 in 523 in
524 (NONE, SOME (ek, "/" ^ s, n, ts, t, L'.ServerAndPullAndPush), sm) 524 (NONE, SOME (ek, "/" ^ s, n, ts, t, L'.ServerAndPullAndPush), sm)
525 end 525 end
526 526
527 | L.DTable (s, xts, e) => 527 | L.DTable (s, xts, pe, ce) =>
528 let 528 let
529 val (xts, sm) = ListUtil.foldlMap (fn ((x, t), sm) => 529 val (xts, sm) = ListUtil.foldlMap (fn ((x, t), sm) =>
530 let 530 let
531 val (t, sm) = cifyTyp (t, sm) 531 val (t, sm) = cifyTyp (t, sm)
532 in 532 in
538 L.ERecord [] => [] 538 L.ERecord [] => []
539 | L.ERecord [(x, (L.EPrim (Prim.String v), _), _)] => [(x, v)] 539 | L.ERecord [(x, (L.EPrim (Prim.String v), _), _)] => [(x, v)]
540 | L.EStrcat (e1, e2) => flatten e1 @ flatten e2 540 | L.EStrcat (e1, e2) => flatten e1 @ flatten e2
541 | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined"; 541 | _ => (ErrorMsg.errorAt loc "Constraint has not been fully determined";
542 Print.prefaces "Undetermined constraint" 542 Print.prefaces "Undetermined constraint"
543 [("e", MonoPrint.p_exp MonoEnv.empty e)]; 543 [("e", MonoPrint.p_exp MonoEnv.empty e)];
544 []) 544 [])
545 in 545
546 (SOME (L'.DTable (s, xts, flatten e), loc), NONE, sm) 546 val pe = case #1 pe of
547 L.EPrim (Prim.String s) => s
548 | _ => (ErrorMsg.errorAt loc "Primary key has not been fully determined";
549 Print.prefaces "Undetermined constraint"
550 [("e", MonoPrint.p_exp MonoEnv.empty pe)];
551 "")
552 in
553 (SOME (L'.DTable (s, xts, pe, flatten ce), loc), NONE, sm)
547 end 554 end
548 | L.DSequence s => 555 | L.DSequence s =>
549 (SOME (L'.DSequence s, loc), NONE, sm) 556 (SOME (L'.DSequence s, loc), NONE, sm)
550 | L.DDatabase s => (SOME (L'.DDatabase s, loc), NONE, sm) 557 | L.DDatabase s => (SOME (L'.DDatabase s, loc), NONE, sm)
551 | L.DJavaScript s => (SOME (L'.DJavaScript s, loc), NONE, sm) 558 | L.DJavaScript s => (SOME (L'.DJavaScript s, loc), NONE, sm)