1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Show a better error for symbol rules at end of input.

This commit is contained in:
Rob Rix 2017-04-26 11:40:59 -04:00
parent 6010bcb439
commit 61b3e3c71f

View File

@ -110,6 +110,7 @@ runAssignment = iterFreer (\ assignment yield state -> case (assignment, dropAno
Just a -> yield a state
Nothing -> Error ["Expected " <> showChoices choices <> " but got " <> show subtree]
_ -> Error ["No rule to match " <> show subtree]
(Symbol s, AssignmentState{}) -> Error [ "Expected " <> show s <> " but got end of input." ]
(Location, AssignmentState{..}) -> yield (Info.Range stateOffset stateOffset :. Info.SourceSpan statePos statePos :. Nil) state
(Source, AssignmentState{}) -> Error [ "Expected leaf node but got end of input." ]
(Children _, AssignmentState{}) -> Error [ "Expected branch node but got end of input." ]