Adding an option to the gf compiler to add an index to pgf files

This is gonna be used by the android library to skip unused part of a
pgf file
This commit is contained in:
gdetrez
2010-12-11 16:36:30 +00:00
parent 65384be75e
commit 0c7676e6e9
4 changed files with 45 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import PGF
import PGF.CId
import PGF.Data
import PGF.Optimize
import GF.Index
import GF.Compile
import GF.Compile.Export
@@ -59,7 +60,8 @@ unionPGFFiles :: Options -> [FilePath] -> IOE ()
unionPGFFiles opts fs =
do pgfs <- mapM readPGFVerbose fs
let pgf0 = foldl1 unionPGF pgfs
pgf = if flag optOptimizePGF opts then optimizePGF pgf0 else pgf0
pgf1 = if flag optOptimizePGF opts then optimizePGF pgf0 else pgf0
pgf = if flag optMkIndexPGF opts then addIndex pgf1 else pgf1
pgfFile = grammarName opts pgf <.> "pgf"
if pgfFile `elem` fs
then putStrLnE $ "Refusing to overwrite " ++ pgfFile