mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-05 09:12:51 -06:00
-optimize-pgf should also apply to the linrefs
This commit is contained in:
@@ -35,16 +35,20 @@ topDownFilter startCat cnc =
|
|||||||
(env1,defs) = IntMap.mapAccumWithKey (\env fid funids -> mapAccumL (optimizeFun fid [PArg [] fidVar]) env funids)
|
(env1,defs) = IntMap.mapAccumWithKey (\env fid funids -> mapAccumL (optimizeFun fid [PArg [] fidVar]) env funids)
|
||||||
env0
|
env0
|
||||||
(lindefs cnc)
|
(lindefs cnc)
|
||||||
(env2,prods) = IntMap.mapAccumWithKey (\env fid set -> mapAccumLSet (optimizeProd fid) env set)
|
(env2,refs) = IntMap.mapAccumWithKey (\env fid funids -> mapAccumL (optimizeFun fidVar [PArg [] fid]) env funids)
|
||||||
env1
|
env1
|
||||||
|
(linrefs cnc)
|
||||||
|
(env3,prods) = IntMap.mapAccumWithKey (\env fid set -> mapAccumLSet (optimizeProd fid) env set)
|
||||||
|
env2
|
||||||
(productions cnc)
|
(productions cnc)
|
||||||
cats = Map.mapWithKey filterCatLabels (cnccats cnc)
|
cats = Map.mapWithKey filterCatLabels (cnccats cnc)
|
||||||
(seqs,funs) = env2
|
(seqs,funs) = env3
|
||||||
in cnc{ sequences = mkSetArray seqs
|
in cnc{ sequences = mkSetArray seqs
|
||||||
, cncfuns = mkSetArray funs
|
, cncfuns = mkSetArray funs
|
||||||
, productions = prods
|
, productions = prods
|
||||||
, cnccats = cats
|
, cnccats = cats
|
||||||
, lindefs = defs
|
, lindefs = defs
|
||||||
|
, linrefs = refs
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
fid2cat fid =
|
fid2cat fid =
|
||||||
@@ -143,10 +147,12 @@ topDownFilter startCat cnc =
|
|||||||
where
|
where
|
||||||
CncFun fun lin = cncfuns cnc ! funid
|
CncFun fun lin = cncfuns cnc ! funid
|
||||||
|
|
||||||
indicesOf fid =
|
indicesOf fid
|
||||||
case Map.lookup (fid2cat fid) closure of
|
| fid < 0 = listArray (0,0) [0]
|
||||||
Just indices -> indices
|
| otherwise =
|
||||||
Nothing -> error "unknown category"
|
case Map.lookup (fid2cat fid) closure of
|
||||||
|
Just indices -> indices
|
||||||
|
Nothing -> error "unknown category"
|
||||||
|
|
||||||
addUnique seqs seq =
|
addUnique seqs seq =
|
||||||
case Map.lookup seq seqs of
|
case Map.lookup seq seqs of
|
||||||
|
|||||||
Reference in New Issue
Block a user