diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-12-21 18:01:23 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-12-21 18:01:23 -0500 |
commit | 17ecbd235ad9b7692dfc029329fb13103eb55d9c (patch) | |
tree | 90ec74ac4d55bd062eab0b9ebb1c161b31dd6167 /src/mono_opt.sml | |
parent | 22d11510a829052ea5be8d93c9805572aa13d66e (diff) |
Basis.cdataChar
Diffstat (limited to 'src/mono_opt.sml')
-rw-r--r-- | src/mono_opt.sml | 7 |
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 #"<" => "<" | #"&" => "&" | 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), _)]) => |