mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Define expectedSymbols with guard clauses.
This commit is contained in:
parent
346d87b572
commit
8404b320b6
@ -272,9 +272,8 @@ runAssignment toNode source assignment state = go assignment state >>= requireEx
|
||||
(_, ast:_) -> let Node symbol _ (Info.Span spanStart _) = toNode (F.project ast) in Left (Error spanStart (UnexpectedSymbol expectedSymbols symbol))
|
||||
where state | any ((/= Regular) . symbolType) expectedSymbols = dropAnonymous toNode initialState
|
||||
| otherwise = initialState
|
||||
expectedSymbols = case assignment of
|
||||
Choose choices -> choiceSymbols choices
|
||||
_ -> []
|
||||
expectedSymbols | Choose choices <- assignment = choiceSymbols choices
|
||||
| otherwise = []
|
||||
choiceSymbols choices = (toEnum :: Int -> grammar) <$> IntMap.keys choices
|
||||
{-# INLINE run #-}
|
||||
runMany :: forall a. Assignment ast grammar a -> AssignmentState ast grammar -> ([a], AssignmentState ast grammar)
|
||||
|
Loading…
Reference in New Issue
Block a user