comparison src/shake.sml @ 338:e976b187d73a

SQL sequences
author Adam Chlipala <adamc@hcoop.net>
date Sun, 14 Sep 2008 11:02:18 -0400
parents 42dfb0d61cf0
children 787d4931fb07
comparison
equal deleted inserted replaced
337:18d5affa790d 338:e976b187d73a
39 type free = { 39 type free = {
40 con : IS.set, 40 con : IS.set,
41 exp : IS.set 41 exp : IS.set
42 } 42 }
43 43
44 val dummyt = (TRecord (CRecord ((KType, ErrorMsg.dummySpan), []), ErrorMsg.dummySpan), ErrorMsg.dummySpan)
44 val dummye = (EPrim (Prim.String ""), ErrorMsg.dummySpan) 45 val dummye = (EPrim (Prim.String ""), ErrorMsg.dummySpan)
45 46
46 fun shake file = 47 fun shake file =
47 let 48 let
48 val (page_es, table_cs) = 49 val (page_es, table_cs) =
58 | ((DValRec vis, _), (cdef, edef)) => 59 | ((DValRec vis, _), (cdef, edef)) =>
59 (cdef, foldl (fn ((_, n, t, e, _), edef) => IM.insert (edef, n, (t, e))) edef vis) 60 (cdef, foldl (fn ((_, n, t, e, _), edef) => IM.insert (edef, n, (t, e))) edef vis)
60 | ((DExport _, _), acc) => acc 61 | ((DExport _, _), acc) => acc
61 | ((DTable (_, n, c, _), _), (cdef, edef)) => 62 | ((DTable (_, n, c, _), _), (cdef, edef)) =>
62 (cdef, IM.insert (edef, n, (c, dummye))) 63 (cdef, IM.insert (edef, n, (c, dummye)))
64 | ((DSequence (_, n, _), _), (cdef, edef)) =>
65 (cdef, IM.insert (edef, n, (dummyt, dummye)))
63 | ((DDatabase _, _), acc) => acc) 66 | ((DDatabase _, _), acc) => acc)
64 (IM.empty, IM.empty) file 67 (IM.empty, IM.empty) file
65 68
66 fun kind (_, s) = s 69 fun kind (_, s) = s
67 70
114 | (DDatatype (_, n, _, _), _) => IS.member (#con s, n) 117 | (DDatatype (_, n, _, _), _) => IS.member (#con s, n)
115 | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n) 118 | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n)
116 | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis 119 | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis
117 | (DExport _, _) => true 120 | (DExport _, _) => true
118 | (DTable _, _) => true 121 | (DTable _, _) => true
122 | (DSequence _, _) => true
119 | (DDatabase _, _) => true) file 123 | (DDatabase _, _) => true) file
120 end 124 end
121 125
122 end 126 end