From 228b5259124e9c39eaa99059ca0d09681406e6b9 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 3 Aug 2017 13:17:02 -0400 Subject: [PATCH] Set the next set of productions in alternations. --- src/Data/Syntax/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)