mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Fixed bug in SRG top-down filtering where the start category would be removed if it wasn't referenced by itself.
This commit is contained in:
@@ -140,7 +140,11 @@ topDownFilter srg@(SRG { startCat = start, rules = rs }) = srg { rules = rs' }
|
|||||||
rhsCats = [ (c,c') | r@(SRGRule c _ ps) <- rs,
|
rhsCats = [ (c,c') | r@(SRGRule c _ ps) <- rs,
|
||||||
SRGAlt _ _ ss <- ps,
|
SRGAlt _ _ ss <- ps,
|
||||||
c' <- filterCats ss]
|
c' <- filterCats ss]
|
||||||
keep = allRelated (transitiveClosure $ mkRel rhsCats) start
|
uses = reflexiveClosure_ (allSRGCats srg) $ transitiveClosure $ mkRel rhsCats
|
||||||
|
keep = allRelated uses start
|
||||||
|
|
||||||
|
allSRGCats :: SRG -> [String]
|
||||||
|
allSRGCats SRG { rules = rs } = [c | SRGRule c _ _ <- rs]
|
||||||
|
|
||||||
--
|
--
|
||||||
-- * Utilities for building and printing SRGs
|
-- * Utilities for building and printing SRGs
|
||||||
|
|||||||
Reference in New Issue
Block a user