mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-12 04:32:50 -06:00
bugfix in the filterProds function
This commit is contained in:
@@ -100,9 +100,20 @@ ppFunId funid = char 'F' <> int funid
|
|||||||
ppSeqId seqid = char 'S' <> int seqid
|
ppSeqId seqid = char 'S' <> int seqid
|
||||||
|
|
||||||
|
|
||||||
filterProductions prods =
|
filterProductions = closure
|
||||||
fmap (Set.filter filterRule) prods
|
|
||||||
where
|
where
|
||||||
filterRule (FApply funid args) = all (\fcat -> isLiteralFCat fcat || IntMap.member fcat prods) args
|
closure prods0
|
||||||
filterRule (FCoerce _) = True
|
| IntMap.size prods == IntMap.size prods0 = prods
|
||||||
filterRule _ = True
|
| otherwise = closure prods
|
||||||
|
where
|
||||||
|
prods = IntMap.mapMaybe (filterProdSet prods0) prods0
|
||||||
|
|
||||||
|
filterProdSet prods set0
|
||||||
|
| Set.null set = Nothing
|
||||||
|
| otherwise = Just set
|
||||||
|
where
|
||||||
|
set = Set.filter (filterRule prods) set0
|
||||||
|
|
||||||
|
filterRule prods (FApply funid args) = all (\fcat -> isLiteralFCat fcat || IntMap.member fcat prods) args
|
||||||
|
filterRule prods (FCoerce fcat) = isLiteralFCat fcat || IntMap.member fcat prods
|
||||||
|
filterRule prods _ = True
|
||||||
|
|||||||
Reference in New Issue
Block a user