src/Pure/Isar/isar_cmd.ML
changeset 56304 40274e4f5ebf
parent 56278 2576d3a40ed6
child 56334 6b3739fee456
equal deleted inserted replaced
56303:4cc3f4db3447 56304:40274e4f5ebf
   143         \  val body = ") @ body @ ML_Lex.read Position.none (";\n\
   143         \  val body = ") @ body @ ML_Lex.read Position.none (";\n\
   144         \in\n\
   144         \in\n\
   145         \  val " ^ name ^
   145         \  val " ^ name ^
   146         " = snd (Context.>>> (Context.map_theory_result (Thm.add_oracle (binding, body))));\n\
   146         " = snd (Context.>>> (Context.map_theory_result (Thm.add_oracle (binding, body))));\n\
   147         \end;\n");
   147         \end;\n");
   148     val flags = {SML = false, verbose = false};
   148   in
   149   in Context.theory_map (ML_Context.exec (fn () => ML_Context.eval flags (#pos source) ants)) end;
   149     Context.theory_map
       
   150       (ML_Context.exec (fn () => ML_Context.eval ML_Compiler.flags (#pos source) ants))
       
   151   end;
   150 
   152 
   151 
   153 
   152 (* old-style defs *)
   154 (* old-style defs *)
   153 
   155 
   154 fun add_defs ((unchecked, overloaded), args) thy =
   156 fun add_defs ((unchecked, overloaded), args) thy =
   234   type T = Toplevel.state;
   236   type T = Toplevel.state;
   235   fun init _ = Toplevel.toplevel;
   237   fun init _ = Toplevel.toplevel;
   236 );
   238 );
   237 
   239 
   238 fun ml_diag verbose source = Toplevel.keep (fn state =>
   240 fun ml_diag verbose source = Toplevel.keep (fn state =>
   239   let val opt_ctxt =
   241   let
   240     try Toplevel.generic_theory_of state
   242     val opt_ctxt =
   241     |> Option.map (Context.proof_of #> Diag_State.put state)
   243       try Toplevel.generic_theory_of state
   242   in ML_Context.eval_source_in opt_ctxt {SML = false, verbose = verbose} source end);
   244       |> Option.map (Context.proof_of #> Diag_State.put state);
       
   245     val flags = ML_Compiler.verbose verbose ML_Compiler.flags;
       
   246   in ML_Context.eval_source_in opt_ctxt flags source end);
   243 
   247 
   244 val diag_state = Diag_State.get;
   248 val diag_state = Diag_State.get;
   245 
   249 
   246 fun diag_goal ctxt =
   250 fun diag_goal ctxt =
   247   Proof.goal (Toplevel.proof_of (diag_state ctxt))
   251   Proof.goal (Toplevel.proof_of (diag_state ctxt))