23
|
1 |
theory Base
|
|
2 |
imports Main
|
|
3 |
uses
|
57
|
4 |
"chunks.ML"
|
23
|
5 |
"antiquote_setup.ML"
|
|
6 |
begin
|
|
7 |
|
64
9a6e5e0c4906
deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
8 |
(* to have a special tag for text enclosed in ML *)
|
9a6e5e0c4906
deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
9 |
ML {*
|
9a6e5e0c4906
deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
10 |
|
210
|
11 |
fun inherit_env (context as Context.Proof lthy) =
|
|
12 |
Context.Proof (LocalTheory.map_contexts (ML_Context.inherit_env context) lthy)
|
|
13 |
| inherit_env context = context;
|
|
14 |
|
|
15 |
fun inherit_env_prf prf = Proof.map_contexts
|
|
16 |
(Context.proof_map (ML_Context.inherit_env (Context.Proof (Proof.context_of prf)))) prf
|
|
17 |
|
64
9a6e5e0c4906
deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
18 |
val _ =
|
9a6e5e0c4906
deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
19 |
OuterSyntax.command "ML" "eval ML text within theory"
|
106
bdd82350cf22
renamed in the pdf all instances of cookbook to tutorial (in order to sound more serious)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
20 |
(OuterKeyword.tag "TutorialML" OuterKeyword.thy_decl)
|
64
9a6e5e0c4906
deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
21 |
(OuterParse.ML_source >> (fn (txt, pos) =>
|
210
|
22 |
Toplevel.generic_theory
|
|
23 |
(ML_Context.exec (fn () => ML_Context.eval true pos txt) #> inherit_env)));
|
|
24 |
|
|
25 |
|
|
26 |
val _ =
|
|
27 |
OuterSyntax.command "ML_prf" "ML text within proof"
|
|
28 |
(OuterKeyword.tag "TutorialML" OuterKeyword.prf_decl)
|
|
29 |
(OuterParse.ML_source >> (fn (txt, pos) =>
|
|
30 |
Toplevel.proof (Proof.map_context (Context.proof_map
|
|
31 |
(ML_Context.exec (fn () => ML_Context.eval true pos txt))) #> inherit_env_prf)))
|
|
32 |
|
64
9a6e5e0c4906
deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
33 |
*}
|
161
|
34 |
(*
|
160
cc9359bfacf4
redefined the functions warning and tracing in order to properly match more antiquotations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
35 |
ML {*
|
cc9359bfacf4
redefined the functions warning and tracing in order to properly match more antiquotations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
36 |
fun warning str = str
|
cc9359bfacf4
redefined the functions warning and tracing in order to properly match more antiquotations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
37 |
fun tracing str = str
|
cc9359bfacf4
redefined the functions warning and tracing in order to properly match more antiquotations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
38 |
*}
|
161
|
39 |
*)
|
23
|
40 |
end
|