equal
deleted
inserted
replaced
2313 val _ = |
2313 val _ = |
2314 OuterSyntax.command "export_code" "generate executable code for constants" |
2314 OuterSyntax.command "export_code" "generate executable code for constants" |
2315 K.diag (P.!!! (code_exprP export_code_cmd) >> (fn f => Toplevel.keep (f o Toplevel.theory_of))); |
2315 K.diag (P.!!! (code_exprP export_code_cmd) >> (fn f => Toplevel.keep (f o Toplevel.theory_of))); |
2316 |
2316 |
2317 fun shell_command thyname cmd = Toplevel.program (fn _ => |
2317 fun shell_command thyname cmd = Toplevel.program (fn _ => |
2318 (use_thy thyname; case Scan.read OuterLex.stopper (P.!!! (code_exprP export_code_cmd)) ((filter OuterLex.is_proper o OuterSyntax.scan) cmd) |
2318 (use_thy thyname; case Scan.read OuterLex.stopper (P.!!! (code_exprP export_code_cmd)) |
|
2319 ((filter OuterLex.is_proper o OuterSyntax.scan Position.none) cmd) |
2319 of SOME f => (writeln "Now generating code..."; f (theory thyname)) |
2320 of SOME f => (writeln "Now generating code..."; f (theory thyname)) |
2320 | NONE => error ("Bad directive " ^ quote cmd))) |
2321 | NONE => error ("Bad directive " ^ quote cmd))) |
2321 handle TOPLEVEL_ERROR => OS.Process.exit OS.Process.failure; |
2322 handle TOPLEVEL_ERROR => OS.Process.exit OS.Process.failure; |
2322 |
2323 |
2323 val _ = ML_Context.add_antiq "code" (Args.term >> ml_code_antiq); |
2324 val _ = ML_Context.add_antiq "code" (Args.term >> ml_code_antiq); |