1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Merge the atEnd cases.

This commit is contained in:
Rob Rix 2017-08-17 16:58:34 -04:00
parent 960e7f06d6
commit cb75a9bd41

View File

@ -337,7 +337,7 @@ instance (Eq grammar, Eq (ast (AST ast grammar))) => Alternative (Assignment ast
(_, Alt rs) -> rebuild (Alt (pure l <> (continueR <$> rs))) id
_ | Just (sl, cl) <- choices l
, Just (sr, cr) <- choices r
-> rebuild (Choose (sl `union` sr) (IntMap.unionWith (<|>) cl cr) (atEnd l <|> atEnd r)) id
-> rebuild (Choose (sl `union` sr) (IntMap.unionWith (<|>) cl cr) ((<|>) <$> atEnd l <*> atEnd r)) id
| otherwise -> rebuild (Alt [l, r]) id
where distribute :: (l ~ lr, r ~ lr) => AssignmentF ast grammar lr -> Assignment ast grammar a
distribute a = rebuild a (uncurry (<|>) . (continueL &&& continueR))