1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 21:01:35 +03:00

Only run error handlers when the next set of productions doesn’t contain the current node.

This commit is contained in:
Rob Rix 2017-08-03 13:34:53 -04:00
parent 32252b1caa
commit 3088e42a84

View File

@ -289,6 +289,10 @@ runAssignment toNode source = (\ assignment state -> go assignment state >>= req
(a, state') <- go child state { stateNodes = toList node } >>= requireExhaustive
yield a (advance state' { stateNodes = stateNodes state })
Choose choices _ | Just choice <- IntMap.lookup (fromEnum (nodeSymbol (toNode node))) choices -> yield choice state
Catch during handler -> go during state `catchError` (
if (IntSet.member (fromEnum (nodeSymbol (toNode node)))) (fromMaybe IntSet.empty (stateNextSet state))
then Left
else flip go state . handler) >>= uncurry yield
_ -> anywhere (Just node)
anywhere node = case assignment of