provide explicit theory (amending 621c052789b4);
authorwenzelm
Fri, 31 Oct 2014 22:37:22 +0100
changeset 58856 4fced55fc5b7
parent 58855 2885e2eaa0fb
child 58857 b0ccc7e1e7f3
provide explicit theory (amending 621c052789b4);
src/Doc/Tutorial/ToyList/ToyList_Test.thy
src/Pure/Thy/thy_info.ML
--- a/src/Doc/Tutorial/ToyList/ToyList_Test.thy	Fri Oct 31 22:09:18 2014 +0100
+++ b/src/Doc/Tutorial/ToyList/ToyList_Test.thy	Fri Oct 31 22:37:22 2014 +0100
@@ -3,10 +3,11 @@
 begin
 
 ML {*
-  map (File.read o Path.append (Resources.master_directory @{theory}) o Path.explode)
-    ["ToyList1.txt", "ToyList2.txt"]
-  |> implode
-  |> Thy_Info.script_thy Position.start
+  let val text =
+    map (File.read o Path.append (Resources.master_directory @{theory}) o Path.explode)
+      ["ToyList1.txt", "ToyList2.txt"]
+    |> implode
+  in Thy_Info.script_thy Position.start text @{theory BNF_Least_Fixpoint} end
 *}
 
 end
--- a/src/Pure/Thy/thy_info.ML	Fri Oct 31 22:09:18 2014 +0100
+++ b/src/Pure/Thy/thy_info.ML	Fri Oct 31 22:37:22 2014 +0100
@@ -21,7 +21,7 @@
     (string * Position.T) list -> unit
   val use_thys: (string * Position.T) list -> unit
   val use_thy: string * Position.T -> unit
-  val script_thy: Position.T -> string -> theory
+  val script_thy: Position.T -> string -> theory -> theory
   val register_thy: theory -> unit
   val finish: unit -> unit
 end;
@@ -370,9 +370,11 @@
 
 (* toplevel scripting -- without maintaining database *)
 
-fun script_thy pos txt =
+fun script_thy pos txt thy =
   let
-    val trs = Outer_Syntax.parse (Outer_Syntax.get_syntax ()) pos txt;
+    val trs =
+      Outer_Syntax.parse (Outer_Syntax.get_syntax ()) pos txt
+      |> map (Toplevel.modify_init (K thy));
     val end_pos = if null trs then pos else Toplevel.pos_of (List.last trs);
     val end_state = fold (Toplevel.command_exception true) trs Toplevel.toplevel;
   in Toplevel.end_theory end_pos end_state end;