1
1
mirror of https://github.com/github/semantic.git synced 2025-01-04 21:47:07 +03:00

Don’t drop error nodes.

This commit is contained in:
Rob Rix 2017-05-17 15:34:26 -04:00
parent 3b91e39fe3
commit d0f42f11aa

View File

@ -226,7 +226,7 @@ runAssignment = iterFreer run . fmap (\ a state -> Result [] (Just (state, a)))
choiceSymbols choices = ((toEnum :: Int -> grammar) <$> IntMap.keys choices)
dropAnonymous :: Symbol grammar => AssignmentState grammar -> AssignmentState grammar
dropAnonymous state = state { stateNodes = dropWhile ((/= Just Regular) . fmap symbolType . rhead . roseValue) (stateNodes state) }
dropAnonymous state = state { stateNodes = dropWhile ((`notElem` [Just Regular, Nothing]) . fmap symbolType . rhead . roseValue) (stateNodes state) }
-- | Advances the state past the current (head) node (if any), dropping it off stateNodes & its corresponding bytes off of stateSource, and updating stateOffset & statePos to its end. Exhausted 'AssignmentState's (those without any remaining nodes) are returned unchanged.
advanceState :: AssignmentState grammar -> AssignmentState grammar