src/Pure/Isar/isar_syn.ML
changeset 20979 7e5ba4a1f72f
parent 20958 802705101b2a
child 21004 081674431d68
equal deleted inserted replaced
20978:51956522c306 20979:7e5ba4a1f72f
    17   OuterSyntax.command "theory" "begin theory" (K.tag_theory K.thy_begin)
    17   OuterSyntax.command "theory" "begin theory" (K.tag_theory K.thy_begin)
    18     (ThyHeader.args >> (Toplevel.print oo IsarThy.theory));
    18     (ThyHeader.args >> (Toplevel.print oo IsarThy.theory));
    19 
    19 
    20 val endP =
    20 val endP =
    21   OuterSyntax.command "end" "end (local) theory" (K.tag_theory K.thy_end)
    21   OuterSyntax.command "end" "end (local) theory" (K.tag_theory K.thy_end)
    22     (Scan.succeed (Toplevel.print o Toplevel.exit o Toplevel.exit_local_theory));
    22     (Scan.succeed (Toplevel.exit o Toplevel.exit_local_theory));
    23 
    23 
    24 val contextP =
    24 val contextP =
    25   OuterSyntax.improper_command "context" "switch (local) theory context"
    25   OuterSyntax.improper_command "context" "switch (local) theory context"
    26     (K.tag_theory K.thy_switch)
    26     (K.tag_theory K.thy_switch)
    27     (P.name >> (Toplevel.print oo IsarThy.context));
    27     (P.name --| P.begin >> (fn name =>
    28 
    28       Toplevel.print o IsarThy.context name o
       
    29       Toplevel.begin_local_theory true (TheoryTarget.init (SOME name))));
    29 
    30 
    30 
    31 
    31 (** markup commands **)
    32 (** markup commands **)
    32 
    33 
    33 val headerP = OuterSyntax.markup_command IsarOutput.Markup "header" "theory header" K.diag
    34 val headerP = OuterSyntax.markup_command IsarOutput.Markup "header" "theory header" K.diag
   355   OuterSyntax.command "locale" "define named proof context" K.thy_decl
   356   OuterSyntax.command "locale" "define named proof context" K.thy_decl
   356     ((P.opt_keyword "open" >> not) -- P.name
   357     ((P.opt_keyword "open" >> not) -- P.name
   357         -- Scan.optional (P.$$$ "=" |-- P.!!! locale_val) (Locale.empty, [])
   358         -- Scan.optional (P.$$$ "=" |-- P.!!! locale_val) (Locale.empty, [])
   358         -- P.opt_begin
   359         -- P.opt_begin
   359       >> (fn (((is_open, name), (expr, elems)), begin) =>
   360       >> (fn (((is_open, name), (expr, elems)), begin) =>
   360           Toplevel.begin_local_theory begin (Locale.add_locale is_open name expr elems)));
   361           Toplevel.begin_local_theory begin
       
   362             (Locale.add_locale is_open name expr elems #-> TheoryTarget.begin)));
   361 
   363 
   362 val interpretationP =
   364 val interpretationP =
   363   OuterSyntax.command "interpretation"
   365   OuterSyntax.command "interpretation"
   364     "prove and register interpretation of locale expression in theory or locale" K.thy_goal
   366     "prove and register interpretation of locale expression in theory or locale" K.thy_goal
   365     (P.xname --| (P.$$$ "\\<subseteq>" || P.$$$ "<") -- P.!!! P.locale_expr
   367     (P.xname --| (P.$$$ "\\<subseteq>" || P.$$$ "<") -- P.!!! P.locale_expr
   619     (Scan.succeed (Toplevel.print o IsarCmd.back));
   621     (Scan.succeed (Toplevel.print o IsarCmd.back));
   620 
   622 
   621 
   623 
   622 (* history *)
   624 (* history *)
   623 
   625 
   624 val cannot_undoP =    (* FIXME ProofGeneral compatibility *)
   626 val cannot_undoP =
   625   OuterSyntax.improper_command "cannot_undo" "attempt to undo 'end'" K.control
   627   OuterSyntax.improper_command "cannot_undo" "report 'cannot undo' error message" K.control
   626     (P.name >> K (Toplevel.no_timing o IsarCmd.undo_end));
   628     (P.name >> (Toplevel.no_timing oo IsarCmd.cannot_undo));
   627 
       
   628 val undo_endP =
       
   629   OuterSyntax.improper_command "undo_end" "attempt to undo 'end'" K.control
       
   630     (Scan.succeed (Toplevel.no_timing o IsarCmd.undo_end));
       
   631 
   629 
   632 val clear_undosP =
   630 val clear_undosP =
   633   OuterSyntax.improper_command "clear_undos" "clear theory-level undo information" K.control
   631   OuterSyntax.improper_command "clear_undos" "clear theory-level undo information" K.control
   634     (P.nat >> (Toplevel.no_timing oo IsarCmd.clear_undos_theory));
   632     (P.nat >> (Toplevel.no_timing oo IsarCmd.clear_undos_theory));
   635 
   633 
   915   assumeP, presumeP, defP, obtainP, guessP, letP, caseP, thenP, fromP,
   913   assumeP, presumeP, defP, obtainP, guessP, letP, caseP, thenP, fromP,
   916   withP, noteP, usingP, unfoldingP, begin_blockP, end_blockP, nextP,
   914   withP, noteP, usingP, unfoldingP, begin_blockP, end_blockP, nextP,
   917   qedP, terminal_proofP, default_proofP, immediate_proofP,
   915   qedP, terminal_proofP, default_proofP, immediate_proofP,
   918   done_proofP, skip_proofP, forget_proofP, deferP, preferP, applyP,
   916   done_proofP, skip_proofP, forget_proofP, deferP, preferP, applyP,
   919   apply_endP, proofP, alsoP, finallyP, moreoverP, ultimatelyP, backP,
   917   apply_endP, proofP, alsoP, finallyP, moreoverP, ultimatelyP, backP,
   920   cannot_undoP, undo_endP, clear_undosP, redoP, undos_proofP, undoP,
   918   cannot_undoP, clear_undosP, redoP, undos_proofP, undoP, killP,
   921   killP, interpretationP, interpretP,
   919   interpretationP, interpretP,
   922   (*diagnostic commands*)
   920   (*diagnostic commands*)
   923   pretty_setmarginP, print_commandsP, print_contextP, print_theoryP,
   921   pretty_setmarginP, print_commandsP, print_contextP, print_theoryP,
   924   print_syntaxP, print_theoremsP, print_localesP, print_localeP,
   922   print_syntaxP, print_theoremsP, print_localesP, print_localeP,
   925   print_registrationsP, print_attributesP, print_simpsetP,
   923   print_registrationsP, print_attributesP, print_simpsetP,
   926   print_rulesP, print_induct_rulesP, print_trans_rulesP,
   924   print_rulesP, print_induct_rulesP, print_trans_rulesP,