summaryrefslogtreecommitdiff
path: root/src/GF/Infra/ReadFiles.hs
diff options
context:
space:
mode:
authoraarne <unknown>2003-11-03 16:27:55 +0000
committeraarne <unknown>2003-11-03 16:27:55 +0000
commit94326929b144913642121bef8f8ecc98feb992e7 (patch)
tree07d59cc33cbef2ac79c6f3f573b9718c51322e7a /src/GF/Infra/ReadFiles.hs
parent2728e6e7ceec92c7f781368b4a523b37e5dee3b9 (diff)
Fixed several things, e.g. tokenizer.
Diffstat (limited to 'src/GF/Infra/ReadFiles.hs')
-rw-r--r--src/GF/Infra/ReadFiles.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/GF/Infra/ReadFiles.hs b/src/GF/Infra/ReadFiles.hs
index bc2706b49..285665747 100644
--- a/src/GF/Infra/ReadFiles.hs
+++ b/src/GF/Infra/ReadFiles.hs
@@ -2,11 +2,13 @@ module ReadFiles where
import Arch (selectLater, modifiedFiles, ModTime)
+import Option
import Operations
import UseIO
import System
import Char
import Monad
+import List
-- make analysis for GF grammar modules. AR 11/6/2003
@@ -122,6 +124,14 @@ lexs s = x:xs where
(x,y) = head $ lex s
xs = if null y then [] else lexs y
+-- options can be passed to the compiler by comments in --#, in the main file
+
+getOptionsFromFile :: FilePath -> IO Options
+getOptionsFromFile file = do
+ s <- readFileIf file
+ let ls = filter (isPrefixOf "--#") $ lines s
+ return $ fst $ getOptions "-" $ map (unwords . words . drop 3) ls
+
-- old GF tolerated newlines in quotes. No more supported!
fixNewlines s = case s of
'"':cs -> '"':mk cs