271 Outer_Syntax.command @{command_spec "SML_file"} "read and evaluate Standard ML file" |
271 Outer_Syntax.command @{command_spec "SML_file"} "read and evaluate Standard ML file" |
272 (Resources.provide_parse_files "SML_file" >> (fn files => Toplevel.theory (fn thy => |
272 (Resources.provide_parse_files "SML_file" >> (fn files => Toplevel.theory (fn thy => |
273 let |
273 let |
274 val ([{lines, pos, ...}], thy') = files thy; |
274 val ([{lines, pos, ...}], thy') = files thy; |
275 val source = {delimited = true, text = cat_lines lines, pos = pos}; |
275 val source = {delimited = true, text = cat_lines lines, pos = pos}; |
|
276 val flags = {SML = true, redirect = true, verbose = true}; |
276 in |
277 in |
277 thy' |> Context.theory_map |
278 thy' |> Context.theory_map |
278 (ML_Context.exec (fn () => ML_Context.eval_source {SML = true, verbose = true} source)) |
279 (ML_Context.exec (fn () => ML_Context.eval_source flags source)) |
279 end))); |
280 end))); |
280 |
281 |
281 val _ = |
282 val _ = |
282 Outer_Syntax.command @{command_spec "ML"} "ML text within theory or local theory" |
283 Outer_Syntax.command @{command_spec "ML"} "ML text within theory or local theory" |
283 (Parse.ML_source >> (fn source => |
284 (Parse.ML_source >> (fn source => |
284 Toplevel.generic_theory |
285 Toplevel.generic_theory |
285 (ML_Context.exec (fn () => ML_Context.eval_source {SML = false, verbose = true} source) #> |
286 (ML_Context.exec (fn () => |
|
287 ML_Context.eval_source (ML_Compiler.verbose true ML_Compiler.flags) source) #> |
286 Local_Theory.propagate_ml_env))); |
288 Local_Theory.propagate_ml_env))); |
287 |
289 |
288 val _ = |
290 val _ = |
289 Outer_Syntax.command @{command_spec "ML_prf"} "ML text within proof" |
291 Outer_Syntax.command @{command_spec "ML_prf"} "ML text within proof" |
290 (Parse.ML_source >> (fn source => |
292 (Parse.ML_source >> (fn source => |
291 Toplevel.proof (Proof.map_context (Context.proof_map |
293 Toplevel.proof (Proof.map_context (Context.proof_map |
292 (ML_Context.exec (fn () => ML_Context.eval_source {SML = false, verbose = true} source))) #> |
294 (ML_Context.exec (fn () => |
|
295 ML_Context.eval_source (ML_Compiler.verbose true ML_Compiler.flags) source))) #> |
293 Proof.propagate_ml_env))); |
296 Proof.propagate_ml_env))); |
294 |
297 |
295 val _ = |
298 val _ = |
296 Outer_Syntax.command @{command_spec "ML_val"} "diagnostic ML text" |
299 Outer_Syntax.command @{command_spec "ML_val"} "diagnostic ML text" |
297 (Parse.ML_source >> Isar_Cmd.ml_diag true); |
300 (Parse.ML_source >> Isar_Cmd.ml_diag true); |