comparison src/mono_opt.sml @ 1065:217eb87dde31

Basis.url and redirects
author Adam Chlipala <adamc@hcoop.net>
date Thu, 10 Dec 2009 13:32:09 -0500
parents 03a81e26e5fe
children 51e596feec37
comparison
equal deleted inserted replaced
1064:b89e3d8731ed 1065:217eb87dde31
113 | [] => String.implode (rev acc) 113 | [] => String.implode (rev acc)
114 in 114 in
115 doChars (String.explode s, []) 115 doChars (String.explode s, [])
116 end 116 end
117 117
118 fun checkUrl s = CharVector.all Char.isGraph s andalso Settings.checkUrl s
119
118 fun exp e = 120 fun exp e =
119 case e of 121 case e of
120 EPrim (Prim.String s) => 122 EPrim (Prim.String s) =>
121 let 123 let
122 val (_, chs) = 124 val (_, chs) =
403 405
404 | ESignalBind ((ESignalReturn e1, loc), e2) => 406 | ESignalBind ((ESignalReturn e1, loc), e2) =>
405 optExp (EApp (e2, e1), loc) 407 optExp (EApp (e2, e1), loc)
406 408
407 | EFfiApp ("Basis", "bless", [(se as EPrim (Prim.String s), loc)]) => 409 | EFfiApp ("Basis", "bless", [(se as EPrim (Prim.String s), loc)]) =>
408 (if Settings.checkUrl s then 410 (if checkUrl s then
409 () 411 ()
410 else 412 else
411 ErrorMsg.errorAt loc ("Invalid URL " ^ s ^ " passed to 'bless'"); 413 ErrorMsg.errorAt loc ("Invalid URL " ^ s ^ " passed to 'bless'");
412 se) 414 se)
415 | EFfiApp ("Basis", "checkUrl", [(se as EPrim (Prim.String s), loc)]) =>
416 (if checkUrl s then
417 ESome ((TFfi ("Basis", "string"), loc), (se, loc))
418 else
419 ENone (TFfi ("Basis", "string"), loc))
413 | EFfiApp ("Basis", "blessMime", [(se as EPrim (Prim.String s), loc)]) => 420 | EFfiApp ("Basis", "blessMime", [(se as EPrim (Prim.String s), loc)]) =>
414 (if Settings.checkMime s then 421 (if Settings.checkMime s then
415 () 422 ()
416 else 423 else
417 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessMime'"); 424 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessMime'");