266 |
266 |
267 |
267 |
268 (* use ML text *) |
268 (* use ML text *) |
269 |
269 |
270 val _ = |
270 val _ = |
|
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 => |
|
273 let |
|
274 val ([{lines, pos, ...}], thy') = files thy; |
|
275 val source = {delimited = true, text = cat_lines lines, pos = pos}; |
|
276 in |
|
277 thy' |> Context.theory_map |
|
278 (ML_Context.exec (fn () => ML_Context.eval_source {SML = true, verbose = true} source)) |
|
279 end))); |
|
280 |
|
281 val _ = |
271 Outer_Syntax.command @{command_spec "ML"} "ML text within theory or local theory" |
282 Outer_Syntax.command @{command_spec "ML"} "ML text within theory or local theory" |
272 (Parse.ML_source >> (fn source => |
283 (Parse.ML_source >> (fn source => |
273 Toplevel.generic_theory |
284 Toplevel.generic_theory |
274 (ML_Context.exec (fn () => ML_Context.eval_source true source) #> |
285 (ML_Context.exec (fn () => ML_Context.eval_source {SML = false, verbose = true} source) #> |
275 Local_Theory.propagate_ml_env))); |
286 Local_Theory.propagate_ml_env))); |
276 |
287 |
277 val _ = |
288 val _ = |
278 Outer_Syntax.command @{command_spec "ML_prf"} "ML text within proof" |
289 Outer_Syntax.command @{command_spec "ML_prf"} "ML text within proof" |
279 (Parse.ML_source >> (fn source => |
290 (Parse.ML_source >> (fn source => |
280 Toplevel.proof (Proof.map_context (Context.proof_map |
291 Toplevel.proof (Proof.map_context (Context.proof_map |
281 (ML_Context.exec (fn () => ML_Context.eval_source true source))) #> |
292 (ML_Context.exec (fn () => ML_Context.eval_source {SML = false, verbose = true} source))) #> |
282 Proof.propagate_ml_env))); |
293 Proof.propagate_ml_env))); |
283 |
294 |
284 val _ = |
295 val _ = |
285 Outer_Syntax.command @{command_spec "ML_val"} "diagnostic ML text" |
296 Outer_Syntax.command @{command_spec "ML_val"} "diagnostic ML text" |
286 (Parse.ML_source >> Isar_Cmd.ml_diag true); |
297 (Parse.ML_source >> Isar_Cmd.ml_diag true); |