13 end; |
13 end; |
14 |
14 |
15 signature ATTRIB = |
15 signature ATTRIB = |
16 sig |
16 sig |
17 include BASIC_ATTRIB |
17 include BASIC_ATTRIB |
|
18 val help_attributes: theory -> unit |
18 exception ATTRIB_FAIL of (string * Position.T) * exn |
19 exception ATTRIB_FAIL of (string * Position.T) * exn |
19 val global_attribute: theory -> Args.src -> theory attribute |
20 val global_attribute: theory -> Args.src -> theory attribute |
20 val local_attribute: theory -> Args.src -> Proof.context attribute |
21 val local_attribute: theory -> Args.src -> Proof.context attribute |
21 val local_attribute': Proof.context -> Args.src -> Proof.context attribute |
22 val local_attribute': Proof.context -> Args.src -> Proof.context attribute |
22 val add_attributes: (bstring * ((Args.src -> theory attribute) * |
23 val add_attributes: (bstring * ((Args.src -> theory attribute) * |
56 fun merge ({space = space1, attrs = attrs1}, {space = space2, attrs = attrs2}) = |
57 fun merge ({space = space1, attrs = attrs1}, {space = space2, attrs = attrs2}) = |
57 {space = NameSpace.merge (space1, space2), |
58 {space = NameSpace.merge (space1, space2), |
58 attrs = Symtab.merge eq_snd (attrs1, attrs2) handle Symtab.DUPS dups => |
59 attrs = Symtab.merge eq_snd (attrs1, attrs2) handle Symtab.DUPS dups => |
59 error ("Attempt to merge different versions of attributes " ^ commas_quote dups)}; |
60 error ("Attempt to merge different versions of attributes " ^ commas_quote dups)}; |
60 |
61 |
61 fun print _ ({space, attrs}) = |
62 fun print_atts verbose ({space, attrs}) = |
62 let |
63 let |
63 fun prt_attr (name, ((_, comment), _)) = Pretty.block |
64 fun prt_attr (name, ((_, comment), _)) = Pretty.block |
64 [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment]; |
65 [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment]; |
65 in |
66 in |
66 Pretty.writeln (Display.pretty_name_space ("attribute name space", space)); |
67 if not verbose then () |
|
68 else Pretty.writeln (Display.pretty_name_space ("attribute name space", space)); |
67 Pretty.writeln (Pretty.big_list "attributes:" |
69 Pretty.writeln (Pretty.big_list "attributes:" |
68 (map prt_attr (NameSpace.cond_extern_table space attrs))) |
70 (map prt_attr (NameSpace.cond_extern_table space attrs))) |
69 end; |
71 end; |
|
72 |
|
73 fun print _ = print_atts true; |
70 end; |
74 end; |
71 |
75 |
72 structure AttributesData = TheoryDataFun(AttributesDataArgs); |
76 structure AttributesData = TheoryDataFun(AttributesDataArgs); |
73 val print_attributes = AttributesData.print; |
77 val print_attributes = AttributesData.print; |
|
78 val help_attributes = AttributesDataArgs.print_atts false o AttributesData.get; |
74 |
79 |
75 |
80 |
76 (* get global / local attributes *) |
81 (* get global / local attributes *) |
77 |
82 |
78 exception ATTRIB_FAIL of (string * Position.T) * exn; |
83 exception ATTRIB_FAIL of (string * Position.T) * exn; |