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

Ensure productivity for catch rules at end.

This commit is contained in:
Rob Rix 2017-08-18 09:29:14 -04:00
parent 30b6309cd1
commit 81f72193e0

View File

@ -356,7 +356,7 @@ instance (Eq grammar, Eq (ast (AST ast grammar))) => Alternative (Assignment ast
atEnd :: Assignment ast grammar z -> Maybe (Assignment ast grammar z)
atEnd (Tracing _ (Choose _ _ atEnd) `Then` continue) = continue <$> atEnd
atEnd (Tracing _ (Many rule) `Then` continue) = Just (pure <$> rule <|> pure [] >>= continue)
atEnd rule@(Tracing _ (Catch _ _) `Then` _) = Just rule
atEnd (Tracing _ (Catch during handler) `Then` continue) = (>>= continue) <$> atEnd during <|> Just (location >>= \ (_ :. span :. Nil) -> handler (Error span (Right <$> firstSet during) Nothing) >>= continue)
atEnd (Tracing _ (Label inner _) `Then` continue) = (>>= continue) <$> atEnd inner
atEnd _ = Nothing