From 5f0a68c1a4206bbd3cf07ae2b93844dedcc79c74 Mon Sep 17 00:00:00 2001 From: krasimir Date: Thu, 18 Jun 2009 17:31:49 +0000 Subject: bugfix: the optimizer should not filter out rules that refer to lexical categories --- src/PGF/PMCFG.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/PGF') diff --git a/src/PGF/PMCFG.hs b/src/PGF/PMCFG.hs index 6a83baad3..c077367ad 100644 --- a/src/PGF/PMCFG.hs +++ b/src/PGF/PMCFG.hs @@ -50,6 +50,8 @@ fcatInt = (-2) fcatFloat = (-3) fcatVar = (-4) +isLiteralFCat :: FCat -> Bool +isLiteralFCat = (`elem` [fcatString, fcatInt, fcatFloat, fcatVar]) ppPMCFG :: ParserInfo -> Doc ppPMCFG pinfo = @@ -101,6 +103,6 @@ ppSeqId seqid = char 'S' <> int seqid filterProductions prods = fmap (Set.filter filterRule) prods where - filterRule (FApply funid args) = all (\fcat -> IntMap.member fcat prods) args + filterRule (FApply funid args) = all (\fcat -> isLiteralFCat fcat || IntMap.member fcat prods) args filterRule (FCoerce _) = True filterRule _ = True -- cgit v1.2.3