From 61b3e3c71f871d827d5960795e35dd7bb8a422ff Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 26 Apr 2017 11:40:59 -0400 Subject: [PATCH] Show a better error for symbol rules at end of input. --- src/Data/Syntax/Assignment.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index 5640eed19..b35f5d85f 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -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." ]