summaryrefslogtreecommitdiff
path: root/src/mono_opt.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-12-21 18:01:23 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-12-21 18:01:23 -0500
commit17ecbd235ad9b7692dfc029329fb13103eb55d9c (patch)
tree90ec74ac4d55bd062eab0b9ebb1c161b31dd6167 /src/mono_opt.sml
parent22d11510a829052ea5be8d93c9805572aa13d66e (diff)
Basis.cdataChar
Diffstat (limited to 'src/mono_opt.sml')
-rw-r--r--src/mono_opt.sml7
1 files changed, 7 insertions, 0 deletions
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 #"<" => "&lt;"
| #"&" => "&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 @@ 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), _)]) =>