diff options
| author | krasimir <krasimir@chalmers.se> | 2008-10-14 13:29:45 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2008-10-14 13:29:45 +0000 |
| commit | ec2d7e2299cb7d1d9c786d7d8afdbcc8a526e50d (patch) | |
| tree | f49ee28dfa6a8691ed65841fff1234c81fac1b96 | |
| parent | a2e3b1ce73c46997ce4934ad76ed67efa93a649e (diff) | |
pass the full Tokn type to the add function not just the KS string
| -rw-r--r-- | src/PGF/Parsing/FCFG/Incremental.hs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/PGF/Parsing/FCFG/Incremental.hs b/src/PGF/Parsing/FCFG/Incremental.hs index 4f35ed169..6550902a1 100644 --- a/src/PGF/Parsing/FCFG/Incremental.hs +++ b/src/PGF/Parsing/FCFG/Incremental.hs @@ -57,7 +57,7 @@ nextState (State pinfo chart items) t = then Nothing
else Just (State pinfo chart2 items1)
where
- add tok item set
+ add (KS tok) item set
| tok == t = Set.insert item set
| otherwise = set
@@ -75,7 +75,7 @@ getCompletions (State pinfo chart items) w = }
in fmap (State pinfo chart2) map'
where
- add tok item map
+ add (KS tok) item map
| isPrefixOf w tok = Map.insertWith Set.union tok (Set.singleton item) map
| otherwise = map
@@ -103,19 +103,19 @@ process fn !seqs !funs [] acc ch process fn !seqs !funs (item@(Active j ppos funid seqid args key0):items) acc chart
| inRange (bounds lin) ppos =
case unsafeAt lin ppos of
- FSymCat d r -> let !fid = args !! d
- key = AK fid r
+ FSymCat d r -> let !fid = args !! d
+ key = AK fid r
- items2 = case lookupPC (mkPK key k) (passive chart) of
- Nothing -> items
- Just id -> (Active j (ppos+1) funid seqid (updateAt d id args) key0) : items
- items3 = foldForest (\funid args -> (:) (Active k 0 funid (rhs funid r) args key)) items2 fid (forest chart)
- in case lookupAC key (active chart) of
- 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
- | 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
- in process fn seqs funs items acc' chart
+ items2 = case lookupPC (mkPK key k) (passive chart) of
+ Nothing -> items
+ Just id -> (Active j (ppos+1) funid seqid (updateAt d id args) key0) : items
+ items3 = foldForest (\funid args -> (:) (Active k 0 funid (rhs funid r) args key)) items2 fid (forest chart)
+ in case lookupAC key (active chart) of
+ 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
+ | otherwise -> process fn seqs funs items2 acc chart{active=insertAC key (Set.insert item set) (active chart)}
+ FSymTok tok -> let !acc' = fn tok (Active j (ppos+1) funid seqid args key0) acc
+ in process fn seqs funs items acc' chart
| otherwise =
case lookupPC (mkPK key0 j) (passive chart) of
Nothing -> let fid = nextId chart
|
