comparison src/monoize.sml @ 141:63c699450281

Initial form support
author Adam Chlipala <adamc@hcoop.net>
date Sun, 20 Jul 2008 11:33:23 -0400
parents f214c535d253
children 4b9c2bd6157c
comparison
equal deleted inserted replaced
140:f214c535d253 141:63c699450281
138 | L.EFfi mx => (L'.EFfi mx, loc) 138 | L.EFfi mx => (L'.EFfi mx, loc)
139 | L.EFfiApp (m, x, es) => (L'.EFfiApp (m, x, map (monoExp env) es), loc) 139 | L.EFfiApp (m, x, es) => (L'.EFfiApp (m, x, map (monoExp env) es), loc)
140 140
141 | L.EApp ( 141 | L.EApp (
142 (L.ECApp ( 142 (L.ECApp (
143 (L.ECApp ( 143 (L.ECApp ((L.EFfi ("Basis", "cdata"), _), _), _),
144 (L.ECApp ((L.EFfi ("Basis", "cdata"), _), _), _),
145 _), _),
146 _), _), 144 _), _),
147 se) => (L'.EFfiApp ("Basis", "htmlifyString", [monoExp env se]), loc) 145 se) => (L'.EFfiApp ("Basis", "htmlifyString", [monoExp env se]), loc)
148 | L.EApp ( 146 | L.EApp (
149 (L.EApp ( 147 (L.EApp (
150 (L.ECApp ( 148 (L.ECApp (
232 loc) 230 loc)
233 231
234 232
235 in 233 in
236 case xml of 234 case xml of
237 (L.EApp ((L.ECApp ((L.EFfi ("Basis", "cdata"), _), 235 (L.EApp ((L.ECApp (
238 _), _), (L.EPrim (Prim.String s), _)), _) => 236 (L.ECApp ((L.EFfi ("Basis", "cdata"), _),
237 _), _),
238 _), _),
239 (L.EPrim (Prim.String s), _)), _) =>
239 if CharVector.all Char.isSpace s then 240 if CharVector.all Char.isSpace s then
240 (L'.EStrcat (tagStart, (L'.EPrim (Prim.String "/>"), loc)), loc) 241 (L'.EStrcat (tagStart, (L'.EPrim (Prim.String "/>"), loc)), loc)
241 else 242 else
242 normal () 243 normal ()
243 | _ => normal () 244 | _ => normal ()
244 end 245 end
246
247 | L.EApp ((L.ECApp (
248 (L.ECApp ((L.EFfi ("Basis", "lform"), _), _), _),
249 _), _),
250 xml) =>
251 (L'.EStrcat ((L'.EPrim (Prim.String "<form>"), loc),
252 (L'.EStrcat (monoExp env xml,
253 (L'.EPrim (Prim.String "</form>"), loc)), loc)), loc)
245 254
246 | L.EApp (e1, e2) => (L'.EApp (monoExp env e1, monoExp env e2), loc) 255 | L.EApp (e1, e2) => (L'.EApp (monoExp env e1, monoExp env e2), loc)
247 | L.EAbs (x, dom, ran, e) => 256 | L.EAbs (x, dom, ran, e) =>
248 (L'.EAbs (x, monoType env dom, monoType env ran, monoExp (Env.pushERel env x dom) e), loc) 257 (L'.EAbs (x, monoType env dom, monoType env ran, monoExp (Env.pushERel env x dom) e), loc)
249 | L.ECApp _ => poly () 258 | L.ECApp _ => poly ()