-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error messages in certain cases with trailing input
In case the generated parser parsed successfully part of input and left some input unparsed (trailing input), the error message produced was sometimes wrong. The code worked correctly only if there were no match failures in the successfully parsed part (highly unlikely). This commit fixes things by explicitly triggering a match failure with the following expectation at the end of the successfully parsed part of the input: peg$fail({ type: "end", description: "end of input" }); This change also made it possible to simplify the |buildMessage| function, which can now ignore the case of no expectations. Fixes #119.
- Loading branch information
Showing
3 changed files
with
31 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters