src/Pure/Isar/attrib.ML
changeset 33092 c859019d3ac5
parent 31794 71af1fd6a5e4
child 33095 bbd52d2f8696
     1.1 --- a/src/Pure/Isar/attrib.ML	Sat Oct 24 19:04:57 2009 +0200
     1.2 +++ b/src/Pure/Isar/attrib.ML	Sat Oct 24 19:20:03 2009 +0200
     1.3 @@ -67,27 +67,25 @@
     1.4  
     1.5  structure Attributes = TheoryDataFun
     1.6  (
     1.7 -  type T = (((src -> attribute) * string) * stamp) NameSpace.table;
     1.8 +  type T = ((src -> attribute) * string) NameSpace.table;
     1.9    val empty = NameSpace.empty_table;
    1.10    val copy = I;
    1.11    val extend = I;
    1.12 -  fun merge _ tables : T = NameSpace.merge_tables (eq_snd (op =)) tables handle Symtab.DUP dup =>
    1.13 -    error ("Attempt to merge different versions of attribute " ^ quote dup);
    1.14 +  fun merge _ tables : T = NameSpace.merge_tables tables;
    1.15  );
    1.16  
    1.17  fun print_attributes thy =
    1.18    let
    1.19      val attribs = Attributes.get thy;
    1.20 -    fun prt_attr (name, ((_, comment), _)) = Pretty.block
    1.21 +    fun prt_attr (name, (_, comment)) = Pretty.block
    1.22        [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment];
    1.23    in
    1.24      [Pretty.big_list "attributes:" (map prt_attr (NameSpace.extern_table attribs))]
    1.25      |> Pretty.chunks |> Pretty.writeln
    1.26    end;
    1.27  
    1.28 -fun add_attribute name att comment thy = thy |> Attributes.map (fn atts =>
    1.29 -  #2 (NameSpace.define (Sign.naming_of thy) (name, ((att, comment), stamp ())) atts)
    1.30 -    handle Symtab.DUP dup => error ("Duplicate declaration of attribute " ^ quote dup));
    1.31 +fun add_attribute name att comment thy = thy
    1.32 +  |> Attributes.map (#2 o NameSpace.define true (Sign.naming_of thy) (name, (att, comment)));
    1.33  
    1.34  
    1.35  (* name space *)
    1.36 @@ -117,7 +115,7 @@
    1.37        let val ((name, _), pos) = Args.dest_src src in
    1.38          (case Symtab.lookup attrs name of
    1.39            NONE => error ("Unknown attribute: " ^ quote name ^ Position.str_of pos)
    1.40 -        | SOME ((att, _), _) => (Position.report (Markup.attribute name) pos; att src))
    1.41 +        | SOME (att, _) => (Position.report (Markup.attribute name) pos; att src))
    1.42        end;
    1.43    in attr end;
    1.44