comparison src/elab_util.sml @ 1073:b2311dfb3158

Initializers and setval
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Dec 2009 14:20:41 -0500
parents b2413e4dd109
children 0657e5adc938
comparison
equal deleted inserted replaced
1072:9001966ae1c8 1073:b2311dfb3158
851 | DDatabase _ => ctx 851 | DDatabase _ => ctx
852 | DCookie (tn, x, n, c) => 852 | DCookie (tn, x, n, c) =>
853 bind (ctx, NamedE (x, (CApp ((CModProj (n, [], "cookie"), loc), 853 bind (ctx, NamedE (x, (CApp ((CModProj (n, [], "cookie"), loc),
854 c), loc))) 854 c), loc)))
855 | DStyle (tn, x, n) => 855 | DStyle (tn, x, n) =>
856 bind (ctx, NamedE (x, (CModProj (n, [], "css_class"), loc))), 856 bind (ctx, NamedE (x, (CModProj (n, [], "css_class"), loc)))
857 | DInitializer _ => ctx,
857 mfd ctx d)) ctx ds, 858 mfd ctx d)) ctx ds,
858 fn ds' => (StrConst ds', loc)) 859 fn ds' => (StrConst ds', loc))
859 | StrVar _ => S.return2 strAll 860 | StrVar _ => S.return2 strAll
860 | StrProj (str, x) => 861 | StrProj (str, x) =>
861 S.map2 (mfst ctx str, 862 S.map2 (mfst ctx str,
976 | DCookie (tn, x, n, c) => 977 | DCookie (tn, x, n, c) =>
977 S.map2 (mfc ctx c, 978 S.map2 (mfc ctx c,
978 fn c' => 979 fn c' =>
979 (DCookie (tn, x, n, c'), loc)) 980 (DCookie (tn, x, n, c'), loc))
980 | DStyle _ => S.return2 dAll 981 | DStyle _ => S.return2 dAll
982 | DInitializer e =>
983 S.map2 (mfe ctx e,
984 fn e' =>
985 (DInitializer e', loc))
981 986
982 and mfvi ctx (x, n, c, e) = 987 and mfvi ctx (x, n, c, e) =
983 S.bind2 (mfc ctx c, 988 S.bind2 (mfc ctx c,
984 fn c' => 989 fn c' =>
985 S.map2 (mfe ctx e, 990 S.map2 (mfe ctx e,
1118 | DSequence (n1, _, n2) => Int.max (n1, n2) 1123 | DSequence (n1, _, n2) => Int.max (n1, n2)
1119 | DView (n1, _, n2, _, _) => Int.max (n1, n2) 1124 | DView (n1, _, n2, _, _) => Int.max (n1, n2)
1120 | DDatabase _ => 0 1125 | DDatabase _ => 0
1121 | DCookie (n1, _, n2, _) => Int.max (n1, n2) 1126 | DCookie (n1, _, n2, _) => Int.max (n1, n2)
1122 | DStyle (n1, _, n2) => Int.max (n1, n2) 1127 | DStyle (n1, _, n2) => Int.max (n1, n2)
1128 | DInitializer _ => 0
1123 and maxNameStr (str, _) = 1129 and maxNameStr (str, _) =
1124 case str of 1130 case str of
1125 StrConst ds => maxName ds 1131 StrConst ds => maxName ds
1126 | StrVar n => n 1132 | StrVar n => n
1127 | StrProj (str, _) => maxNameStr str 1133 | StrProj (str, _) => maxNameStr str