dup sections: warning instead of error;
authorwenzelm
Fri, 31 Oct 1997 15:28:01 +0100
changeset 4056 abb0f4742ed7
parent 4055 69892b85f800
child 4057 edd8cb346109
dup sections: warning instead of error;
src/Pure/Thy/thy_parse.ML
--- a/src/Pure/Thy/thy_parse.ML	Fri Oct 31 15:21:59 1997 +0100
+++ b/src/Pure/Thy/thy_parse.ML	Fri Oct 31 15:28:01 1997 +0100
@@ -437,9 +437,14 @@
   lexicon * (token list -> (string * string) * token list) Symtab.table;
 
 fun make_syntax keywords sects =
-  (make_lexicon (map fst sects @ keywords),
-    Symtab.make sects handle Symtab.DUPS dups =>
-      error ("Duplicate sections in theory file syntax: " ^ commas_quote dups));
+  let
+    val dups = duplicates (map fst sects);
+    val sects' = gen_distinct eq_fst sects;
+  in
+    if null dups then ()
+    else warning ("Duplicate declaration of theory file sections:\n" ^ commas_quote dups);
+    (make_lexicon (map fst sects' @ keywords), Symtab.make sects')
+  end;
 
 
 (* header *)
@@ -511,6 +516,7 @@
     \|> Theory.add_name " ^ quote thy_name ^ ";\n\
     \\n\
     \val _ = store_theory (thy, " ^ quote thy_name ^ ");\n\
+    \val _ = context thy;\n\
     \\n\
     \\n"
     ^ postxt ^ "\n\