comparison src/elab_env.sml @ 338:e976b187d73a

SQL sequences
author Adam Chlipala <adamc@hcoop.net>
date Sun, 14 Sep 2008 11:02:18 -0400
parents 58f1260f293f
children 389399d65331
comparison
equal deleted inserted replaced
337:18d5affa790d 338:e976b187d73a
544 | SgiVal _ => (sgns, strs, cons) 544 | SgiVal _ => (sgns, strs, cons)
545 | SgiSgn (x, n, _) => (IM.insert (sgns, n, x), strs, cons) 545 | SgiSgn (x, n, _) => (IM.insert (sgns, n, x), strs, cons)
546 | SgiStr (x, n, _) => (sgns, IM.insert (strs, n, x), cons) 546 | SgiStr (x, n, _) => (sgns, IM.insert (strs, n, x), cons)
547 | SgiConstraint _ => (sgns, strs, cons) 547 | SgiConstraint _ => (sgns, strs, cons)
548 | SgiTable _ => (sgns, strs, cons) 548 | SgiTable _ => (sgns, strs, cons)
549 | SgiSequence _ => (sgns, strs, cons)
549 | SgiClassAbs (x, n) => (sgns, strs, IM.insert (cons, n, x)) 550 | SgiClassAbs (x, n) => (sgns, strs, IM.insert (cons, n, x))
550 | SgiClass (x, n, _) => (sgns, strs, IM.insert (cons, n, x)) 551 | SgiClass (x, n, _) => (sgns, strs, IM.insert (cons, n, x))
551 552
552 fun sgnSeek f sgis = 553 fun sgnSeek f sgis =
553 let 554 let
833 | SgiSgn (x, n, sgn) => pushSgnNamedAs env x n sgn 834 | SgiSgn (x, n, sgn) => pushSgnNamedAs env x n sgn
834 | SgiConstraint _ => env 835 | SgiConstraint _ => env
835 836
836 | SgiTable (tn, x, n, c) => 837 | SgiTable (tn, x, n, c) =>
837 let 838 let
838 val t = (CApp ((CModProj (tn, [], "table"), loc), c), loc) 839 val t = (CApp ((CModProj (tn, [], "sql_table"), loc), c), loc)
840 in
841 pushENamedAs env x n t
842 end
843 | SgiSequence (tn, x, n) =>
844 let
845 val t = (CModProj (tn, [], "sql_sequence"), loc)
839 in 846 in
840 pushENamedAs env x n t 847 pushENamedAs env x n t
841 end 848 end
842 849
843 | SgiClassAbs (x, n) => pushCNamedAs env x n (KArrow ((KType, loc), (KType, loc)), loc) NONE 850 | SgiClassAbs (x, n) => pushCNamedAs env x n (KArrow ((KType, loc), (KType, loc)), loc) NONE
973 | SgiDatatypeImp (x, n, _, _, _, _, _) => seek (sgis, sgns, strs, IM.insert (cons, n, x), acc) 980 | SgiDatatypeImp (x, n, _, _, _, _, _) => seek (sgis, sgns, strs, IM.insert (cons, n, x), acc)
974 | SgiVal _ => seek (sgis, sgns, strs, cons, acc) 981 | SgiVal _ => seek (sgis, sgns, strs, cons, acc)
975 | SgiSgn (x, n, _) => seek (sgis, IM.insert (sgns, n, x), strs, cons, acc) 982 | SgiSgn (x, n, _) => seek (sgis, IM.insert (sgns, n, x), strs, cons, acc)
976 | SgiStr (x, n, _) => seek (sgis, sgns, IM.insert (strs, n, x), cons, acc) 983 | SgiStr (x, n, _) => seek (sgis, sgns, IM.insert (strs, n, x), cons, acc)
977 | SgiTable _ => seek (sgis, sgns, strs, cons, acc) 984 | SgiTable _ => seek (sgis, sgns, strs, cons, acc)
985 | SgiSequence _ => seek (sgis, sgns, strs, cons, acc)
978 | SgiClassAbs (x, n) => seek (sgis, sgns, strs, IM.insert (cons, n, x), acc) 986 | SgiClassAbs (x, n) => seek (sgis, sgns, strs, IM.insert (cons, n, x), acc)
979 | SgiClass (x, n, _) => seek (sgis, sgns, strs, IM.insert (cons, n, x), acc) 987 | SgiClass (x, n, _) => seek (sgis, sgns, strs, IM.insert (cons, n, x), acc)
980 in 988 in
981 seek (sgis, IM.empty, IM.empty, IM.empty, []) 989 seek (sgis, IM.empty, IM.empty, IM.empty, [])
982 end 990 end
1047 | DFfiStr (x, n, sgn) => pushStrNamedAs env x n sgn 1055 | DFfiStr (x, n, sgn) => pushStrNamedAs env x n sgn
1048 | DConstraint _ => env 1056 | DConstraint _ => env
1049 | DExport _ => env 1057 | DExport _ => env
1050 | DTable (tn, x, n, c) => 1058 | DTable (tn, x, n, c) =>
1051 let 1059 let
1052 val t = (CApp ((CModProj (tn, [], "table"), loc), c), loc) 1060 val t = (CApp ((CModProj (tn, [], "sql_table"), loc), c), loc)
1061 in
1062 pushENamedAs env x n t
1063 end
1064 | DSequence (tn, x, n) =>
1065 let
1066 val t = (CModProj (tn, [], "sql_sequence"), loc)
1053 in 1067 in
1054 pushENamedAs env x n t 1068 pushENamedAs env x n t
1055 end 1069 end
1056 | DClass (x, n, c) => 1070 | DClass (x, n, c) =>
1057 let 1071 let