Merge branch 'master' of http://darcs.haskell.org/ghc into ghc-generics
[ghc-hetmet.git] / compiler / parser / ParserCoreUtils.hs
index 4aa3341..8f67d96 100644 (file)
@@ -1,6 +1,7 @@
 module ParserCoreUtils where
 
-import IO 
+import Exception
+import System.IO
 
 data ParseResult a = OkP a | FailP String
 type P a = String -> Int -> ParseResult a
@@ -19,7 +20,7 @@ failP s s' _ = FailP (s ++ ":" ++ s')
 
 getCoreModuleName :: FilePath -> IO String
 getCoreModuleName fpath = 
-   catch (do 
+   catchIO (do
      h  <- openFile fpath ReadMode
      ls <- hGetContents h
      let mo = findMod (words ls)
@@ -30,6 +31,7 @@ getCoreModuleName fpath =
     (\ _ -> return "Main")
  where
    findMod [] = "Main"
+   -- TODO: this should just return the module name, without the package name
    findMod ("%module":m:_) = m
    findMod (_:xs) = findMod xs
 
@@ -47,6 +49,7 @@ data Token =
  | TKcast
  | TKnote
  | TKexternal
+ | TKlocal
  | TKwild
  | TKoparen
  | TKcparen
@@ -54,7 +57,9 @@ data Token =
  | TKcbrace
  | TKhash
  | TKeq
+ | TKcolon
  | TKcoloncolon
+ | TKcoloneqcolon
  | TKstar
  | TKrarrow
  | TKlambda