pass the full Tokn type to the add function not just the KS string

This commit is contained in:
krasimir
2008-10-14 13:29:45 +00:00
parent a2e3b1ce73
commit ec2d7e2299

View File

@@ -57,7 +57,7 @@ nextState (State pinfo chart items) t =
then Nothing then Nothing
else Just (State pinfo chart2 items1) else Just (State pinfo chart2 items1)
where where
add tok item set add (KS tok) item set
| tok == t = Set.insert item set | tok == t = Set.insert item set
| otherwise = set | otherwise = set
@@ -75,7 +75,7 @@ getCompletions (State pinfo chart items) w =
} }
in fmap (State pinfo chart2) map' in fmap (State pinfo chart2) map'
where where
add tok item map add (KS tok) item map
| isPrefixOf w tok = Map.insertWith Set.union tok (Set.singleton item) map | isPrefixOf w tok = Map.insertWith Set.union tok (Set.singleton item) map
| otherwise = map | otherwise = map
@@ -114,7 +114,7 @@ process fn !seqs !funs (item@(Active j ppos funid seqid args key0):items) acc ch
Nothing -> process fn seqs funs items3 acc chart{active=insertAC key (Set.singleton item) (active chart)} Nothing -> process fn seqs funs items3 acc chart{active=insertAC key (Set.singleton item) (active chart)}
Just set | Set.member item set -> process fn seqs funs items acc chart Just set | Set.member item set -> process fn seqs funs items acc chart
| otherwise -> process fn seqs funs items2 acc chart{active=insertAC key (Set.insert item set) (active chart)} | otherwise -> process fn seqs funs items2 acc chart{active=insertAC key (Set.insert item set) (active chart)}
FSymTok (KS tok) -> let !acc' = fn tok (Active j (ppos+1) funid seqid args key0) acc FSymTok tok -> let !acc' = fn tok (Active j (ppos+1) funid seqid args key0) acc
in process fn seqs funs items acc' chart in process fn seqs funs items acc' chart
| otherwise = | otherwise =
case lookupPC (mkPK key0 j) (passive chart) of case lookupPC (mkPK key0 j) (passive chart) of