From f53f35978f4cd6b0e4c5e9123b5e88f04f6f4452 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 1 Apr 2004 09:51:32 +0000 Subject: 2beta2 --- src/GF/Infra/ReadFiles.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/GF/Infra/ReadFiles.hs') diff --git a/src/GF/Infra/ReadFiles.hs b/src/GF/Infra/ReadFiles.hs index 4172ee32e..46091c6b5 100644 --- a/src/GF/Infra/ReadFiles.hs +++ b/src/GF/Infra/ReadFiles.hs @@ -6,7 +6,7 @@ module ReadFiles -- getAllFiles,fixNewlines,ModName,getOptionsFromFile, -- -gfcFile,gfFile,gfrFile,isGFC,resModName) where +gfcFile,gfFile,gfrFile,isGFC,resModName,isOldFile) where import Arch (selectLater, modifiedFiles, ModTime, getModTime,laterModTime) @@ -251,6 +251,18 @@ getOptionsFromFile file = do 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 + let s' = unComm s + return $ not (null s') && old (head (words s')) + where + old = flip elem $ words + "cat category data def flags fun include lin lincat lindef lintype oper param pattern printname rule" + + + -- old GF tolerated newlines in quotes. No more supported! fixNewlines s = case s of '"':cs -> '"':mk cs -- cgit v1.2.3