src/Pure/Isar/outer_syntax.ML
changeset 57026 90a3e39be0ca
parent 56938 ef44b488bad8
child 57105 bf5ddf4ec64b
equal deleted inserted replaced
57025:e7fd64f82876 57026:90a3e39be0ca
   155       | NONE =>
   155       | NONE =>
   156           if Context.theory_name thy = Context.PureN
   156           if Context.theory_name thy = Context.PureN
   157           then Keyword.define (name, SOME kind)
   157           then Keyword.define (name, SOME kind)
   158           else error ("Undeclared outer syntax command " ^ quote name ^ Position.here pos));
   158           else error ("Undeclared outer syntax command " ^ quote name ^ Position.here pos));
   159     val _ = Context_Position.report_generic context pos (command_markup true (name, cmd));
   159     val _ = Context_Position.report_generic context pos (command_markup true (name, cmd));
   160 
       
   161     fun redefining () =
       
   162       "Redefining outer syntax command " ^ quote name ^ Position.here (Position.thread_data ());
       
   163   in
   160   in
   164     Unsynchronized.change global_outer_syntax (map_commands (fn commands =>
   161     Unsynchronized.change global_outer_syntax (map_commands (fn commands =>
   165      (if not (Symtab.defined commands name) then ()
   162      (if not (Symtab.defined commands name) then ()
       
   163       else if ! batch_mode then
       
   164         error ("Attempt to redefine outer syntax command " ^ quote name)
   166       else
   165       else
   167         let
   166         warning ("Redefining outer syntax command " ^ quote name ^
   168           val _ = warning (redefining ());
   167           Position.here (Position.thread_data ()));
   169           val _ =
       
   170             if ! batch_mode then
       
   171               Output.physical_stderr ("### Legacy feature!! " ^ redefining () ^ "\n")
       
   172             else ();
       
   173         in () end;
       
   174       Symtab.update (name, cmd) commands)))
   168       Symtab.update (name, cmd) commands)))
   175   end);
   169   end);
   176 
   170 
   177 in
   171 in
   178 
   172