mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Handle alternations of choices on both sides.
This commit is contained in:
parent
38a92b7eda
commit
ffe7b2ff66
@ -147,6 +147,7 @@ instance Enum symbol => Alternative (Assignment (Node symbol)) where
|
|||||||
(Symbol s1 `Then` _, Symbol s2 `Then` _) -> Choose (IntMap.fromListWith (flip const) [(fromEnum s1, a), (fromEnum s2, b)]) `Then` identity
|
(Symbol s1 `Then` _, Symbol s2 `Then` _) -> Choose (IntMap.fromListWith (flip const) [(fromEnum s1, a), (fromEnum s2, b)]) `Then` identity
|
||||||
(Symbol s `Then` _, Choose choices `Then` continue) -> Choose (IntMap.insertWith const (fromEnum s) a (fmap continue choices)) `Then` identity
|
(Symbol s `Then` _, Choose choices `Then` continue) -> Choose (IntMap.insertWith const (fromEnum s) a (fmap continue choices)) `Then` identity
|
||||||
(Choose choices `Then` continue, Symbol s `Then` _) -> Choose (IntMap.insertWith (flip const) (fromEnum s) b (fmap continue choices)) `Then` identity
|
(Choose choices `Then` continue, Symbol s `Then` _) -> Choose (IntMap.insertWith (flip const) (fromEnum s) b (fmap continue choices)) `Then` identity
|
||||||
|
(Choose choices1 `Then` continue1, Choose choices2 `Then` continue2) -> Choose (IntMap.union (fmap continue1 choices1) (fmap continue2 choices2)) `Then` identity
|
||||||
_ -> wrap $ Alt a b
|
_ -> wrap $ Alt a b
|
||||||
|
|
||||||
instance Show symbol => Show1 (AssignmentF (Node symbol)) where
|
instance Show symbol => Show1 (AssignmentF (Node symbol)) where
|
||||||
|
Loading…
Reference in New Issue
Block a user