1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 21:01:35 +03:00

Drop anon nodes for eof

This commit is contained in:
Timothy Clem 2017-08-15 14:14:24 -07:00
parent 88291d7215
commit 84bacf6ad1

View File

@ -246,7 +246,9 @@ runAssignment toNode source = \ assignment state -> go assignment state >>= requ
anywhere node = case assignment of
End | Nothing <- node -> yield () state
| otherwise -> Left (makeError node)
| otherwise -> case (dropAnonymous state) of
(State _ _ []) -> yield () state
_ -> Left (makeError node)
Location -> yield (Info.Range stateOffset stateOffset :. Info.Span statePos statePos :. Nil) state
Many rule -> fix (\ recur state -> (go rule state >>= \ (a, state') -> first (a:) <$> if state == state' then pure ([], state') else recur state') `catchError` const (pure ([], state))) state >>= uncurry yield
Alt as -> sconcat (flip yield state <$> as)