src/Pure/Isar/theory_target.ML
changeset 21006 ac2732072403
parent 20984 d09f388fa9db
child 21037 4b52b23f50eb
equal deleted inserted replaced
21005:8f3896f0e5af 21006:ac2732072403
     5 Common theory targets.
     5 Common theory targets.
     6 *)
     6 *)
     7 
     7 
     8 signature THEORY_TARGET =
     8 signature THEORY_TARGET =
     9 sig
     9 sig
       
    10   val peek: local_theory -> string option
    10   val begin: bstring -> Proof.context -> local_theory
    11   val begin: bstring -> Proof.context -> local_theory
    11   val init: xstring option -> theory -> local_theory
    12   val init: xstring option -> theory -> local_theory
    12   val init_i: string option -> theory -> local_theory
    13   val init_i: string option -> theory -> local_theory
    13   val mapping: xstring option -> (local_theory -> local_theory) -> theory -> Proof.context * theory
    14   val mapping: xstring option -> (local_theory -> local_theory) -> theory -> Proof.context * theory
    14 end;
    15 end;
    15 
    16 
    16 structure TheoryTarget: THEORY_TARGET =
    17 structure TheoryTarget: THEORY_TARGET =
    17 struct
    18 struct
    18 
    19 
    19 (** locale targets **)
    20 (** locale targets **)
       
    21 
       
    22 (* context data *)
       
    23 
       
    24 structure Data = ProofDataFun
       
    25 (
       
    26   val name = "Isar/theory_target";
       
    27   type T = string option;
       
    28   fun init _ = NONE;
       
    29   fun print _ _ = ();
       
    30 );
       
    31 
       
    32 val _ = Context.add_setup Data.init;
       
    33 val peek = Data.get;
       
    34 
    20 
    35 
    21 (* pretty *)
    36 (* pretty *)
    22 
    37 
    23 fun pretty loc ctxt =
    38 fun pretty loc ctxt =
    24   let
    39   let
   196     axioms = axioms,
   211     axioms = axioms,
   197     defs = defs,
   212     defs = defs,
   198     notes = notes loc,
   213     notes = notes loc,
   199     term_syntax = term_syntax loc,
   214     term_syntax = term_syntax loc,
   200     declaration = declaration loc,
   215     declaration = declaration loc,
   201     exit = K I};
   216     exit = K I}
       
   217   #> Data.put (SOME loc);
   202 
   218 
   203 fun init_i NONE thy = begin "" (ProofContext.init thy)
   219 fun init_i NONE thy = begin "" (ProofContext.init thy)
   204   | init_i (SOME loc) thy = begin loc (Locale.init loc thy);
   220   | init_i (SOME loc) thy = begin loc (Locale.init loc thy);
   205 
   221 
   206 fun init loc thy = init_i (Option.map (Locale.intern thy) loc) thy;
   222 fun init loc thy = init_i (Option.map (Locale.intern thy) loc) thy;