equal
deleted
inserted
replaced
17 (* style data *) |
17 (* style data *) |
18 |
18 |
19 fun err_dup_style name = |
19 fun err_dup_style name = |
20 error ("Duplicate declaration of antiquote style: " ^ quote name); |
20 error ("Duplicate declaration of antiquote style: " ^ quote name); |
21 |
21 |
22 structure StyleData = Theory_Data |
22 structure Styles = Theory_Data |
23 ( |
23 ( |
24 type T = ((Proof.context -> term -> term) parser * stamp) Symtab.table; |
24 type T = ((Proof.context -> term -> term) parser * stamp) Symtab.table; |
25 val empty = Symtab.empty; |
25 val empty = Symtab.empty; |
26 val extend = I; |
26 val extend = I; |
27 fun merge data : T = Symtab.merge (eq_snd (op =)) data |
27 fun merge data : T = Symtab.merge (eq_snd (op =)) data |
30 |
30 |
31 |
31 |
32 (* accessors *) |
32 (* accessors *) |
33 |
33 |
34 fun the_style thy name = |
34 fun the_style thy name = |
35 (case Symtab.lookup (StyleData.get thy) name of |
35 (case Symtab.lookup (Styles.get thy) name of |
36 NONE => error ("Unknown antiquote style: " ^ quote name) |
36 NONE => error ("Unknown antiquote style: " ^ quote name) |
37 | SOME (style, _) => style); |
37 | SOME (style, _) => style); |
38 |
38 |
39 fun setup name style thy = |
39 fun setup name style thy = |
40 StyleData.map (Symtab.update_new (name, (style, stamp ()))) thy |
40 Styles.map (Symtab.update_new (name, (style, stamp ()))) thy |
41 handle Symtab.DUP _ => err_dup_style name; |
41 handle Symtab.DUP _ => err_dup_style name; |
42 |
42 |
43 |
43 |
44 (* style parsing *) |
44 (* style parsing *) |
45 |
45 |