src/Pure/Isar/outer_syntax.ML
changeset 37713 c82cf6e11669
parent 37216 3165bc303f66
child 37852 a902f158b4fc
--- a/src/Pure/Isar/outer_syntax.ML	Mon Jul 05 22:26:20 2010 +0200
+++ b/src/Pure/Isar/outer_syntax.ML	Mon Jul 05 23:07:36 2010 +0200
@@ -240,7 +240,10 @@
     val _ = List.app Thy_Syntax.report_token toks;
   in
     (case Source.exhaust (toplevel_source false NONE (K commands) (Source.of_list toks)) of
-      [tr] => (tr, true)
+      [tr] =>
+        if Keyword.is_control (Toplevel.name_of tr) then
+          (Toplevel.malformed range_pos "Illegal control command", true)
+        else (tr, true)
     | [] => (Toplevel.ignored range_pos, false)
     | _ => (Toplevel.malformed range_pos not_singleton, true))
     handle ERROR msg => (Toplevel.malformed range_pos msg, true)