summaryrefslogtreecommitdiff
path: root/src/main.mlton.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-02-27 14:57:57 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-02-27 14:57:57 -0500
commit1607362ff628b9a1476679fbf9146b66ce92a3ee (patch)
treebc570639fdcb7e276797abacd77aca9bcbe5c57e /src/main.mlton.sml
parentdb1a486aaf3470c9c2cb30529867ae96d28f4ce2 (diff)
Basic analysis of tag and CSS class usage
Diffstat (limited to 'src/main.mlton.sml')
-rw-r--r--src/main.mlton.sml22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/main.mlton.sml b/src/main.mlton.sml
index fc1ba7e5..5676cd9c 100644
--- a/src/main.mlton.sml
+++ b/src/main.mlton.sml
@@ -29,10 +29,14 @@ val timing = ref false
val tc = ref false
val sources = ref ([] : string list)
val demo = ref (NONE : (string * bool) option)
+val css = ref false
fun doArgs args =
case args of
[] => ()
+ | "-css" :: rest =>
+ (css := true;
+ doArgs rest)
| "-demo" :: prefix :: rest =>
(demo := SOME (prefix, false);
doArgs rest)
@@ -90,10 +94,22 @@ val job =
| _ => raise Fail "Zero or multiple job files specified"
val () =
- case !demo of
- SOME (prefix, guided) =>
+ case (!css, !demo) of
+ (true, _) =>
+ (case Compiler.run Compiler.toCss job of
+ NONE => OS.Process.exit OS.Process.failure
+ | SOME {Overall = ov, Classes = cl} =>
+ (app (print o Css.inheritableToString) ov;
+ print "\n";
+ app (fn (x, (ins, ots)) =>
+ (print x;
+ print " ";
+ app (print o Css.inheritableToString) ins;
+ app (print o Css.othersToString) ots;
+ print "\n")) cl))
+ | (_, SOME (prefix, guided)) =>
Demo.make {prefix = prefix, dirname = job, guided = guided}
- | NONE =>
+ | _ =>
if !tc then
(Compiler.check Compiler.toElaborate job;
if ErrorMsg.anyErrors () then