-----------------------------------------------------------------------------
--- $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
--
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
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