diff --git a/src/GF/Compile.hs b/src/GF/Compile.hs index 7aeab6b08..b652779d7 100644 --- a/src/GF/Compile.hs +++ b/src/GF/Compile.hs @@ -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 diff --git a/src/GF/Compile/GrammarToGFCC.hs b/src/GF/Compile/GrammarToGFCC.hs index 5b2d14586..51a99e632 100644 --- a/src/GF/Compile/GrammarToGFCC.hs +++ b/src/GF/Compile/GrammarToGFCC.hs @@ -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