summaryrefslogtreecommitdiff
path: root/src/GF/Compile/GrammarToGFCC.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Compile/GrammarToGFCC.hs')
-rw-r--r--src/GF/Compile/GrammarToGFCC.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/GF/Compile/GrammarToGFCC.hs b/src/GF/Compile/GrammarToGFCC.hs
index 14187f04a..c8bb1c606 100644
--- a/src/GF/Compile/GrammarToGFCC.hs
+++ b/src/GF/Compile/GrammarToGFCC.hs
@@ -44,14 +44,15 @@ mkCanon2gfcc opts cnc gr =
pars = mkParamLincat gr
-- Adds parsers for all concretes
-addParsers :: Options -> D.PGF -> D.PGF
-addParsers opts pgf = CM.mapConcretes conv pgf
+addParsers :: Options -> D.PGF -> IO D.PGF
+addParsers opts pgf = do cncs <- sequence [conv lang cnc | (lang,cnc) <- Map.toList (D.concretes pgf)]
+ return pgf { D.concretes = Map.fromList cncs }
where
- conv cnc = cnc { D.parser = Just pinfo }
+ conv lang cnc = do pinfo <- if flag optErasing (erasingFromCnc `addOptions` opts)
+ then PMCFG.convertConcrete opts (D.abstract pgf) lang cnc
+ else return $ FCFG.convertConcrete (D.abstract pgf) cnc
+ return (lang,cnc { D.parser = Just pinfo })
where
- pinfo
- | 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.