305 OuterSyntax.command "use" "eval ML text from file" (K.tag_ml K.diag) |
305 OuterSyntax.command "use" "eval ML text from file" (K.tag_ml K.diag) |
306 (P.path >> (Toplevel.no_timing oo IsarCmd.use)); |
306 (P.path >> (Toplevel.no_timing oo IsarCmd.use)); |
307 |
307 |
308 val _ = |
308 val _ = |
309 OuterSyntax.command "ML" "eval ML text (diagnostic)" (K.tag_ml K.diag) |
309 OuterSyntax.command "ML" "eval ML text (diagnostic)" (K.tag_ml K.diag) |
310 (P.text >> IsarCmd.use_mltext true); |
310 (P.position P.text >> IsarCmd.use_mltext true); |
311 |
311 |
312 val _ = |
312 val _ = |
313 OuterSyntax.command "ML_command" "eval ML text" (K.tag_ml K.diag) |
313 OuterSyntax.command "ML_command" "eval ML text" (K.tag_ml K.diag) |
314 (P.text >> (Toplevel.no_timing oo IsarCmd.use_mltext false)); |
314 (P.position P.text >> (Toplevel.no_timing oo IsarCmd.use_mltext false)); |
315 |
315 |
316 val _ = |
316 val _ = |
317 OuterSyntax.command "ML_setup" "eval ML text (may change theory)" (K.tag_ml K.thy_decl) |
317 OuterSyntax.command "ML_setup" "eval ML text (may change theory)" (K.tag_ml K.thy_decl) |
318 (P.text >> IsarCmd.use_mltext_theory); |
318 (P.position P.text >> IsarCmd.use_mltext_theory); |
319 |
319 |
320 val _ = |
320 val _ = |
321 OuterSyntax.command "setup" "apply ML theory setup" (K.tag_ml K.thy_decl) |
321 OuterSyntax.command "setup" "apply ML theory setup" (K.tag_ml K.thy_decl) |
322 (Scan.option P.text >> (Toplevel.theory o IsarCmd.generic_setup)); |
322 (Scan.option (P.position P.text) >> (Toplevel.theory o IsarCmd.generic_setup)); |
323 |
323 |
324 val _ = |
324 val _ = |
325 OuterSyntax.command "method_setup" "define proof method in ML" (K.tag_ml K.thy_decl) |
325 OuterSyntax.command "method_setup" "define proof method in ML" (K.tag_ml K.thy_decl) |
326 (((P.name -- P.!!! (P.$$$ "=" |-- P.text -- P.text) >> P.triple2)) |
326 (P.name -- P.!!! (P.$$$ "=" |-- P.position P.text -- P.text) |
327 >> (Toplevel.theory o Method.method_setup)); |
327 >> (fn (name, (txt, cmt)) => Toplevel.theory (Method.method_setup name txt cmt))); |
328 |
328 |
329 val _ = |
329 val _ = |
330 OuterSyntax.command "declaration" "generic ML declaration" (K.tag_ml K.thy_decl) |
330 OuterSyntax.command "declaration" "generic ML declaration" (K.tag_ml K.thy_decl) |
331 (P.opt_target -- P.text |
331 (P.opt_target -- P.position P.text |
332 >> (fn (loc, txt) => Toplevel.local_theory loc (IsarCmd.declaration txt))); |
332 >> (fn (loc, txt) => Toplevel.local_theory loc (IsarCmd.declaration txt))); |
333 |
333 |
334 val _ = |
334 val _ = |
335 OuterSyntax.command "simproc_setup" "define simproc in ML" (K.tag_ml K.thy_decl) |
335 OuterSyntax.command "simproc_setup" "define simproc in ML" (K.tag_ml K.thy_decl) |
336 (P.opt_target -- |
336 (P.opt_target -- |
337 P.name -- (P.$$$ "(" |-- P.enum1 "|" P.term --| P.$$$ ")" --| P.$$$ "=") -- P.text -- |
337 P.name -- (P.$$$ "(" |-- P.enum1 "|" P.term --| P.$$$ ")" --| P.$$$ "=") -- |
338 Scan.optional (P.$$$ "identifier" |-- Scan.repeat1 P.xname) [] |
338 P.position P.text -- Scan.optional (P.$$$ "identifier" |-- Scan.repeat1 P.xname) [] |
339 >> (fn ((((loc, a), b), c), d) => Toplevel.local_theory loc (IsarCmd.simproc_setup a b c d))); |
339 >> (fn ((((loc, a), b), c), d) => Toplevel.local_theory loc (IsarCmd.simproc_setup a b c d))); |
340 |
340 |
341 |
341 |
342 (* translation functions *) |
342 (* translation functions *) |
343 |
343 |
344 val trfun = P.opt_keyword "advanced" -- P.text; |
344 val trfun = P.opt_keyword "advanced" -- P.position P.text; |
345 |
345 |
346 val _ = |
346 val _ = |
347 OuterSyntax.command "parse_ast_translation" "install parse ast translation functions" |
347 OuterSyntax.command "parse_ast_translation" "install parse ast translation functions" |
348 (K.tag_ml K.thy_decl) |
348 (K.tag_ml K.thy_decl) |
349 (trfun >> (Toplevel.theory o IsarCmd.parse_ast_translation)); |
349 (trfun >> (Toplevel.theory o IsarCmd.parse_ast_translation)); |
369 (trfun >> (Toplevel.theory o IsarCmd.print_ast_translation)); |
369 (trfun >> (Toplevel.theory o IsarCmd.print_ast_translation)); |
370 |
370 |
371 val _ = |
371 val _ = |
372 OuterSyntax.command "token_translation" "install token translation functions" |
372 OuterSyntax.command "token_translation" "install token translation functions" |
373 (K.tag_ml K.thy_decl) |
373 (K.tag_ml K.thy_decl) |
374 (P.text >> (Toplevel.theory o IsarCmd.token_translation)); |
374 (P.position P.text >> (Toplevel.theory o IsarCmd.token_translation)); |
375 |
375 |
376 |
376 |
377 (* oracles *) |
377 (* oracles *) |
378 |
378 |
379 val _ = |
379 val _ = |
380 OuterSyntax.command "oracle" "declare oracle" (K.tag_ml K.thy_decl) |
380 OuterSyntax.command "oracle" "declare oracle" (K.tag_ml K.thy_decl) |
381 (P.name -- (P.$$$ "(" |-- P.text --| P.$$$ ")" --| P.$$$ "=") |
381 (P.name -- (P.$$$ "(" |-- P.text --| P.$$$ ")" --| P.$$$ "=") |
382 -- P.text >> (fn ((x, y), z) => Toplevel.theory (IsarCmd.oracle x y z))); |
382 -- P.position P.text >> (fn ((x, y), z) => Toplevel.theory (IsarCmd.oracle x y z))); |
383 |
383 |
384 |
384 |
385 (* local theories *) |
385 (* local theories *) |
386 |
386 |
387 val _ = |
387 val _ = |