diff options
| author | aarne <aarne@chalmers.se> | 2011-08-28 10:35:55 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2011-08-28 10:35:55 +0000 |
| commit | 769121788a01bc4a21cd69299a788876244e3d31 (patch) | |
| tree | fec0185e93e6d2350bdf22ab02ec752627603e18 /src/compiler/GF/Command/Importing.hs | |
| parent | 5339aa80744c3afd221256d763cf784386eed573 (diff) | |
import command now gives priority to new abstract syntax, and discards the old concretes if they are for the old abstract; the new priority is implemented in PGF.Data.unionPGF
Diffstat (limited to 'src/compiler/GF/Command/Importing.hs')
| -rw-r--r-- | src/compiler/GF/Command/Importing.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/GF/Command/Importing.hs b/src/compiler/GF/Command/Importing.hs index 3d05868b1..cbbb7a30e 100644 --- a/src/compiler/GF/Command/Importing.hs +++ b/src/compiler/GF/Command/Importing.hs @@ -30,14 +30,19 @@ importGrammar pgf0 opts files = s | elem s [".gf",".gfo"] -> do res <- appIOE $ compileToPGF opts files case res of - Ok pgf2 -> do return $ unionPGF pgf0 pgf2 + Ok pgf2 -> ioUnionPGF pgf0 pgf2 Bad msg -> do putStrLn ('\n':'\n':msg) return pgf0 ".pgf" -> do pgf2 <- mapM readPGF files >>= return . foldl1 unionPGF - return $ unionPGF pgf0 pgf2 + ioUnionPGF pgf0 pgf2 ext -> die $ "Unknown filename extension: " ++ show ext +ioUnionPGF :: PGF -> PGF -> IO PGF +ioUnionPGF one two = case msgUnionPGF one two of + (pgf, Just msg) -> putStrLn msg >> return pgf + (pgf,_) -> return pgf + importSource :: SourceGrammar -> Options -> [FilePath] -> IO SourceGrammar importSource src0 opts files = do src <- appIOE $ batchCompile opts files |
