diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index a700eb8ba..0aade11af 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -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)