src/Pure/Isar/toplevel.ML
changeset 25584 222b91dd754c
parent 25551 87d89b0f847a
child 25796 5df3607867c1
equal deleted inserted replaced
25583:72e71bcf4239 25584:222b91dd754c
    34   val debug: bool ref
    34   val debug: bool ref
    35   val interact: bool ref
    35   val interact: bool ref
    36   val timing: bool ref
    36   val timing: bool ref
    37   val profiling: int ref
    37   val profiling: int ref
    38   val skip_proofs: bool ref
    38   val skip_proofs: bool ref
       
    39   val crashes: exn list ref
    39   exception TERMINATE
    40   exception TERMINATE
    40   exception RESTART
    41   exception RESTART
    41   exception TOPLEVEL_ERROR
    42   exception TOPLEVEL_ERROR
    42   val exn_message: exn -> string
    43   val exn_message: exn -> string
    43   val program: (unit -> 'a) -> 'a
    44   val program: (unit -> 'a) -> 'a
   235 val debug = Output.debugging;
   236 val debug = Output.debugging;
   236 val interact = ref false;
   237 val interact = ref false;
   237 val timing = Output.timing;
   238 val timing = Output.timing;
   238 val profiling = ref 0;
   239 val profiling = ref 0;
   239 val skip_proofs = ref false;
   240 val skip_proofs = ref false;
       
   241 val crashes = ref ([]: exn list);
   240 
   242 
   241 exception TERMINATE;
   243 exception TERMINATE;
   242 exception RESTART;
   244 exception RESTART;
   243 exception EXCURSION_FAIL of exn * string;
   245 exception EXCURSION_FAIL of exn * string;
   244 exception FAILURE of state * exn;
   246 exception FAILURE of state * exn;
   766   in
   768   in
   767     (case get_interrupt (Source.set_prompt prompt src) of
   769     (case get_interrupt (Source.set_prompt prompt src) of
   768       NONE => (writeln "\nInterrupt."; raw_loop secure src)
   770       NONE => (writeln "\nInterrupt."; raw_loop secure src)
   769     | SOME NONE => if secure then quit () else ()
   771     | SOME NONE => if secure then quit () else ()
   770     | SOME (SOME (tr, src')) => if >> tr orelse check_secure () then raw_loop secure src' else ())
   772     | SOME (SOME (tr, src')) => if >> tr orelse check_secure () then raw_loop secure src' else ())
       
   773     handle exn => (CRITICAL (fn () => change crashes (cons exn));
       
   774       warning "Recovering after Isar toplevel crash -- see also Toplevel.crashes";
       
   775       raw_loop secure src)
   771   end;
   776   end;
   772 
   777 
   773 in
   778 in
   774 
   779 
   775 fun loop secure src = ignore_interrupt (raw_loop secure) src;
   780 fun loop secure src = ignore_interrupt (raw_loop secure) src;