equal
deleted
inserted
replaced
55 val print_translation: string -> theory -> theory |
55 val print_translation: string -> theory -> theory |
56 val typed_print_translation: string -> theory -> theory |
56 val typed_print_translation: string -> theory -> theory |
57 val print_ast_translation: string -> theory -> theory |
57 val print_ast_translation: string -> theory -> theory |
58 val token_translation: string -> theory -> theory |
58 val token_translation: string -> theory -> theory |
59 val add_oracle: bstring * string -> theory -> theory |
59 val add_oracle: bstring * string -> theory -> theory |
60 val the_theory: string -> unit -> theory |
60 val theory: string * string list * (string * bool) list |
61 val begin_theory: string * string list -> unit -> theory |
61 -> Toplevel.transition -> Toplevel.transition |
62 val end_theory: theory -> unit |
62 val context: string -> Toplevel.transition -> Toplevel.transition |
|
63 val update_context: string -> Toplevel.transition -> Toplevel.transition |
63 end; |
64 end; |
64 |
65 |
65 structure IsarThy: ISAR_THY = |
66 structure IsarThy: ISAR_THY = |
66 struct |
67 struct |
67 |
68 |
237 ("(" ^ quote name ^ ", " ^ txt ^ ")"); |
238 ("(" ^ quote name ^ ", " ^ txt ^ ")"); |
238 |
239 |
239 |
240 |
240 (* theory init and exit *) |
241 (* theory init and exit *) |
241 |
242 |
242 fun the_theory name () = ThyInfo.theory name; |
243 fun begin_theory (name, parents, files) () = |
243 |
244 let val thy = ThyInfo.begin_theory name parents |
244 fun begin_theory (name, names) () = ThyInfo.begin_theory name names; |
245 in seq ThyInfo.use (mapfilter (fn (x, true) => Some x | _ => None) files); thy end; |
245 |
246 |
246 fun end_theory thy = |
247 fun end_theory thy = |
247 let val thy' = PureThy.end_theory thy in |
248 let val thy' = PureThy.end_theory thy in |
248 transform_error ThyInfo.put_theory thy' |
249 transform_error ThyInfo.put_theory thy' |
249 handle exn => raise PureThy.ROLLBACK (thy', Some exn) (* FIXME !!?? *) |
250 handle exn => raise PureThy.ROLLBACK (thy', Some exn) (* FIXME !!?? *) |
250 end; |
251 end; |
251 |
252 |
|
253 fun theory spec = Toplevel.init_theory (begin_theory spec) end_theory; |
|
254 |
|
255 |
|
256 (* context switch *) |
|
257 |
|
258 fun switch_theory require name = |
|
259 Toplevel.init_theory |
|
260 (fn () => (Context.save require name; ThyInfo.get_theory name)) (K ()); |
|
261 |
|
262 val context = switch_theory ThyInfo.use_thy; |
|
263 val update_context = switch_theory ThyInfo.update_thy; |
|
264 |
252 |
265 |
253 end; |
266 end; |