mirror of
https://github.com/github/semantic.git
synced 2024-12-19 12:51:52 +03:00
Compute the expected symbols as the first set of the current assignment.
This commit is contained in:
parent
38b9821c1d
commit
c4a30e9fe6
@ -300,8 +300,7 @@ runAssignment toNode source = (\ assignment state -> disamb Left (Right . minimu
|
||||
Source -> None (makeError node)
|
||||
|
||||
state@State{..} = if not (null expectedSymbols) && all ((== Regular) . symbolType) expectedSymbols then dropAnonymous initialState else initialState
|
||||
expectedSymbols | Choose choices _ <- assignment = (toEnum :: Int -> grammar) <$> IntMap.keys choices
|
||||
| otherwise = []
|
||||
expectedSymbols = firstSet (assignment `Then` return)
|
||||
makeError :: HasCallStack => Maybe (Base ast ast) -> Error grammar
|
||||
makeError node = maybe (Error statePos expectedSymbols Nothing) (nodeError expectedSymbols . toNode) node
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user