From 856c31a64b3e4e46645ace364101fb5cf148b41e Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 15 Oct 2008 15:08:38 +0000 Subject: restored the possibility to compile .cf files to gf --- src/GFC.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/GFC.hs') 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 -- cgit v1.2.3