comparison src/scriptcheck.sml @ 726:6fc633d990e7

onError
author Adam Chlipala <adamc@hcoop.net>
date Thu, 16 Apr 2009 12:36:01 -0400
parents 500e93aa436f
children f7e2026dd5ae
comparison
equal deleted inserted replaced
725:4c5796512edc 726:6fc633d990e7
58 not (Substring.isEmpty suffix) 58 not (Substring.isEmpty suffix)
59 end 59 end
60 60
61 fun hasClient {basis, words, onload} csids = 61 fun hasClient {basis, words, onload} csids =
62 let 62 let
63 fun realOnload ss =
64 case ss of
65 [] => false
66 | (EFfiApp ("Basis", "get_settings", _), _) :: ss => realOnload ss
67 | (EPrim (Prim.String s), _) :: ss => not (String.isPrefix "'" s)
68 | _ => true
69
70 fun hasClient e = 63 fun hasClient e =
71 case #1 e of 64 case #1 e of
72 EPrim (Prim.String s) => List.exists (fn n => inString {needle = n, haystack = s}) words 65 EPrim (Prim.String s) => List.exists (fn n => inString {needle = n, haystack = s}) words
73 | EPrim _ => false 66 | EPrim _ => false
74 | ERel _ => false 67 | ERel _ => false
77 | ECon (_, _, SOME e) => hasClient e 70 | ECon (_, _, SOME e) => hasClient e
78 | ENone _ => false 71 | ENone _ => false
79 | ESome (_, e) => hasClient e 72 | ESome (_, e) => hasClient e
80 | EFfi ("Basis", x) => SS.member (basis, x) 73 | EFfi ("Basis", x) => SS.member (basis, x)
81 | EFfi _ => false 74 | EFfi _ => false
82 | EFfiApp ("Basis", "strcat", all as ((EPrim (Prim.String s1), _) :: ss)) => 75 | EFfiApp ("Basis", "maybe_onload",
83 if onload andalso String.isSuffix " onload='" s1 then 76 [(EFfiApp ("Basis", "strcat", all as [_, (EPrim (Prim.String s), _)]), _)]) =>
84 realOnload ss orelse List.exists hasClient all 77 List.exists hasClient all
85 else 78 orelse (onload andalso size s > 0)
86 List.exists hasClient all
87 | EFfiApp ("Basis", x, es) => SS.member (basis, x) 79 | EFfiApp ("Basis", x, es) => SS.member (basis, x)
88 orelse List.exists hasClient es 80 orelse List.exists hasClient es
89 | EFfiApp (_, _, es) => List.exists hasClient es 81 | EFfiApp (_, _, es) => List.exists hasClient es
90 | EApp (e, es) => hasClient e orelse List.exists hasClient es 82 | EApp (e, es) => hasClient e orelse List.exists hasClient es
91 | EUnop (_, e) => hasClient e 83 | EUnop (_, e) => hasClient e