summaryrefslogtreecommitdiff
path: root/src/GF/Infra/ReadFiles.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-09-16 20:52:27 +0000
committeraarne <aarne@cs.chalmers.se>2007-09-16 20:52:27 +0000
commit133b716338db3c61d28556b7c8fd2280dd4ec4d3 (patch)
treea0ff9ebfb1fe413717235c4c2f7263634b8e0356 /src/GF/Infra/ReadFiles.hs
parente8d2281684ea4c8a1cd3a32a5068a34ff8a95f07 (diff)
strict reading of files; bug fix in readFiles in ShellState
Diffstat (limited to 'src/GF/Infra/ReadFiles.hs')
-rw-r--r--src/GF/Infra/ReadFiles.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/GF/Infra/ReadFiles.hs b/src/GF/Infra/ReadFiles.hs
index 699eb5081..fa3298158 100644
--- a/src/GF/Infra/ReadFiles.hs
+++ b/src/GF/Infra/ReadFiles.hs
@@ -304,6 +304,7 @@ getModuleHeader ws = case ws of
---- ((MTyOther,name),(m,MUInstance):(n,MUOther):[(n,MUComplete) | n <- ms])
m:"with":ms -> ((MTyOther,name),(m,MUOther):[(n,MUComplete) | n <- ms])
ms -> ((MTyOther,name),[(n,MUOther) | n <- ms])
+ _ -> error "the file is empty"
unComm s = case s of
'-':'-':cs -> unComm $ dropWhile (/='\n') cs
@@ -323,14 +324,14 @@ lexs s = x:xs where
-- | options can be passed to the compiler by comments in @--#@, in the main file
getOptionsFromFile :: FilePath -> IO Options
getOptionsFromFile file = do
- s <- readFileIf file
+ s <- readFileIfStrict file
let ls = filter (isPrefixOf "--#") $ lines s
return $ fst $ getOptions "-" $ map (unwords . words . drop 3) ls
-- | check if old GF file
isOldFile :: FilePath -> IO Bool
isOldFile f = do
- s <- readFileIf f
+ s <- readFileIfStrict f
let s' = unComm s
return $ not (null s') && old (head (words s'))
where