diff options
| author | krasimir <krasimir@chalmers.se> | 2010-04-23 20:46:14 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-04-23 20:46:14 +0000 |
| commit | 9253ee6010aee34b9349d21e17c76bf7123331ef (patch) | |
| tree | bc3933feacda87a6ce94d7999e8416865e687140 /src/runtime | |
| parent | cc4d5d1d394dc561eca4f794e06d4912244c9906 (diff) | |
fix parsing of literals
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/haskell/PGF/Parse.hs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/runtime/haskell/PGF/Parse.hs b/src/runtime/haskell/PGF/Parse.hs index 1efedd7c2..ab5c91f02 100644 --- a/src/runtime/haskell/PGF/Parse.hs +++ b/src/runtime/haskell/PGF/Parse.hs @@ -212,17 +212,24 @@ process mbt fn !seqs !funs (item@(Active j ppos funid seqid args key0):items) ac -> let !acc' = foldl (\acc toks -> fn toks (Active j (ppos+1) funid seqid args key0) acc) acc
(strs:[strs' | Alt strs' _ <- vars])
in process mbt fn seqs funs items acc' chart
- SymLit d r -> let !fid = args !! d
- in case [ts | PConst _ ts <- maybe [] Set.toList (IntMap.lookup fid (forest chart))] of
- (toks:_) -> let !acc' = fn toks (Active j (ppos+1) funid seqid args key0) acc
+ SymLit d r -> let fid = args !! d
+ key = AK fid r
+ !fid' = case lookupPC (mkPK key k) (passive chart) of
+ Nothing -> fid
+ Just fid -> fid
+
+ in case [ts | PConst _ ts <- maybe [] Set.toList (IntMap.lookup fid' (forest chart))] of
+ (toks:_) -> let !acc' = fn toks (Active j (ppos+1) funid seqid (updateAt d fid' args) key0) acc
in process mbt fn seqs funs items acc' chart
[] -> case litCatMatch fid mbt of
- Just (toks,lit) -> let fid' = nextId chart
- !acc' = fn toks (Active j (ppos+1) funid seqid (updateAt d fid' args) key0) acc
- in process mbt fn seqs funs items acc' chart{forest=IntMap.insert fid' (Set.singleton (PConst lit toks)) (forest chart)
- ,nextId=nextId chart+1
- }
- Nothing -> process mbt fn seqs funs items acc chart
+ Just (toks,lit)
+ -> let fid' = nextId chart
+ !acc' = fn toks (Active j (ppos+1) funid seqid (updateAt d fid' args) key0) acc
+ in process mbt fn seqs funs items acc' chart{passive=insertPC (mkPK key k) fid' (passive chart)
+ ,forest =IntMap.insert fid' (Set.singleton (PConst lit toks)) (forest chart)
+ ,nextId =nextId chart+1
+ }
+ Nothing -> process mbt fn seqs funs items acc chart
| otherwise =
case lookupPC (mkPK key0 j) (passive chart) of
Nothing -> let fid = nextId chart
|
