278 ThyInfo.pretend_use_thy_only name handle ERROR msg => |
278 ThyInfo.pretend_use_thy_only name handle ERROR msg => |
279 (warning msg; warning ("Failed to register theory: " ^ quote name); |
279 (warning msg; warning ("Failed to register theory: " ^ quote name); |
280 tell_file_retracted (Path.base (Path.explode file)))) |
280 tell_file_retracted (Path.base (Path.explode file)))) |
281 else raise Toplevel.UNDEF |
281 else raise Toplevel.UNDEF |
282 end; |
282 end; |
283 |
|
284 fun vacuous_inform_file_processed file state = |
|
285 (warning ("No theory " ^ quote (thy_name file)); |
|
286 tell_file_retracted (Path.base (Path.explode file))); |
|
287 |
283 |
288 |
284 |
289 (* restart top-level loop (keeps most state information) *) |
285 (* restart top-level loop (keeps most state information) *) |
290 |
286 |
291 val welcome = priority o Session.welcome; |
287 val welcome = priority o Session.welcome; |
504 isarcmd ("undos_proof " ^ Int.toString times) |
500 isarcmd ("undos_proof " ^ Int.toString times) |
505 end |
501 end |
506 |
502 |
507 fun redostep vs = isarcmd "redo" |
503 fun redostep vs = isarcmd "redo" |
508 |
504 |
509 fun abortgoal vs = isarcmd "ProofGeneral.kill_proof" |
505 fun abortgoal vs = isarcmd "kill" (* was: ProofGeneral.kill_proof *) |
510 |
506 |
511 |
507 |
512 (*** PGIP identifier tables ***) |
508 (*** PGIP identifier tables ***) |
513 |
509 |
514 fun setids t = issue_pgip (Setids {idtables = [t]}) |
510 fun setids t = issue_pgip (Setids {idtables = [t]}) |
920 |
916 |
921 fun pgip_toplevel x = loop true x |
917 fun pgip_toplevel x = loop true x |
922 end |
918 end |
923 |
919 |
924 |
920 |
925 (* additional outer syntax for Isar *) |
921 local |
926 (* da: TODO: perhaps we can drop this superfluous syntax now?? |
922 (* Extra command for embedding prover-control inside document (obscure/debug usage). *) |
927 Seems cleaner to support the operations directly above in the PGIP actions. |
923 |
928 *) |
924 val process_pgipP = |
929 |
925 OuterSyntax.improper_command "ProofGeneral.process_pgip" "(internal)" OuterKeyword.control |
930 local structure P = OuterParse and K = OuterKeyword in |
926 (OuterParse.text >> (Toplevel.no_timing oo |
931 |
|
932 val undoP = (*undo without output*) |
|
933 OuterSyntax.improper_command "ProofGeneral.undo" "(internal)" K.control |
|
934 (Scan.succeed (Toplevel.no_timing o IsarCmd.undo)); |
|
935 |
|
936 val redoP = (*redo without output*) |
|
937 OuterSyntax.improper_command "ProofGeneral.redo" "(internal)" K.control |
|
938 (Scan.succeed (Toplevel.no_timing o IsarCmd.redo)); |
|
939 |
|
940 (* ProofGeneral.kill_proof still used above *) |
|
941 val kill_proofP = |
|
942 OuterSyntax.improper_command "ProofGeneral.kill_proof" "(internal)" K.control |
|
943 (Scan.succeed (Toplevel.no_timing o IsarCmd.kill_proof_notify tell_clear_goals)); |
|
944 |
|
945 (* FIXME: Not quite same as commands used above *) |
|
946 val inform_file_processedP = |
|
947 OuterSyntax.improper_command "ProofGeneral.inform_file_processed" "(internal)" K.control |
|
948 (P.name >> (fn file => Toplevel.no_timing o |
|
949 Toplevel.init_empty (vacuous_inform_file_processed file) o |
|
950 Toplevel.kill o |
|
951 Toplevel.init_empty (proper_inform_file_processed file))); |
|
952 |
|
953 val inform_file_retractedP = |
|
954 OuterSyntax.improper_command "ProofGeneral.inform_file_retracted" "(internal)" K.control |
|
955 (P.name >> (Toplevel.no_timing oo |
|
956 (fn file => Toplevel.imperative (fn () => inform_file_retracted file)))); |
|
957 |
|
958 (* This one can actually be used for Daniel's interface scripting idea: generically!! *) |
|
959 val process_pgipP = |
|
960 OuterSyntax.improper_command "ProofGeneral.process_pgip" "(internal)" K.control |
|
961 (P.text >> (Toplevel.no_timing oo |
|
962 (fn txt => Toplevel.imperative (fn () => process_pgip_plain txt)))); |
927 (fn txt => Toplevel.imperative (fn () => process_pgip_plain txt)))); |
963 |
928 |
964 fun init_outer_syntax () = OuterSyntax.add_parsers |
929 in |
965 [undoP, redoP, kill_proofP, inform_file_processedP, inform_file_retractedP, process_pgipP]; |
930 |
966 |
931 fun init_outer_syntax () = OuterSyntax.add_parsers [process_pgipP]; |
967 end; |
932 |
|
933 end |
|
934 |
968 |
935 |
969 |
936 |
970 (* init *) |
937 (* init *) |
971 |
938 |
972 val initialized = ref false; |
939 val initialized = ref false; |
974 fun init_pgip false = |
941 fun init_pgip false = |
975 Output.panic "No Proof General interface support for Isabelle/classic mode." |
942 Output.panic "No Proof General interface support for Isabelle/classic mode." |
976 | init_pgip true = |
943 | init_pgip true = |
977 (! initialized orelse |
944 (! initialized orelse |
978 (setmp warning_fn (K ()) init_outer_syntax (); |
945 (setmp warning_fn (K ()) init_outer_syntax (); |
|
946 PgipParser.init (); |
979 setup_xsymbols_output (); |
947 setup_xsymbols_output (); |
980 setup_pgml_output (); |
948 setup_pgml_output (); |
981 setup_messages (); |
949 setup_messages (); |
982 setup_state (); |
950 setup_state (); |
983 setup_thy_loader (); |
951 setup_thy_loader (); |