diff src/main.mlton.sml @ 1493:9cb923efea4d

Generated pretty-printed HTML for a simple tutorial source file
author Adam Chlipala <adam@chlipala.net>
date Fri, 15 Jul 2011 16:50:55 -0400
parents 79557535b843
children b5517f47b1f1
line wrap: on
line diff
--- a/src/main.mlton.sml	Fri Jul 15 10:17:15 2011 -0400
+++ b/src/main.mlton.sml	Fri Jul 15 16:50:55 2011 -0400
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008-2010, Adam Chlipala
+(* Copyright (c) 2008-2011, Adam Chlipala
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
 val tc = ref false
 val sources = ref ([] : string list)
 val demo = ref (NONE : (string * bool) option)
+val tutorial = ref false
 val css = ref false
 
 fun doArgs args =
@@ -43,6 +44,9 @@
       | "-guided-demo" :: prefix :: rest =>
         (demo := SOME (prefix, true);
          doArgs rest)
+      | "-tutorial" :: rest =>
+        (tutorial := true;
+         doArgs rest)
       | "-protocol" :: name :: rest =>
         (Settings.setProtocol name;
          doArgs rest)
@@ -118,8 +122,8 @@
       | _ => raise Fail "Zero or multiple job files specified"
 
 val () =
-    case (!css, !demo) of
-        (true, _) =>
+    case (!css, !demo, !tutorial) of
+        (true, _, _) =>
         (case Compiler.run Compiler.toCss job of
              NONE => OS.Process.exit OS.Process.failure
            | SOME {Overall = ov, Classes = cl} =>
@@ -131,8 +135,9 @@
                        app (print o Css.inheritableToString) ins;
                        app (print o Css.othersToString) ots;
                        print "\n")) cl))
-      | (_, SOME (prefix, guided)) =>
+      | (_, SOME (prefix, guided), _) =>
         Demo.make {prefix = prefix, dirname = job, guided = guided}
+      | (_, _, true) => Tutorial.make job
       | _ =>
         if !tc then
             (Compiler.check Compiler.toElaborate job;