FIX #3153: we lost an EOF sentinel in the event of a lexical error
authorSimon Marlow <marlowsd@gmail.com>
Tue, 21 Apr 2009 09:45:58 +0000 (09:45 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Tue, 21 Apr 2009 09:45:58 +0000 (09:45 +0000)
compiler/main/HeaderInfo.hs

index 89f4661..0fd62f5 100644 (file)
@@ -123,8 +123,9 @@ lazyGetToks dflags filename handle = do
                   _other    -> do rest <- lazyLexBuf handle state' eof
                                   return (t : rest)
       _ | not eof   -> getMore handle state
-        | otherwise -> return []
-  
+        | otherwise -> return [L (last_loc state) ITeof]
+                         -- parser assumes an ITeof sentinel at the end
+
   getMore :: Handle -> PState -> IO [Located Token]
   getMore handle state = do
      -- pprTrace "getMore" (text (show (buffer state))) (return ())