author | wenzelm |
Tue, 12 Aug 2008 21:27:57 +0200 | |
changeset 27839 | 0be8644c45eb |
parent 27831 | 20aea331137f |
child 27855 | b1bf607e06c2 |
permissions | -rw-r--r-- |
5829 | 1 |
(* Title: Pure/Isar/outer_syntax.ML |
2 |
ID: $Id$ |
|
3 |
Author: Markus Wenzel, TU Muenchen |
|
4 |
||
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
5 |
The global Isabelle/Isar outer syntax. |
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
6 |
|
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
7 |
Note: the syntax for files is statically determined at the very |
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
8 |
beginning; for interactive processing it may change dynamically. |
5829 | 9 |
*) |
10 |
||
11 |
signature OUTER_SYNTAX = |
|
12 |
sig |
|
24868 | 13 |
type parser_fn = OuterLex.token list -> |
14 |
(Toplevel.transition -> Toplevel.transition) * OuterLex.token list |
|
15 |
val command: string -> string -> OuterKeyword.T -> parser_fn -> unit |
|
16 |
val markup_command: ThyOutput.markup -> string -> string -> OuterKeyword.T -> parser_fn -> unit |
|
17 |
val improper_command: string -> string -> OuterKeyword.T -> parser_fn -> unit |
|
26990 | 18 |
val local_theory: string -> string -> OuterKeyword.T -> |
19 |
(OuterParse.token list -> (local_theory -> local_theory) * OuterLex.token list) -> unit |
|
20 |
val local_theory_to_proof': string -> string -> OuterKeyword.T -> |
|
21 |
(OuterParse.token list -> (bool -> local_theory -> Proof.state) * OuterLex.token list) -> unit |
|
22 |
val local_theory_to_proof: string -> string -> OuterKeyword.T -> |
|
23 |
(OuterParse.token list -> (local_theory -> Proof.state) * OuterLex.token list) -> unit |
|
5883 | 24 |
val print_outer_syntax: unit -> unit |
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
25 |
val scan: Position.T -> string -> OuterLex.token list |
25580 | 26 |
val parse: Position.T -> string -> Toplevel.transition list |
26431 | 27 |
val process_file: Path.T -> theory -> theory |
26600 | 28 |
type isar |
29 |
val isar: bool -> isar |
|
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
30 |
val prepare_command: Position.T -> string -> Toplevel.transition |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
31 |
val load_thy: string -> Position.T -> string list -> bool -> unit |
5829 | 32 |
end; |
33 |
||
26600 | 34 |
structure OuterSyntax: OUTER_SYNTAX = |
5829 | 35 |
struct |
36 |
||
7750 | 37 |
structure T = OuterLex; |
6860 | 38 |
structure P = OuterParse; |
39 |
||
5829 | 40 |
|
41 |
(** outer syntax **) |
|
42 |
||
43 |
(* parsers *) |
|
44 |
||
24868 | 45 |
type parser_fn = T.token list -> (Toplevel.transition -> Toplevel.transition) * T.token list; |
5829 | 46 |
|
24868 | 47 |
datatype parser = Parser of |
48 |
{comment: string, |
|
49 |
markup: ThyOutput.markup option, |
|
50 |
int_only: bool, |
|
51 |
parse: parser_fn}; |
|
5829 | 52 |
|
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
53 |
fun make_parser comment markup int_only parse = |
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
54 |
Parser {comment = comment, markup = markup, int_only = int_only, parse = parse}; |
5829 | 55 |
|
56 |
||
57 |
(* parse command *) |
|
58 |
||
6860 | 59 |
local |
6199 | 60 |
|
14925
0f86a8a694f8
added read (provides transition names and sources);
wenzelm
parents:
14687
diff
changeset
|
61 |
fun terminate false = Scan.succeed () |
0f86a8a694f8
added read (provides transition names and sources);
wenzelm
parents:
14687
diff
changeset
|
62 |
| terminate true = P.group "end of input" (Scan.option P.sync -- P.semicolon >> K ()); |
0f86a8a694f8
added read (provides transition names and sources);
wenzelm
parents:
14687
diff
changeset
|
63 |
|
26620 | 64 |
fun body cmd (name, _) = |
7026 | 65 |
(case cmd name of |
24868 | 66 |
SOME (Parser {int_only, parse, ...}) => |
26620 | 67 |
P.!!! (Scan.prompt (name ^ "# ") (P.tags |-- parse >> pair int_only)) |
15531 | 68 |
| NONE => sys_error ("no parser for outer syntax command " ^ quote name)); |
6860 | 69 |
|
70 |
in |
|
5829 | 71 |
|
26620 | 72 |
fun parse_command do_terminate cmd = |
15531 | 73 |
P.semicolon >> K NONE || |
74 |
P.sync >> K NONE || |
|
26620 | 75 |
(P.position P.command :-- body cmd) --| terminate do_terminate |
6860 | 76 |
>> (fn ((name, pos), (int_only, f)) => |
15531 | 77 |
SOME (Toplevel.empty |> Toplevel.name name |> Toplevel.position pos |> |
6860 | 78 |
Toplevel.interactive int_only |> f)); |
5829 | 79 |
|
6199 | 80 |
end; |
81 |
||
5829 | 82 |
|
83 |
||
9132 | 84 |
(** global outer syntax **) |
5829 | 85 |
|
7026 | 86 |
local |
87 |
||
24868 | 88 |
val global_parsers = ref (Symtab.empty: parser Symtab.table); |
22120 | 89 |
val global_markups = ref ([]: (string * ThyOutput.markup) list); |
5952 | 90 |
|
23939 | 91 |
fun change_parsers f = CRITICAL (fn () => |
92 |
(change global_parsers f; |
|
93 |
global_markups := |
|
24868 | 94 |
Symtab.fold (fn (name, Parser {markup = SOME m, ...}) => cons (name, m) | _ => I) |
95 |
(! global_parsers) [])); |
|
6722 | 96 |
|
7026 | 97 |
in |
98 |
||
9132 | 99 |
(* access current syntax *) |
7026 | 100 |
|
24868 | 101 |
fun get_parsers () = CRITICAL (fn () => ! global_parsers); |
102 |
fun get_markups () = CRITICAL (fn () => ! global_markups); |
|
7026 | 103 |
|
24868 | 104 |
fun get_parser () = Symtab.lookup (get_parsers ()); |
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
105 |
fun get_syntax () = CRITICAL (fn () => (OuterKeyword.get_lexicons (), get_parser ())); |
7789 | 106 |
|
24868 | 107 |
fun is_markup kind name = AList.lookup (op =) (get_markups ()) name = SOME kind; |
5829 | 108 |
|
109 |
||
110 |
(* augment syntax *) |
|
111 |
||
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
112 |
fun add_parser name kind parser = CRITICAL (fn () => |
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
113 |
(OuterKeyword.command name kind; |
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
114 |
if not (Symtab.defined (get_parsers ()) name) then () |
24868 | 115 |
else warning ("Redefining outer syntax command " ^ quote name); |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
116 |
change_parsers (Symtab.update (name, parser)))); |
5829 | 117 |
|
24868 | 118 |
fun command name comment kind parse = |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
119 |
add_parser name kind (make_parser comment NONE false parse); |
5829 | 120 |
|
24868 | 121 |
fun markup_command markup name comment kind parse = |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
122 |
add_parser name kind (make_parser comment (SOME markup) false parse); |
24868 | 123 |
|
124 |
fun improper_command name comment kind parse = |
|
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
125 |
add_parser name kind (make_parser comment NONE true parse); |
7026 | 126 |
|
127 |
end; |
|
5829 | 128 |
|
129 |
||
26990 | 130 |
(* local_theory commands *) |
131 |
||
132 |
fun local_theory_command do_print trans name comment kind parse = |
|
133 |
command name comment kind (P.opt_target -- parse |
|
134 |
>> (fn (loc, f) => (if do_print then Toplevel.print else I) o trans loc f)); |
|
135 |
||
136 |
val local_theory = local_theory_command false Toplevel.local_theory; |
|
137 |
val local_theory_to_proof' = local_theory_command true Toplevel.local_theory_to_proof'; |
|
138 |
val local_theory_to_proof = local_theory_command true Toplevel.local_theory_to_proof; |
|
139 |
||
140 |
||
24872 | 141 |
(* inspect syntax *) |
7026 | 142 |
|
143 |
fun dest_parsers () = |
|
16727 | 144 |
get_parsers () |> Symtab.dest |> sort_wrt #1 |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
145 |
|> map (fn (name, Parser {comment, int_only, ...}) => (name, comment, int_only)); |
5829 | 146 |
|
9223 | 147 |
fun print_outer_syntax () = |
7026 | 148 |
let |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
149 |
fun pretty_cmd (name, comment, _) = |
7026 | 150 |
Pretty.block [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment]; |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
151 |
val (int_cmds, cmds) = List.partition #3 (dest_parsers ()); |
7026 | 152 |
in |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
153 |
[Pretty.strs ("syntax keywords:" :: map quote (OuterKeyword.dest_keywords ())), |
18326 | 154 |
Pretty.big_list "commands:" (map pretty_cmd cmds), |
155 |
Pretty.big_list "interactive-only commands:" (map pretty_cmd int_cmds)] |
|
9223 | 156 |
|> Pretty.chunks |> Pretty.writeln |
7026 | 157 |
end; |
5829 | 158 |
|
159 |
||
160 |
||
9132 | 161 |
(** toplevel parsing **) |
5829 | 162 |
|
9132 | 163 |
(* basic sources *) |
6860 | 164 |
|
26620 | 165 |
fun toplevel_source term do_recover cmd src = |
9132 | 166 |
let |
167 |
val no_terminator = |
|
168 |
Scan.unless P.semicolon (Scan.one (T.not_sync andf T.not_eof)); |
|
23682
cf4773532006
nested source: explicit interactive flag for recover avoids duplicate errors;
wenzelm
parents:
23679
diff
changeset
|
169 |
fun recover int = |
cf4773532006
nested source: explicit interactive flag for recover avoids duplicate errors;
wenzelm
parents:
23679
diff
changeset
|
170 |
(int, fn _ => Scan.prompt "recover# " (Scan.repeat no_terminator) >> K [NONE]); |
9132 | 171 |
in |
172 |
src |
|
12876
a70df1e5bf10
got rid of explicit marginal comments (now stripped earlier from input);
wenzelm
parents:
10749
diff
changeset
|
173 |
|> T.source_proper |
9132 | 174 |
|> Source.source T.stopper |
15531 | 175 |
(Scan.bulk (P.$$$ "--" -- P.!!! P.text >> K NONE || P.not_eof >> SOME)) |
23682
cf4773532006
nested source: explicit interactive flag for recover avoids duplicate errors;
wenzelm
parents:
23679
diff
changeset
|
176 |
(Option.map recover do_recover) |
19482
9f11af8f7ef9
tuned basic list operators (flat, maps, map_filter);
wenzelm
parents:
19060
diff
changeset
|
177 |
|> Source.map_filter I |
24868 | 178 |
|> Source.source T.stopper |
26620 | 179 |
(Scan.bulk (fn xs => P.!!! (parse_command term (cmd ())) xs)) |
23682
cf4773532006
nested source: explicit interactive flag for recover avoids duplicate errors;
wenzelm
parents:
23679
diff
changeset
|
180 |
(Option.map recover do_recover) |
19482
9f11af8f7ef9
tuned basic list operators (flat, maps, map_filter);
wenzelm
parents:
19060
diff
changeset
|
181 |
|> Source.map_filter I |
9132 | 182 |
end; |
5829 | 183 |
|
7746 | 184 |
|
25580 | 185 |
(* off-line scanning/parsing *) |
14925
0f86a8a694f8
added read (provides transition names and sources);
wenzelm
parents:
14687
diff
changeset
|
186 |
|
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
187 |
fun scan pos str = |
16195 | 188 |
Source.of_string str |
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
189 |
|> Symbol.source {do_recover = false} |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
190 |
|> T.source {do_recover = SOME false} OuterKeyword.get_lexicons pos |
16195 | 191 |
|> Source.exhaust; |
192 |
||
25580 | 193 |
fun parse pos str = |
194 |
Source.of_string str |
|
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
195 |
|> Symbol.source {do_recover = false} |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
196 |
|> T.source {do_recover = SOME false} OuterKeyword.get_lexicons pos |
26620 | 197 |
|> toplevel_source false NONE get_parser |
25580 | 198 |
|> Source.exhaust; |
199 |
||
14091 | 200 |
|
26431 | 201 |
(* process file *) |
202 |
||
203 |
fun process_file path thy = |
|
204 |
let |
|
205 |
val result = ref thy; |
|
26881 | 206 |
val trs = parse (Path.position path) (File.read path); |
27575 | 207 |
val init = Toplevel.init_theory "" (K thy) (fn thy' => result := thy'); |
26431 | 208 |
val _ = Toplevel.excursion (init Toplevel.empty :: trs @ [Toplevel.exit Toplevel.empty]); |
209 |
in ! result end; |
|
210 |
||
211 |
||
24868 | 212 |
(* interactive source of toplevel transformers *) |
213 |
||
26600 | 214 |
type isar = |
215 |
(Toplevel.transition, (Toplevel.transition option, |
|
216 |
(OuterLex.token, (OuterLex.token option, (OuterLex.token, (OuterLex.token, |
|
27770 | 217 |
(SymbolPos.T, Position.T * (Symbol.symbol, (string, unit) Source.source) |
218 |
Source.source) Source.source) Source.source) Source.source) |
|
219 |
Source.source) Source.source) Source.source) Source.source; |
|
26600 | 220 |
|
221 |
fun isar term : isar = |
|
24868 | 222 |
Source.tty |
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
223 |
|> Symbol.source {do_recover = true} |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
224 |
|> T.source {do_recover = SOME true} OuterKeyword.get_lexicons Position.none |
26620 | 225 |
|> toplevel_source term (SOME true) get_parser; |
24868 | 226 |
|
227 |
||
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
228 |
|
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
229 |
(* prepare toplevel commands -- fail-safe *) |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
230 |
|
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
231 |
val not_singleton = "Exactly one command expected"; |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
232 |
|
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
233 |
fun prepare_span parser span = |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
234 |
let |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
235 |
val range_pos = Position.encode_range (ThyEdit.span_range span); |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
236 |
val toks = ThyEdit.span_content span; |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
237 |
val _ = List.app ThyEdit.report_token toks; |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
238 |
in |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
239 |
(case Source.exhaust (toplevel_source false NONE (K parser) (Source.of_list toks)) of |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
240 |
[tr] => (tr, true) |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
241 |
| [] => (Toplevel.ignored range_pos, false) |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
242 |
| _ => (Toplevel.malformed range_pos not_singleton, true)) |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
243 |
handle ERROR msg => (Toplevel.malformed range_pos msg, true) |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
244 |
end; |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
245 |
|
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
246 |
fun prepare_command pos str = |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
247 |
let val (lexs, parser) = get_syntax () in |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
248 |
(case ThyEdit.parse_spans lexs pos str of |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
249 |
[span] => #1 (prepare_span parser span) |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
250 |
| _ => Toplevel.malformed pos not_singleton) |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
251 |
end; |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
252 |
|
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
253 |
|
26611 | 254 |
(* load_thy *) |
7746 | 255 |
|
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
256 |
fun load_thy name pos text time = |
7683 | 257 |
let |
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
258 |
val (lexs, parser) = get_syntax (); |
24065 | 259 |
val text_src = Source.of_list (Library.untabify text); |
23866
5295671034f8
moved deps_thy to ThyLoad (independent of outer syntax);
wenzelm
parents:
23796
diff
changeset
|
260 |
|
17932 | 261 |
val _ = Present.init_theory name; |
27839
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
262 |
val _ = Present.verbatim_source name |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
263 |
(fn () => Source.exhaust (Symbol.source {do_recover = false} text_src)); |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
264 |
val toks = Source.exhausted (ThyEdit.token_source lexs pos text_src); |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
265 |
val spans = Source.exhaust (ThyEdit.span_source toks); |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
266 |
val _ = List.app ThyEdit.report_span spans; |
0be8644c45eb
Symbol.source/OuterLex.source: more explicit do_recover argument;
wenzelm
parents:
27831
diff
changeset
|
267 |
val trs = map (prepare_span parser) spans |> filter #2 |> map #1; |
23866
5295671034f8
moved deps_thy to ThyLoad (independent of outer syntax);
wenzelm
parents:
23796
diff
changeset
|
268 |
|
5295671034f8
moved deps_thy to ThyLoad (independent of outer syntax);
wenzelm
parents:
23796
diff
changeset
|
269 |
val _ = if time then writeln ("\n**** Starting theory " ^ quote name ^ " ****") else (); |
25685 | 270 |
val _ = cond_timeit time "" (fn () => |
27353
71c4dd53d4cb
moved global keywords from OuterSyntax to OuterKeyword, tuned interfaces;
wenzelm
parents:
26990
diff
changeset
|
271 |
ThyOutput.process_thy (#1 lexs) OuterKeyword.command_tags is_markup trs toks |
23866
5295671034f8
moved deps_thy to ThyLoad (independent of outer syntax);
wenzelm
parents:
23796
diff
changeset
|
272 |
|> Buffer.content |
5295671034f8
moved deps_thy to ThyLoad (independent of outer syntax);
wenzelm
parents:
23796
diff
changeset
|
273 |
|> Present.theory_output name); |
5295671034f8
moved deps_thy to ThyLoad (independent of outer syntax);
wenzelm
parents:
23796
diff
changeset
|
274 |
val _ = if time then writeln ("**** Finished theory " ^ quote name ^ " ****\n") else (); |
24065 | 275 |
in () end; |
23866
5295671034f8
moved deps_thy to ThyLoad (independent of outer syntax);
wenzelm
parents:
23796
diff
changeset
|
276 |
|
5829 | 277 |
end; |