212 fun proof_status tr st = |
212 fun proof_status tr st = |
213 (case try Toplevel.proof_of st of |
213 (case try Toplevel.proof_of st of |
214 SOME prf => status tr (Proof.status_markup prf) |
214 SOME prf => status tr (Proof.status_markup prf) |
215 | NONE => ()); |
215 | NONE => ()); |
216 |
216 |
|
217 fun command_indent tr st = |
|
218 (case try Toplevel.proof_of st of |
|
219 SOME prf => |
|
220 let val keywords = Thy_Header.get_keywords (Proof.theory_of prf) in |
|
221 if Keyword.command_kind keywords (Toplevel.name_of tr) = SOME Keyword.prf_script then |
|
222 (case try Proof.goal prf of |
|
223 SOME {goal, ...} => |
|
224 let val n = Thm.nprems_of goal |
|
225 in if n > 1 then report tr (Markup.command_indent (n - 1)) else () end |
|
226 | NONE => ()) |
|
227 else () |
|
228 end |
|
229 | NONE => ()); |
|
230 |
|
231 |
217 fun eval_state keywords span tr ({state, ...}: eval_state) = |
232 fun eval_state keywords span tr ({state, ...}: eval_state) = |
218 let |
233 let |
219 val _ = Thread_Attributes.expose_interrupt (); |
234 val _ = Thread_Attributes.expose_interrupt (); |
220 |
235 |
221 val st = reset_state keywords tr state; |
236 val st = reset_state keywords tr state; |
222 |
237 |
|
238 val _ = command_indent tr st; |
223 val _ = status tr Markup.running; |
239 val _ = status tr Markup.running; |
224 val (errs1, result) = run keywords true tr st; |
240 val (errs1, result) = run keywords true tr st; |
225 val errs2 = (case result of NONE => [] | SOME st' => check_cmts span tr st'); |
241 val errs2 = (case result of NONE => [] | SOME st' => check_cmts span tr st'); |
226 val errs = errs1 @ errs2; |
242 val errs = errs1 @ errs2; |
227 val _ = List.app (Future.error_message (Toplevel.pos_of tr)) errs; |
243 val _ = List.app (Future.error_message (Toplevel.pos_of tr)) errs; |