summaryrefslogtreecommitdiff
path: root/src/GFC.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-10-15 15:08:38 +0000
committeraarne <aarne@cs.chalmers.se>2008-10-15 15:08:38 +0000
commit856c31a64b3e4e46645ace364101fb5cf148b41e (patch)
treed5399ef3a363b5ceedc7aa3b2bed304f3d7c07ad /src/GFC.hs
parentadc6566cd3eb7414a5043b13d58bbd5803391390 (diff)
restored the possibility to compile .cf files to gf
Diffstat (limited to 'src/GFC.hs')
-rw-r--r--src/GFC.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/GFC.hs b/src/GFC.hs
index 4e06641f9..62a57ba0c 100644
--- a/src/GFC.hs
+++ b/src/GFC.hs
@@ -8,6 +8,9 @@ import PGF.Raw.Parse
import PGF.Raw.Convert
import GF.Compile
import GF.Compile.Export
+
+import GF.Source.CF ---- should this be on a deeper level? AR 15/10/2008
+
import GF.Infra.UseIO
import GF.Infra.Option
import GF.Data.ErrM
@@ -20,6 +23,7 @@ mainGFC :: Options -> [FilePath] -> IOE ()
mainGFC opts fs =
case () of
_ | null fs -> fail $ "No input files."
+ _ | all (extensionIs ".cf") fs -> compileCFFiles opts fs
_ | all (extensionIs ".gf") fs -> compileSourceFiles opts fs
_ | all (extensionIs ".pgf") fs -> unionPGFFiles opts fs
_ -> fail $ "Don't know what to do with these input files: " ++ show fs
@@ -34,6 +38,17 @@ compileSourceFiles opts fs =
else do pgf <- link opts cnc gr
writeOutputs opts pgf
+compileCFFiles :: Options -> [FilePath] -> IOE ()
+compileCFFiles opts fs =
+ do s <- ioeIO $ fmap unlines $ mapM readFile fs
+ let cnc = justModuleName (last fs)
+ gf <- ioeErr $ getCF cnc s
+ gr <- compileSourceGrammar opts gf
+ if flag optStopAfterPhase opts == Compile
+ then return ()
+ else do pgf <- link opts cnc gr
+ writeOutputs opts pgf
+
unionPGFFiles :: Options -> [FilePath] -> IOE ()
unionPGFFiles opts fs =
do pgfs <- ioeIO $ mapM readPGF fs