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 diff --git a/testsuite/runtime/parser/Literals.gf b/testsuite/runtime/parser/Literals.gf index a32940e79..0962c0356 100644 --- a/testsuite/runtime/parser/Literals.gf +++ b/testsuite/runtime/parser/Literals.gf @@ -4,5 +4,7 @@ abstract Literals = { fun IsString : String -> S ; IsInteger : Int -> S ; IsFloat : Float -> S ; + + IsEq : Int -> S ; } \ No newline at end of file diff --git a/testsuite/runtime/parser/LiteralsCnc.gf b/testsuite/runtime/parser/LiteralsCnc.gf index d91a222c8..48da0119e 100644 --- a/testsuite/runtime/parser/LiteralsCnc.gf +++ b/testsuite/runtime/parser/LiteralsCnc.gf @@ -5,5 +5,6 @@ lincat S = Str ; lin IsString x = x.s ++ "is string" ; lin IsInteger x = x.s ++ "is integer" ; lin IsFloat x = x.s ++ "is float" ; +lin IsEq x = x.s ++ "=" ++ x.s ; } \ No newline at end of file