Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
1357:a0f0823a54a0 | 1358:32c8a3509369 |
---|---|
62 | 62 |
63 val htmlifyString = String.translate (fn #"<" => "<" | 63 val htmlifyString = String.translate (fn #"<" => "<" |
64 | #"&" => "&" | 64 | #"&" => "&" |
65 | ch => str ch) | 65 | ch => str ch) |
66 | 66 |
67 fun htmlifySpecialChar ch = "&#" ^ Int.toString (ord ch) ^ ";" | |
68 | |
67 fun hexIt ch = | 69 fun hexIt ch = |
68 let | 70 let |
69 val s = Int.fmt StringCvt.HEX (ord ch) | 71 val s = Int.fmt StringCvt.HEX (ord ch) |
70 in | 72 in |
71 case size s of | 73 case size s of |
177 | ESeq ((EWrite (EPrim (Prim.String s1), _), loc), | 179 | ESeq ((EWrite (EPrim (Prim.String s1), _), loc), |
178 (ESeq ((EWrite (EPrim (Prim.String s2), _), _), | 180 (ESeq ((EWrite (EPrim (Prim.String s2), _), _), |
179 e), _)) => | 181 e), _)) => |
180 ESeq ((EWrite (EPrim (Prim.String (s1 ^ s2)), loc), loc), | 182 ESeq ((EWrite (EPrim (Prim.String (s1 ^ s2)), loc), loc), |
181 e) | 183 e) |
184 | |
185 | EFfiApp ("Basis", "htmlifySpecialChar", [(EPrim (Prim.Char ch), _)]) => | |
186 EPrim (Prim.String (htmlifySpecialChar ch)) | |
187 | EWrite (EFfiApp ("Basis", "htmlifySpecialChar", [e]), _) => | |
188 EFfiApp ("Basis", "htmlifySpecialChar_w", [e]) | |
182 | 189 |
183 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", [(EPrim (Prim.Int n), _)]), _)]) => | 190 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", [(EPrim (Prim.Int n), _)]), _)]) => |
184 EPrim (Prim.String (htmlifyInt n)) | 191 EPrim (Prim.String (htmlifyInt n)) |
185 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", es), _)]) => | 192 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", es), _)]) => |
186 EFfiApp ("Basis", "htmlifyInt", es) | 193 EFfiApp ("Basis", "htmlifyInt", es) |