summaryrefslogtreecommitdiff
path: root/src/GF/Command/Importing.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/GF/Command/Importing.hs
parentadc6566cd3eb7414a5043b13d58bbd5803391390 (diff)
restored the possibility to compile .cf files to gf
Diffstat (limited to 'src/GF/Command/Importing.hs')
-rw-r--r--src/GF/Command/Importing.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/GF/Command/Importing.hs b/src/GF/Command/Importing.hs
index 390eda5b0..bbf03ddbc 100644
--- a/src/GF/Command/Importing.hs
+++ b/src/GF/Command/Importing.hs
@@ -8,6 +8,7 @@ import GF.Grammar.Grammar (SourceGrammar) -- for cc command
import GF.Infra.UseIO
import GF.Infra.Option
import GF.Data.ErrM
+import GF.Source.CF
import Data.List (nubBy)
import System.FilePath
@@ -17,6 +18,17 @@ importGrammar :: PGF -> Options -> [FilePath] -> IO PGF
importGrammar pgf0 _ [] = return pgf0
importGrammar pgf0 opts files =
case takeExtensions (last files) of
+ ".cf" -> do
+ s <- fmap unlines $ mapM readFile files
+ let cnc = justModuleName (last files)
+ gf <- case getCF cnc s of
+ Ok g -> return g
+ Bad s -> error s ----
+ Ok gr <- appIOE $ compileSourceGrammar opts gf
+ epgf <- appIOE $ link opts (cnc ++ "Abs") gr
+ case epgf of
+ Ok pgf -> return pgf
+ Bad s -> error s ----
s | elem s [".gf",".gfo"] -> do
res <- appIOE $ compileToPGF opts files
case res of