src/Pure/ML/ml_compiler.ML
changeset 60956 10d463883dc2
parent 60858 7bf2188a0998
child 62357 ab76bd43c14a
--- a/src/Pure/ML/ml_compiler.ML	Mon Aug 17 15:29:30 2015 +0200
+++ b/src/Pure/ML/ml_compiler.ML	Mon Aug 17 16:27:12 2015 +0200
@@ -8,7 +8,7 @@
 sig
   type flags =
     {SML: bool, exchange: bool, redirect: bool, verbose: bool,
-      writeln: string -> unit, warning: string -> unit}
+      debug: bool option, writeln: string -> unit, warning: string -> unit}
   val flags: flags
   val verbose: bool -> flags -> flags
   val eval: flags -> Position.T -> ML_Lex.token list -> unit
@@ -19,23 +19,26 @@
 
 type flags =
   {SML: bool, exchange: bool, redirect: bool, verbose: bool,
-    writeln: string -> unit, warning: string -> unit};
+    debug: bool option, writeln: string -> unit, warning: string -> unit};
 
 val flags: flags =
   {SML = false, exchange = false, redirect = false, verbose = false,
-    writeln = writeln, warning = warning};
+    debug = NONE, writeln = writeln, warning = warning};
 
 fun verbose b (flags: flags) =
-  {SML = #SML flags, exchange = #exchange flags, redirect = #redirect flags, verbose = b,
-    writeln = #writeln flags, warning = #warning flags};
+  {SML = #SML flags, exchange = #exchange flags, redirect = #redirect flags,
+    verbose = b, debug = #debug flags, writeln = #writeln flags, warning = #warning flags};
 
 fun eval (flags: flags) pos toks =
   let
     val _ = if #SML flags then error ("Standard ML is unsupported on " ^ ML_System.name) else ();
     val line = the_default 1 (Position.line_of pos);
     val file = the_default "ML" (Position.file_of pos);
+    val debug = the_default false (#debug flags);
     val text = ML_Lex.flatten toks;
-  in Secure.use_text ML_Env.local_context (line, file) (#verbose flags) text end;
+  in
+    Secure.use_text ML_Env.local_context
+      {line = line, file = file, verbose = #verbose flags, debug = debug} text
+  end;
 
 end;
-