Honor --erasing flag from command-line also when compiling existing .gfo to PGF.

This commit is contained in:
bjorn
2008-10-16 08:27:43 +00:00
parent 5422eb54d9
commit d1633b98d0
2 changed files with 6 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ optimize opts = cse . suf
buildParser :: Options -> PGF -> PGF
buildParser opts =
if flag optBuildParser opts then addParsers else id
if flag optBuildParser opts then addParsers opts else id
batchCompile :: Options -> [FilePath] -> IOE SourceGrammar
batchCompile opts files = do

View File

@@ -50,15 +50,15 @@ mkCanon2gfcc opts cnc gr =
pars = mkParamLincat gr
-- Adds parsers for all concretes
addParsers :: D.PGF -> D.PGF
addParsers pgf = pgf { D.concretes = Map.map conv (D.concretes pgf) }
addParsers :: Options -> D.PGF -> D.PGF
addParsers opts pgf = pgf { D.concretes = Map.map conv (D.concretes pgf) }
where
conv cnc = cnc { D.parser = Just pinfo }
where
pinfo
| Map.lookup (mkCId "erasing") (D.cflags cnc) == Just "on" = PMCFG.convertConcrete (D.abstract pgf) cnc
| otherwise = FCFG.convertConcrete (D.abstract pgf) cnc
| flag optErasing (erasingFromCnc `addOptions` opts) = PMCFG.convertConcrete (D.abstract pgf) cnc
| otherwise = FCFG.convertConcrete (D.abstract pgf) cnc
erasingFromCnc = modifyFlags (\o -> o { optErasing = Map.lookup (mkCId "erasing") (D.cflags cnc) == Just "on"})
-- Generate PGF from GFCM.
-- this assumes a grammar translated by canon2canon