1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Drop non-Regular symbols.

This commit is contained in:
Rob Rix 2017-05-03 10:50:36 -04:00
parent 4c5a5b56c6
commit acb8e7d693

View File

@ -152,7 +152,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 ((flip notElem (stateTypes state)) . symbolType . rhead . roseValue) (stateNodes state) }
dropAnonymous state = state { stateNodes = dropWhile ((/= Regular) . 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