diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index a37be8e91..2b49a782b 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -294,7 +294,7 @@ runAssignment toNode source = (\ assignment state -> go assignment state >>= req Location -> yield (Info.Range (stateOffset state) (stateOffset state) :. Info.Span (statePos state) (statePos state) :. Nil) state Choose _ (Just atEnd) -> yield atEnd state Many rule -> second (\ s -> s { stateNextSet = stateNextSet state }) <$> uncurry yield (runMany rule state { stateNextSet = next >>= firstSet }) - Alt a b -> yield a state `catchError` \ err -> yield b state { stateError = Just err } + Alt a b -> (second (\ s -> s { stateNextSet = stateNextSet state }) <$> yield a state { stateNextSet = next >>= firstSet }) `catchError` \ err -> yield b state { stateError = Just err } Throw e -> Left e Catch during handler -> go during state `catchError` (flip go state . handler) >>= uncurry yield Choose{} -> Left (makeError node)