equal
deleted
inserted
replaced
12 val thm: xstring -> thm |
12 val thm: xstring -> thm |
13 val thms: xstring -> thm list |
13 val thms: xstring -> thm list |
14 val exec: (unit -> unit) -> Context.generic -> Context.generic |
14 val exec: (unit -> unit) -> Context.generic -> Context.generic |
15 val check_antiquotation: Proof.context -> xstring * Position.T -> string |
15 val check_antiquotation: Proof.context -> xstring * Position.T -> string |
16 type decl = Proof.context -> string * string |
16 type decl = Proof.context -> string * string |
17 val add_antiquotation: binding -> (Args.src -> Proof.context -> decl * Proof.context) -> |
17 val add_antiquotation: binding -> (Token.src -> Proof.context -> decl * Proof.context) -> |
18 theory -> theory |
18 theory -> theory |
19 val print_antiquotations: Proof.context -> unit |
19 val print_antiquotations: Proof.context -> unit |
20 val eval_antiquotes: ML_Lex.token Antiquote.antiquote list * Position.T -> |
20 val eval_antiquotes: ML_Lex.token Antiquote.antiquote list * Position.T -> |
21 Context.generic option -> (ML_Lex.token list * ML_Lex.token list) * Context.generic option |
21 Context.generic option -> (ML_Lex.token list * ML_Lex.token list) * Context.generic option |
22 val eval: ML_Compiler.flags -> Position.T -> ML_Lex.token Antiquote.antiquote list -> unit |
22 val eval: ML_Compiler.flags -> Position.T -> ML_Lex.token Antiquote.antiquote list -> unit |
53 (* theory data *) |
53 (* theory data *) |
54 |
54 |
55 type decl = Proof.context -> string * string; (*final context -> ML env, ML body*) |
55 type decl = Proof.context -> string * string; (*final context -> ML env, ML body*) |
56 structure Antiquotations = Theory_Data |
56 structure Antiquotations = Theory_Data |
57 ( |
57 ( |
58 type T = (Args.src -> Proof.context -> decl * Proof.context) Name_Space.table; |
58 type T = (Token.src -> Proof.context -> decl * Proof.context) Name_Space.table; |
59 val empty : T = Name_Space.empty_table Markup.ML_antiquotationN; |
59 val empty : T = Name_Space.empty_table Markup.ML_antiquotationN; |
60 val extend = I; |
60 val extend = I; |
61 fun merge data : T = Name_Space.merge_tables data; |
61 fun merge data : T = Name_Space.merge_tables data; |
62 ); |
62 ); |
63 |
63 |
73 Pretty.big_list "ML antiquotations:" |
73 Pretty.big_list "ML antiquotations:" |
74 (map (Pretty.mark_str o #1) (Name_Space.markup_table ctxt (get_antiquotations ctxt))) |
74 (map (Pretty.mark_str o #1) (Name_Space.markup_table ctxt (get_antiquotations ctxt))) |
75 |> Pretty.writeln; |
75 |> Pretty.writeln; |
76 |
76 |
77 fun apply_antiquotation src ctxt = |
77 fun apply_antiquotation src ctxt = |
78 let val (src', f) = Args.check_src ctxt (get_antiquotations ctxt) src |
78 let val (src', f) = Token.check_src ctxt (get_antiquotations ctxt) src |
79 in f src' ctxt end; |
79 in f src' ctxt end; |
80 |
80 |
81 |
81 |
82 (* parsing and evaluation *) |
82 (* parsing and evaluation *) |
83 |
83 |
84 local |
84 local |
85 |
85 |
86 val antiq = |
86 val antiq = |
87 Parse.!!! (Parse.position Parse.xname -- Parse.args --| Scan.ahead Parse.eof) |
87 Parse.!!! (Parse.position Parse.xname -- Parse.args --| Scan.ahead Parse.eof) |
88 >> uncurry Args.src; |
88 >> uncurry Token.src; |
89 |
89 |
90 val begin_env0 = ML_Lex.tokenize "structure Isabelle =\nstruct\n"; |
90 val begin_env0 = ML_Lex.tokenize "structure Isabelle =\nstruct\n"; |
91 |
91 |
92 fun begin_env visible = |
92 fun begin_env visible = |
93 ML_Lex.tokenize |
93 ML_Lex.tokenize |