comparison src/mono_opt.sml @ 2008:93ff76058825

HTML5 data-* attributes
author Adam Chlipala <adam@chlipala.net>
date Fri, 02 May 2014 15:32:10 -0400
parents 3d922a28370b
children 4d64af730e35
comparison
equal deleted inserted replaced
2007:d3a0f2b8af28 2008:93ff76058825
116 in 116 in
117 doChars (String.explode s, []) 117 doChars (String.explode s, [])
118 end 118 end
119 119
120 fun checkUrl s = CharVector.all Char.isGraph s andalso Settings.checkUrl s 120 fun checkUrl s = CharVector.all Char.isGraph s andalso Settings.checkUrl s
121 val checkData = CharVector.all (fn ch => Char.isAlphaNum ch
122 orelse ch = #"_"
123 orelse ch = #"-")
121 val checkAtom = CharVector.all (fn ch => Char.isAlphaNum ch 124 val checkAtom = CharVector.all (fn ch => Char.isAlphaNum ch
122 orelse ch = #"+" 125 orelse ch = #"+"
123 orelse ch = #"-" 126 orelse ch = #"-"
124 orelse ch = #"." 127 orelse ch = #"."
125 orelse ch = #"%" 128 orelse ch = #"%"
440 ERecord [] 443 ERecord []
441 444
442 | ESignalBind ((ESignalReturn e1, loc), e2) => 445 | ESignalBind ((ESignalReturn e1, loc), e2) =>
443 optExp (EApp (e2, e1), loc) 446 optExp (EApp (e2, e1), loc)
444 447
448 | EFfiApp ("Basis", "blessData", [((se as EPrim (Prim.String s), loc), _)]) =>
449 (if checkData s then
450 ()
451 else
452 ErrorMsg.errorAt loc ("Invalid HTML5 data-* attribute " ^ s);
453 se)
454
445 | EFfiApp ("Basis", "bless", [((se as EPrim (Prim.String s), loc), _)]) => 455 | EFfiApp ("Basis", "bless", [((se as EPrim (Prim.String s), loc), _)]) =>
446 (if checkUrl s then 456 (if checkUrl s then
447 () 457 ()
448 else 458 else
449 ErrorMsg.errorAt loc ("Invalid URL " ^ s ^ " passed to 'bless'"); 459 ErrorMsg.errorAt loc ("Invalid URL " ^ s ^ " passed to 'bless'");