Mercurial > urweb
comparison src/main.mlton.sml @ 1170:52c6ac6a59f1
Basic analysis of tag and CSS class usage
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 27 Feb 2010 14:57:57 -0500 |
parents | 8679ba87cf3c |
children | 6373a0432338 |
comparison
equal
deleted
inserted
replaced
1169:420e38516dc2 | 1170:52c6ac6a59f1 |
---|---|
27 | 27 |
28 val timing = ref false | 28 val timing = ref false |
29 val tc = ref false | 29 val tc = ref false |
30 val sources = ref ([] : string list) | 30 val sources = ref ([] : string list) |
31 val demo = ref (NONE : (string * bool) option) | 31 val demo = ref (NONE : (string * bool) option) |
32 val css = ref false | |
32 | 33 |
33 fun doArgs args = | 34 fun doArgs args = |
34 case args of | 35 case args of |
35 [] => () | 36 [] => () |
37 | "-css" :: rest => | |
38 (css := true; | |
39 doArgs rest) | |
36 | "-demo" :: prefix :: rest => | 40 | "-demo" :: prefix :: rest => |
37 (demo := SOME (prefix, false); | 41 (demo := SOME (prefix, false); |
38 doArgs rest) | 42 doArgs rest) |
39 | "-guided-demo" :: prefix :: rest => | 43 | "-guided-demo" :: prefix :: rest => |
40 (demo := SOME (prefix, true); | 44 (demo := SOME (prefix, true); |
88 case !sources of | 92 case !sources of |
89 [file] => file | 93 [file] => file |
90 | _ => raise Fail "Zero or multiple job files specified" | 94 | _ => raise Fail "Zero or multiple job files specified" |
91 | 95 |
92 val () = | 96 val () = |
93 case !demo of | 97 case (!css, !demo) of |
94 SOME (prefix, guided) => | 98 (true, _) => |
99 (case Compiler.run Compiler.toCss job of | |
100 NONE => OS.Process.exit OS.Process.failure | |
101 | SOME {Overall = ov, Classes = cl} => | |
102 (app (print o Css.inheritableToString) ov; | |
103 print "\n"; | |
104 app (fn (x, (ins, ots)) => | |
105 (print x; | |
106 print " "; | |
107 app (print o Css.inheritableToString) ins; | |
108 app (print o Css.othersToString) ots; | |
109 print "\n")) cl)) | |
110 | (_, SOME (prefix, guided)) => | |
95 Demo.make {prefix = prefix, dirname = job, guided = guided} | 111 Demo.make {prefix = prefix, dirname = job, guided = guided} |
96 | NONE => | 112 | _ => |
97 if !tc then | 113 if !tc then |
98 (Compiler.check Compiler.toElaborate job; | 114 (Compiler.check Compiler.toElaborate job; |
99 if ErrorMsg.anyErrors () then | 115 if ErrorMsg.anyErrors () then |
100 OS.Process.exit OS.Process.failure | 116 OS.Process.exit OS.Process.failure |
101 else | 117 else |