src/Pure/Thy/thy_parse.ML
changeset 4056 abb0f4742ed7
parent 4047 67b5552b1067
child 4099 0ec0d2dbe3f4
equal deleted inserted replaced
4055:69892b85f800 4056:abb0f4742ed7
   435 
   435 
   436 type syntax =
   436 type syntax =
   437   lexicon * (token list -> (string * string) * token list) Symtab.table;
   437   lexicon * (token list -> (string * string) * token list) Symtab.table;
   438 
   438 
   439 fun make_syntax keywords sects =
   439 fun make_syntax keywords sects =
   440   (make_lexicon (map fst sects @ keywords),
   440   let
   441     Symtab.make sects handle Symtab.DUPS dups =>
   441     val dups = duplicates (map fst sects);
   442       error ("Duplicate sections in theory file syntax: " ^ commas_quote dups));
   442     val sects' = gen_distinct eq_fst sects;
       
   443   in
       
   444     if null dups then ()
       
   445     else warning ("Duplicate declaration of theory file sections:\n" ^ commas_quote dups);
       
   446     (make_lexicon (map fst sects' @ keywords), Symtab.make sects')
       
   447   end;
   443 
   448 
   444 
   449 
   445 (* header *)
   450 (* header *)
   446 
   451 
   447 fun mk_header (thy_name, bases) =
   452 fun mk_header (thy_name, bases) =
   509     ^ extxt ^ "\n\
   514     ^ extxt ^ "\n\
   510     \\n\
   515     \\n\
   511     \|> Theory.add_name " ^ quote thy_name ^ ";\n\
   516     \|> Theory.add_name " ^ quote thy_name ^ ";\n\
   512     \\n\
   517     \\n\
   513     \val _ = store_theory (thy, " ^ quote thy_name ^ ");\n\
   518     \val _ = store_theory (thy, " ^ quote thy_name ^ ");\n\
       
   519     \val _ = context thy;\n\
   514     \\n\
   520     \\n\
   515     \\n"
   521     \\n"
   516     ^ postxt ^ "\n\
   522     ^ postxt ^ "\n\
   517     \\n\
   523     \\n\
   518     \end;\n\
   524     \end;\n\