From 17ecbd235ad9b7692dfc029329fb13103eb55d9c Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 21 Dec 2010 18:01:23 -0500 Subject: Basis.cdataChar --- src/mono_opt.sml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mono_opt.sml') diff --git a/src/mono_opt.sml b/src/mono_opt.sml index 6e137dc5..34f43143 100644 --- a/src/mono_opt.sml +++ b/src/mono_opt.sml @@ -64,6 +64,8 @@ val htmlifyString = String.translate (fn #"<" => "<" | #"&" => "&" | ch => str ch) +fun htmlifySpecialChar ch = "&#" ^ Int.toString (ord ch) ^ ";" + fun hexIt ch = let val s = Int.fmt StringCvt.HEX (ord ch) @@ -180,6 +182,11 @@ fun exp e = ESeq ((EWrite (EPrim (Prim.String (s1 ^ s2)), loc), loc), e) + | EFfiApp ("Basis", "htmlifySpecialChar", [(EPrim (Prim.Char ch), _)]) => + EPrim (Prim.String (htmlifySpecialChar ch)) + | EWrite (EFfiApp ("Basis", "htmlifySpecialChar", [e]), _) => + EFfiApp ("Basis", "htmlifySpecialChar_w", [e]) + | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", [(EPrim (Prim.Int n), _)]), _)]) => EPrim (Prim.String (htmlifyInt n)) | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", es), _)]) => -- cgit v1.2.3