forked from GitHub/gf-core
fix parsing of literals
This commit is contained in:
@@ -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
|
-> let !acc' = foldl (\acc toks -> fn toks (Active j (ppos+1) funid seqid args key0) acc) acc
|
||||||
(strs:[strs' | Alt strs' _ <- vars])
|
(strs:[strs' | Alt strs' _ <- vars])
|
||||||
in process mbt fn seqs funs items acc' chart
|
in process mbt fn seqs funs items acc' chart
|
||||||
SymLit d r -> let !fid = args !! d
|
SymLit d r -> let fid = args !! d
|
||||||
in case [ts | PConst _ ts <- maybe [] Set.toList (IntMap.lookup fid (forest chart))] of
|
key = AK fid r
|
||||||
(toks:_) -> let !acc' = fn toks (Active j (ppos+1) funid seqid args key0) acc
|
!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
|
in process mbt fn seqs funs items acc' chart
|
||||||
[] -> case litCatMatch fid mbt of
|
[] -> case litCatMatch fid mbt of
|
||||||
Just (toks,lit) -> let fid' = nextId chart
|
Just (toks,lit)
|
||||||
!acc' = fn toks (Active j (ppos+1) funid seqid (updateAt d fid' args) key0) acc
|
-> let fid' = nextId chart
|
||||||
in process mbt fn seqs funs items acc' chart{forest=IntMap.insert fid' (Set.singleton (PConst lit toks)) (forest chart)
|
!acc' = fn toks (Active j (ppos+1) funid seqid (updateAt d fid' args) key0) acc
|
||||||
,nextId=nextId chart+1
|
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)
|
||||||
Nothing -> process mbt fn seqs funs items acc chart
|
,nextId =nextId chart+1
|
||||||
|
}
|
||||||
|
Nothing -> process mbt fn seqs funs items acc chart
|
||||||
| otherwise =
|
| otherwise =
|
||||||
case lookupPC (mkPK key0 j) (passive chart) of
|
case lookupPC (mkPK key0 j) (passive chart) of
|
||||||
Nothing -> let fid = nextId chart
|
Nothing -> let fid = nextId chart
|
||||||
|
|||||||
@@ -4,5 +4,7 @@ abstract Literals = {
|
|||||||
fun IsString : String -> S ;
|
fun IsString : String -> S ;
|
||||||
IsInteger : Int -> S ;
|
IsInteger : Int -> S ;
|
||||||
IsFloat : Float -> S ;
|
IsFloat : Float -> S ;
|
||||||
|
|
||||||
|
IsEq : Int -> S ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,5 +5,6 @@ lincat S = Str ;
|
|||||||
lin IsString x = x.s ++ "is string" ;
|
lin IsString x = x.s ++ "is string" ;
|
||||||
lin IsInteger x = x.s ++ "is integer" ;
|
lin IsInteger x = x.s ++ "is integer" ;
|
||||||
lin IsFloat x = x.s ++ "is float" ;
|
lin IsFloat x = x.s ++ "is float" ;
|
||||||
|
lin IsEq x = x.s ++ "=" ++ x.s ;
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user