summaryrefslogtreecommitdiff
path: root/src/GF/Command/Importing.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-12-13 18:50:29 +0000
committerkrasimir <krasimir@chalmers.se>2009-12-13 18:50:29 +0000
commitf85232947e74ee7ef8c7b0ad2338212e7e68f1be (patch)
tree667b886a5e3a4b026a63d4e3597f32497d824761 /src/GF/Command/Importing.hs
parentd88a865faff59c98fc91556ff8700b10ee5f2df8 (diff)
reorganize the directories under src, and rescue the JavaScript interpreter from deprecated
Diffstat (limited to 'src/GF/Command/Importing.hs')
-rw-r--r--src/GF/Command/Importing.hs50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/GF/Command/Importing.hs b/src/GF/Command/Importing.hs
deleted file mode 100644
index 06deab6c6..000000000
--- a/src/GF/Command/Importing.hs
+++ /dev/null
@@ -1,50 +0,0 @@
-module GF.Command.Importing (importGrammar, importSource) where
-
-import PGF
-import PGF.Data
-
-import GF.Compile
-import GF.Grammar.Grammar (SourceGrammar) -- for cc command
-import GF.Grammar.CF
-import GF.Infra.UseIO
-import GF.Infra.Option
-import GF.Data.ErrM
-
-import Data.List (nubBy)
-import System.FilePath
-
--- import a grammar in an environment where it extends an existing grammar
-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
- Ok pgf2 -> do return $ unionPGF pgf0 pgf2
- Bad msg -> do putStrLn ('\n':'\n':msg)
- return pgf0
- ".pgf" -> do
- pgf2 <- mapM readPGF files >>= return . foldl1 unionPGF
- return $ unionPGF pgf0 pgf2
- ext -> die $ "Unknown filename extension: " ++ show ext
-
-importSource :: SourceGrammar -> Options -> [FilePath] -> IO SourceGrammar
-importSource src0 opts files = do
- src <- appIOE $ batchCompile opts files
- case src of
- Ok gr -> return gr
- Bad msg -> do
- putStrLn msg
- return src0