diff src/mono_opt.sml @ 1358:32c8a3509369

Basis.cdataChar
author Adam Chlipala <adam@chlipala.net>
date Tue, 21 Dec 2010 18:01:23 -0500
parents e2f803080934
children 02fc16faecf3
line wrap: on
line diff
--- a/src/mono_opt.sml	Tue Dec 21 17:01:51 2010 -0500
+++ b/src/mono_opt.sml	Tue Dec 21 18:01:23 2010 -0500
@@ -64,6 +64,8 @@
                                        | #"&" => "&amp;"
                                        | 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 @@
         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), _)]) =>