src/Pure/Isar/toplevel.ML
changeset 56887 1ca814da47ae
parent 56867 224109105008
child 56893 62d237cdc341
equal deleted inserted replaced
56886:87ebb99786ed 56887:1ca814da47ae
    21   val theory_of: state -> theory
    21   val theory_of: state -> theory
    22   val proof_of: state -> Proof.state
    22   val proof_of: state -> Proof.state
    23   val proof_position_of: state -> int
    23   val proof_position_of: state -> int
    24   val end_theory: Position.T -> state -> theory
    24   val end_theory: Position.T -> state -> theory
    25   val pretty_state_context: state -> Pretty.T list
    25   val pretty_state_context: state -> Pretty.T list
    26   val pretty_state: bool -> state -> Pretty.T list
    26   val pretty_state: state -> Pretty.T list
    27   val print_state: bool -> state -> unit
    27   val print_state: state -> unit
    28   val pretty_abstract: state -> Pretty.T
    28   val pretty_abstract: state -> Pretty.T
    29   val quiet: bool Unsynchronized.ref
    29   val quiet: bool Unsynchronized.ref
    30   val interact: bool Unsynchronized.ref
    30   val interact: bool Unsynchronized.ref
    31   val timing: bool Unsynchronized.ref
    31   val timing: bool Unsynchronized.ref
    32   val profiling: int Unsynchronized.ref
    32   val profiling: int Unsynchronized.ref
   205     NONE => []
   205     NONE => []
   206   | SOME (Theory (gthy, _)) => pretty_context gthy
   206   | SOME (Theory (gthy, _)) => pretty_context gthy
   207   | SOME (Proof (_, (_, gthy))) => pretty_context gthy
   207   | SOME (Proof (_, (_, gthy))) => pretty_context gthy
   208   | SOME (Skipped_Proof (_, (gthy, _))) => pretty_context gthy);
   208   | SOME (Skipped_Proof (_, (gthy, _))) => pretty_context gthy);
   209 
   209 
   210 fun pretty_state prf_only state =
   210 fun pretty_state state =
   211   (case try node_of state of
   211   (case try node_of state of
   212     NONE => []
   212     NONE => []
   213   | SOME (Theory (gthy, _)) => if prf_only then [] else pretty_context gthy
   213   | SOME (Theory _) => []
   214   | SOME (Proof (prf, _)) =>
   214   | SOME (Proof (prf, _)) =>
   215       Proof.pretty_state (Proof_Node.position prf) (Proof_Node.current prf)
   215       Proof.pretty_state (Proof_Node.position prf) (Proof_Node.current prf)
   216   | SOME (Skipped_Proof (d, _)) => [Pretty.str ("skipped proof: depth " ^ string_of_int d)]);
   216   | SOME (Skipped_Proof (d, _)) => [Pretty.str ("skipped proof: depth " ^ string_of_int d)]);
   217 
   217 
   218 fun print_state prf_only =
   218 val print_state = pretty_state #> Pretty.markup_chunks Markup.state #> Pretty.writeln;
   219   pretty_state prf_only #> Pretty.markup_chunks Markup.state #> Pretty.writeln;
       
   220 
   219 
   221 fun pretty_abstract state = Pretty.str ("<Isar " ^ str_of_state state ^ ">");
   220 fun pretty_abstract state = Pretty.str ("<Isar " ^ str_of_state state ^ ">");
   222 
   221 
   223 
   222 
   224 
   223 
   590     let
   589     let
   591       val timing_start = Timing.start ();
   590       val timing_start = Timing.start ();
   592 
   591 
   593       val (result, opt_err) =
   592       val (result, opt_err) =
   594          state |> (apply_trans int trans |> ! profiling > 0 ? profile (! profiling));
   593          state |> (apply_trans int trans |> ! profiling > 0 ? profile (! profiling));
   595       val _ = if int andalso not (! quiet) andalso print then print_state false result else ();
   594       val _ = if int andalso not (! quiet) andalso print then print_state result else ();
   596 
   595 
   597       val timing_result = Timing.result timing_start;
   596       val timing_result = Timing.result timing_start;
   598       val timing_props =
   597       val timing_props =
   599         Markup.command_timing :: (Markup.nameN, name_of tr) :: Position.properties_of (pos_of tr);
   598         Markup.command_timing :: (Markup.nameN, name_of tr) :: Position.properties_of (pos_of tr);
   600       val _ = Timing.protocol_message timing_props timing_result;
   599       val _ = Timing.protocol_message timing_props timing_result;