equal
deleted
inserted
replaced
21 val args: (Context.generic * Args.T list -> 'a * (Context.generic * Args.T list)) -> |
21 val args: (Context.generic * Args.T list -> 'a * (Context.generic * Args.T list)) -> |
22 (Args.src -> Proof.context -> 'a -> string) -> Args.src -> Toplevel.node option -> string |
22 (Args.src -> Proof.context -> 'a -> string) -> Args.src -> Toplevel.node option -> string |
23 datatype markup = Markup | MarkupEnv | Verbatim |
23 datatype markup = Markup | MarkupEnv | Verbatim |
24 val modes: string list ref |
24 val modes: string list ref |
25 val eval_antiquote: Scan.lexicon -> Toplevel.node option -> SymbolPos.text * Position.T -> string |
25 val eval_antiquote: Scan.lexicon -> Toplevel.node option -> SymbolPos.text * Position.T -> string |
26 val process_thy: Scan.lexicon -> (string -> string list) -> (markup -> string -> bool) -> |
26 val present_thy: Scan.lexicon -> (string -> string list) -> (markup -> string -> bool) -> |
27 Toplevel.transition list -> (OuterLex.token, 'a) Source.source -> Buffer.T |
27 (Toplevel.transition * Toplevel.state) list -> (OuterLex.token, 'a) Source.source -> Buffer.T |
28 val output_list: (Proof.context -> 'a -> Pretty.T) -> Args.src -> |
28 val output_list: (Proof.context -> 'a -> Pretty.T) -> Args.src -> |
29 Proof.context -> 'a list -> string |
29 Proof.context -> 'a list -> string |
30 val output: (Proof.context -> 'a -> Pretty.T) -> Args.src -> Proof.context -> 'a -> string |
30 val output: (Proof.context -> 'a -> Pretty.T) -> Args.src -> Proof.context -> 'a -> string |
31 end; |
31 end; |
32 |
32 |
291 |> snd present_cont; |
291 |> snd present_cont; |
292 |
292 |
293 end; |
293 end; |
294 |
294 |
295 |
295 |
296 (* process_thy *) |
296 (* present_thy *) |
297 |
297 |
298 datatype markup = Markup | MarkupEnv | Verbatim; |
298 datatype markup = Markup | MarkupEnv | Verbatim; |
299 |
299 |
300 local |
300 local |
301 |
301 |
322 Scan.option ((P.$$$ "(" -- improper -- P.$$$ "in") |-- |
322 Scan.option ((P.$$$ "(" -- improper -- P.$$$ "in") |-- |
323 P.!!! (improper |-- P.xname --| (improper -- P.$$$ ")"))); |
323 P.!!! (improper |-- P.xname --| (improper -- P.$$$ ")"))); |
324 |
324 |
325 in |
325 in |
326 |
326 |
327 fun process_thy lex default_tags is_markup trs src = |
327 fun present_thy lex default_tags is_markup command_results src = |
328 let |
328 let |
329 (* tokens *) |
329 (* tokens *) |
330 |
330 |
331 val ignored = Scan.state --| ignore |
331 val ignored = Scan.state --| ignore |
332 >> (fn d => (NONE, (NoToken, ("", d)))); |
332 >> (fn d => (NONE, (NoToken, ("", d)))); |
388 src |
388 src |
389 |> Source.filter (not o T.is_semicolon) |
389 |> Source.filter (not o T.is_semicolon) |
390 |> Source.source' 0 T.stopper (Scan.error (Scan.bulk token)) NONE |
390 |> Source.source' 0 T.stopper (Scan.error (Scan.bulk token)) NONE |
391 |> Source.source stopper (Scan.error (Scan.bulk span)) NONE |
391 |> Source.source stopper (Scan.error (Scan.bulk span)) NONE |
392 |> Source.exhaust; |
392 |> Source.exhaust; |
|
393 |
|
394 |
|
395 (* present commands *) |
|
396 |
|
397 fun present_command tr span st st' = |
|
398 Toplevel.setmp_thread_position tr (present_span lex default_tags span st st'); |
|
399 |
|
400 fun present _ [] = I |
|
401 | present st (((tr, st'), span) :: rest) = present_command tr span st st' #> present st' rest; |
393 in |
402 in |
394 if length trs = length spans then |
403 if length command_results = length spans then |
395 ((NONE, []), NONE, true, Buffer.empty, (I, I)) |
404 ((NONE, []), NONE, true, Buffer.empty, (I, I)) |
396 |> Toplevel.present_excursion (trs ~~ map (present_span lex default_tags) spans) |
405 |> present Toplevel.toplevel (command_results ~~ spans) |
397 |> present_trailer |
406 |> present_trailer |
398 else error "Messed-up outer syntax for presentation" |
407 else error "Messed-up outer syntax for presentation" |
399 end; |
408 end; |
400 |
409 |
401 end; |
410 end; |