comparison src/monoize.sml @ 347:58eeeb3cbf40

Use checkbox in CRUD example
author Adam Chlipala <adamc@hcoop.net>
date Sat, 04 Oct 2008 16:15:13 -0400
parents ca98644af384
children 260b680a6a04
comparison
equal deleted inserted replaced
346:a94a79820d49 347:58eeeb3cbf40
1245 ^ String.extract (s, 1, NONE) 1245 ^ String.extract (s, 1, NONE)
1246 1246
1247 val s = (L'.EPrim (Prim.String (String.concat ["<", tag])), loc) 1247 val s = (L'.EPrim (Prim.String (String.concat ["<", tag])), loc)
1248 in 1248 in
1249 foldl (fn ((x, e, t), (s, fm)) => 1249 foldl (fn ((x, e, t), (s, fm)) =>
1250 let 1250 case t of
1251 val xp = " " ^ lowercaseFirst x ^ "=\"" 1251 (L'.TFfi ("Basis", "bool"), _) =>
1252 1252 let
1253 val fooify = 1253 val s' = " " ^ lowercaseFirst x
1254 case x of 1254 in
1255 "Href" => urlifyExp 1255 ((L'.ECase (e,
1256 | "Link" => urlifyExp 1256 [((L'.PCon (L'.Enum,
1257 | "Action" => urlifyExp 1257 L'.PConFfi {mod = "Basis",
1258 | _ => attrifyExp 1258 datatyp = "bool",
1259 1259 con = "True",
1260 val (e, fm) = fooify env fm (e, t) 1260 arg = NONE},
1261 in 1261 NONE), loc),
1262 ((L'.EStrcat (s, 1262 (L'.EStrcat (s,
1263 (L'.EStrcat ((L'.EPrim (Prim.String xp), loc), 1263 (L'.EPrim (Prim.String s'), loc)), loc)),
1264 (L'.EStrcat (e, 1264 ((L'.PCon (L'.Enum,
1265 (L'.EPrim (Prim.String "\""), 1265 L'.PConFfi {mod = "Basis",
1266 loc)), 1266 datatyp = "bool",
1267 loc)), 1267 con = "False",
1268 loc)), loc), 1268 arg = NONE},
1269 fm) 1269 NONE), loc),
1270 end) 1270 s)],
1271 {disc = (L'.TFfi ("Basis", "bool"), loc),
1272 result = (L'.TFfi ("Basis", "string"), loc)}), loc),
1273 fm)
1274 end
1275 | _ =>
1276 let
1277 val fooify =
1278 case x of
1279 "Href" => urlifyExp
1280 | "Link" => urlifyExp
1281 | "Action" => urlifyExp
1282 | _ => attrifyExp
1283
1284 val xp = " " ^ lowercaseFirst x ^ "=\""
1285
1286
1287
1288 val (e, fm) = fooify env fm (e, t)
1289 in
1290 ((L'.EStrcat (s,
1291 (L'.EStrcat ((L'.EPrim (Prim.String xp), loc),
1292 (L'.EStrcat (e,
1293 (L'.EPrim (Prim.String "\""),
1294 loc)),
1295 loc)),
1296 loc)), loc),
1297 fm)
1298 end)
1271 (s, fm) xes 1299 (s, fm) xes
1272 end 1300 end
1273 | _ => raise Fail "Non-record attributes!" 1301 | _ => raise Fail "Non-record attributes!"
1274 1302
1275 fun input typ = 1303 fun input typ =