src/Pure/Isar/isar_syn.ML
changeset 37977 3ceccd415145
parent 37949 48a874444164
child 37981 9a15982f41fe
equal deleted inserted replaced
37976:ce2ea240895c 37977:3ceccd415145
    26 
    26 
    27 (** init and exit **)
    27 (** init and exit **)
    28 
    28 
    29 val _ =
    29 val _ =
    30   Outer_Syntax.command "theory" "begin theory" (Keyword.tag_theory Keyword.thy_begin)
    30   Outer_Syntax.command "theory" "begin theory" (Keyword.tag_theory Keyword.thy_begin)
    31     (Thy_Header.args >> (Toplevel.print oo Isar_Cmd.init_theory));
    31     (Thy_Header.args >> (fn (name, imports, uses) =>
       
    32       Toplevel.print o
       
    33         Toplevel.init_theory name
       
    34           (fn () => Thy_Info.toplevel_begin_theory name imports (map (apfst Path.explode) uses))));
    32 
    35 
    33 val _ =
    36 val _ =
    34   Outer_Syntax.command "end" "end (local) theory" (Keyword.tag_theory Keyword.thy_end)
    37   Outer_Syntax.command "end" "end (local) theory" (Keyword.tag_theory Keyword.thy_end)
    35     (Scan.succeed (Toplevel.exit o Toplevel.end_local_theory));
    38     (Scan.succeed (Toplevel.exit o Toplevel.end_local_theory));
    36 
    39 
   990   Outer_Syntax.improper_command "commit" "commit current session to ML database" Keyword.diag
   993   Outer_Syntax.improper_command "commit" "commit current session to ML database" Keyword.diag
   991     (Parse.opt_unit >> K (Toplevel.no_timing o Toplevel.imperative Secure.commit));
   994     (Parse.opt_unit >> K (Toplevel.no_timing o Toplevel.imperative Secure.commit));
   992 
   995 
   993 val _ =
   996 val _ =
   994   Outer_Syntax.improper_command "quit" "quit Isabelle" Keyword.control
   997   Outer_Syntax.improper_command "quit" "quit Isabelle" Keyword.control
   995     (Parse.opt_unit >> (Toplevel.no_timing oo K Isar_Cmd.quit));
   998     (Parse.opt_unit >> (Toplevel.no_timing oo K (Toplevel.imperative quit)));
   996 
   999 
   997 val _ =
  1000 val _ =
   998   Outer_Syntax.improper_command "exit" "exit Isar loop" Keyword.control
  1001   Outer_Syntax.improper_command "exit" "exit Isar loop" Keyword.control
   999     (Scan.succeed (Toplevel.no_timing o Isar_Cmd.exit));
  1002     (Scan.succeed
       
  1003       (Toplevel.no_timing o Toplevel.keep (fn state =>
       
  1004         (Context.set_thread_data (try Toplevel.generic_theory_of state);
       
  1005           raise Toplevel.TERMINATE))));
  1000 
  1006 
  1001 end;
  1007 end;
  1002 
  1008