1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 07:25:44 +03:00

Set the next set of productions in alternations.

This commit is contained in:
Rob Rix 2017-08-03 13:17:02 -04:00
parent 390a60c5e7
commit 228b525912

View File

@ -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 Location -> yield (Info.Range (stateOffset state) (stateOffset state) :. Info.Span (statePos state) (statePos state) :. Nil) state
Choose _ (Just atEnd) -> yield atEnd state Choose _ (Just atEnd) -> yield atEnd state
Many rule -> second (\ s -> s { stateNextSet = stateNextSet state }) <$> uncurry yield (runMany rule state { stateNextSet = next >>= firstSet }) 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 Throw e -> Left e
Catch during handler -> go during state `catchError` (flip go state . handler) >>= uncurry yield Catch during handler -> go during state `catchError` (flip go state . handler) >>= uncurry yield
Choose{} -> Left (makeError node) Choose{} -> Left (makeError node)