[project @ 2003-07-21 15:14:18 by ross]
[ghc-hetmet.git] / ghc / compiler / main / GetImports.hs
index 84d6831..57ded51 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: GetImports.hs,v 1.7 2001/05/29 01:07:00 sof Exp $
+-- $Id: GetImports.hs,v 1.10 2002/09/13 15:02:34 simonpj Exp $
 --
 -- GHC Driver program
 --
@@ -60,7 +60,7 @@ getImports s
         f si ni me [] = (nub si, nub ni, me)
 
         mkMN str = mkModuleName (takeWhile isModId (reverse str))
-        isModId c = isAlphaNum c || c `elem` "'_"
+        isModId c = isAlphaNum c || c `elem` "'._"
 
 
 -- remove literals and comments from a string, producing a 
@@ -83,6 +83,10 @@ clean s
         keep acc ('-':'-':cs)         = cons acc (linecomment cs)
         keep acc ('{':'-':'#':' ':cs) = cons acc (cons "#-{" (keep "" cs))
         keep acc ('{':'-':cs)         = cons acc (runcomment (0::Int) cs)      -- -}
+       keep acc ('{':cs)             = cons acc (keep "" cs)
+       keep acc (';':cs)             = cons acc (keep "" cs)
+             -- treat ';' and '{' as word separators so that stuff
+            -- like "{import A;" and ";;;;import B;" are handled correctly.
         keep acc (c:cs)               = keep (c:acc) cs
 
         cons [] xs = xs