error "Unexpected end of input";
authorwenzelm
Wed, 23 Jan 2002 16:58:45 +0100
changeset 12840 c7066d8b684f
parent 12839 584a3e0b00f2
child 12841 c8ec6803d1cd
error "Unexpected end of input";
src/Pure/Isar/thy_header.ML
--- a/src/Pure/Isar/thy_header.ML	Wed Jan 23 16:58:26 2002 +0100
+++ b/src/Pure/Isar/thy_header.ML	Wed Jan 23 16:58:45 2002 +0100
@@ -24,12 +24,17 @@
 (* scan header *)
 
 fun scan_header get_lex scan (src, pos) =
-  src
-  |> Symbol.source false
-  |> T.source false (fn () => (get_lex (), Scan.empty_lexicon)) pos
-  |> T.source_proper
-  |> Source.source T.stopper (Scan.single scan) None
-  |> (fst o the o Source.get_single);
+  let val res =
+    src
+    |> Symbol.source false
+    |> T.source false (fn () => (get_lex (), Scan.empty_lexicon)) pos
+    |> T.source_proper
+    |> Source.source T.stopper (Scan.single scan) None
+    |> Source.get_single;
+  in
+    (case res of Some (x, _) => x
+    | None => error ("Unexpected end of input" ^ Position.str_of pos))
+  end;
 
 
 (* keywords *)