src/Pure/Isar/toplevel.ML
changeset 46959 cdc791910460
parent 45666 d83797ef0d2d
child 47069 451fc10a81f3
equal deleted inserted replaced
46958:0ec8f04e753a 46959:cdc791910460
    88   val status: transition -> Markup.T -> unit
    88   val status: transition -> Markup.T -> unit
    89   val error_msg: transition -> serial * string -> unit
    89   val error_msg: transition -> serial * string -> unit
    90   val add_hook: (transition -> state -> state -> unit) -> unit
    90   val add_hook: (transition -> state -> state -> unit) -> unit
    91   val transition: bool -> transition -> state -> (state * (exn * string) option) option
    91   val transition: bool -> transition -> state -> (state * (exn * string) option) option
    92   val command: transition -> state -> state
    92   val command: transition -> state -> state
    93   val excursion:
    93   val proof_result: bool -> transition * transition list -> state ->
    94     (transition * transition list) list -> (transition * state) list future list * theory
    94     (transition * state) list future * state
    95 end;
    95 end;
    96 
    96 
    97 structure Toplevel: TOPLEVEL =
    97 structure Toplevel: TOPLEVEL =
    98 struct
    98 struct
    99 
    99 
   642 fun command_result tr st =
   642 fun command_result tr st =
   643   let val st' = command tr st
   643   let val st' = command tr st
   644   in (st', st') end;
   644   in (st', st') end;
   645 
   645 
   646 
   646 
   647 (* excursion of units, consisting of commands with proof *)
   647 (* scheduled proof result *)
   648 
   648 
   649 structure States = Proof_Data
   649 structure States = Proof_Data
   650 (
   650 (
   651   type T = state list future option;
   651   type T = state list future option;
   652   fun init _ = NONE;
   652   fun init _ = NONE;
   690           |> Future.map (fn sts => (tr, st') :: (body_trs ~~ sts) @ [(end_tr, st'')]);
   690           |> Future.map (fn sts => (tr, st') :: (body_trs ~~ sts) @ [(end_tr, st'')]);
   691 
   691 
   692       in (result, st'') end
   692       in (result, st'') end
   693   end;
   693   end;
   694 
   694 
   695 fun excursion input =
   695 end;
   696   let
       
   697     val end_pos = if null input then error "No input" else pos_of (fst (List.last input));
       
   698     val immediate = not (Goal.future_enabled ());
       
   699     val (results, end_state) = fold_map (proof_result immediate) input toplevel;
       
   700     val thy = end_theory end_pos end_state;
       
   701   in (results, thy) end;
       
   702 
       
   703 end;