forked from GitHub/gf-core
simple profiler for PMCFG
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user