47 val dest_parsers: unit -> (string * string * string * bool) list |
47 val dest_parsers: unit -> (string * string * string * bool) list |
48 val print_outer_syntax: unit -> unit |
48 val print_outer_syntax: unit -> unit |
49 val add_keywords: string list -> unit |
49 val add_keywords: string list -> unit |
50 val add_parsers: parser list -> unit |
50 val add_parsers: parser list -> unit |
51 val theory_header: token list -> (string * string list * (string * bool) list) * token list |
51 val theory_header: token list -> (string * string list * (string * bool) list) * token list |
52 val deps_thy: string -> bool -> Path.T -> string list * Path.T list |
52 val deps_thy: string -> Path.T -> string list * Path.T list |
53 val load_thy: string -> bool -> bool -> Path.T -> unit |
53 val load_thy: string -> bool -> bool -> Path.T -> unit |
54 val isar: bool -> Toplevel.isar |
54 val isar: bool -> Toplevel.isar |
55 end; |
55 end; |
56 |
56 |
57 structure OuterSyntax: OUTER_SYNTAX = |
57 structure OuterSyntax: OUTER_SYNTAX = |
268 P.name -- (P.$$$ "=" |-- P.name -- Scan.repeat (P.$$$ "+" |-- P.name)) |
268 P.name -- (P.$$$ "=" |-- P.name -- Scan.repeat (P.$$$ "+" |-- P.name)) |
269 >> (fn (A, (B, Bs)) => (A, B :: Bs, []: (string * bool) list)); |
269 >> (fn (A, (B, Bs)) => (A, B :: Bs, []: (string * bool) list)); |
270 |
270 |
271 end; |
271 end; |
272 |
272 |
273 fun deps_thy name ml path = |
273 fun deps_thy name path = |
274 let |
274 let |
275 val src = File.source path; |
275 val src = File.source path; |
276 val is_old = warn_theory_style path (is_old_theory src); |
276 val is_old = warn_theory_style path (is_old_theory src); |
277 val (name', parents, files) = |
277 val (name', parents, files) = |
278 (*Note: old style headers dynamically depend on the current lexicon :-( *) |
278 (*Note: old style headers dynamically depend on the current lexicon :-( *) |
279 if is_old then scan_header ThySyn.get_lexicon (Scan.error old_header) src |
279 if is_old then scan_header ThySyn.get_lexicon (Scan.error old_header) src |
280 else scan_header (K header_lexicon) (Scan.error new_header) src; |
280 else scan_header (K header_lexicon) (Scan.error new_header) src; |
281 |
281 |
282 val ml_path = ThyLoad.ml_path name; |
282 val ml_path = ThyLoad.ml_path name; |
283 val ml_file = if not ml orelse is_none (ThyLoad.check_file ml_path) then [] else [ml_path]; |
283 val ml_file = if is_none (ThyLoad.check_file ml_path) then [] else [ml_path]; |
284 in |
284 in |
285 if name <> name' then |
285 if name <> name' then |
286 error ("Filename " ^ quote (Path.pack path) ^ " does not match theory name " ^ quote name) |
286 error ("Filename " ^ quote (Path.pack path) ^ " does not match theory name " ^ quote name) |
287 else (parents, map (Path.unpack o #1) files @ ml_file) |
287 else (parents, map (Path.unpack o #1) files @ ml_file) |
288 end; |
288 end; |