src/Pure/Isar/attrib.ML
changeset 23655 d2d1138e0ddc
parent 23577 c5b93c69afd3
child 23937 66e1f24d655d
equal deleted inserted replaced
23654:a2ad1c166ac8 23655:d2d1138e0ddc
    52 (
    52 (
    53   type T = (((src -> attribute) * string) * stamp) NameSpace.table;
    53   type T = (((src -> attribute) * string) * stamp) NameSpace.table;
    54   val empty = NameSpace.empty_table;
    54   val empty = NameSpace.empty_table;
    55   val copy = I;
    55   val copy = I;
    56   val extend = I;
    56   val extend = I;
    57   fun merge _ tables : T = NameSpace.merge_tables (eq_snd (op =)) tables handle Symtab.DUPS dups =>
    57   fun merge _ tables : T = NameSpace.merge_tables (eq_snd (op =)) tables handle Symtab.DUP dup =>
    58     error ("Attempt to merge different versions of attribute(s) " ^ commas_quote dups);
    58     error ("Attempt to merge different versions of attribute " ^ quote dup);
    59 );
    59 );
    60 
    60 
    61 fun print_attributes thy =
    61 fun print_attributes thy =
    62   let
    62   let
    63     val attribs = AttributesData.get thy;
    63     val attribs = AttributesData.get thy;
   126 fun add_attributes raw_attrs thy =
   126 fun add_attributes raw_attrs thy =
   127   let
   127   let
   128     val new_attrs =
   128     val new_attrs =
   129       raw_attrs |> map (fn (name, att, comment) => (name, ((att, comment), stamp ())));
   129       raw_attrs |> map (fn (name, att, comment) => (name, ((att, comment), stamp ())));
   130     fun add attrs = NameSpace.extend_table (Sign.naming_of thy) new_attrs attrs
   130     fun add attrs = NameSpace.extend_table (Sign.naming_of thy) new_attrs attrs
   131       handle Symtab.DUPS dups =>
   131       handle Symtab.DUP dup => error ("Duplicate declaration of attributes " ^ quote dup);
   132         error ("Duplicate declaration of attributes(s) " ^ commas_quote dups);
       
   133   in AttributesData.map add thy end;
   132   in AttributesData.map add thy end;
   134 
   133 
   135 
   134 
   136 
   135 
   137 (** attribute parsers **)
   136 (** attribute parsers **)
   138 
   137 
   139 (* tags *)
   138 (* tags *)
   140 
   139 
   141 fun tag x = Scan.lift (Args.name -- Scan.repeat Args.name) x;
   140 fun tag x = Scan.lift (Args.name -- Args.name) x;
   142 
   141 
   143 
   142 
   144 (* theorems *)
   143 (* theorems *)
   145 
   144 
   146 local
   145 local