Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bump KDL parser to improve errors #42

Merged
merged 1 commit into from
Jan 9, 2025
Merged

Conversation

bgotink
Copy link
Member

@bgotink bgotink commented Jan 8, 2025

The new version of the parser makes more of the parsing errors recoverable, improves the source locations included in the errors to allow targeting individual characters instead of being token based, and finally it also improves on a few error messages.

Before

screenshot of the KDL playground showing a document with many mistakes, but only three at the top of the document are highlighted by the editor

The error on the foo node is actually due to the invalid binary number which is both non-recoverable and lacks the proper location info.
If I remove a few errors from the document, the parser can continue on to discover issues in the strings which are marked completely invalid:

the same screenshot as above but other errors are shown

After

screenshot of the same KDL document as above, but it shows many more errors throughout the entire document, many of which highlight the specific character or characters that causes the error

@zkat
Copy link
Member

zkat commented Jan 9, 2025

Yo these are so good

@zkat zkat merged commit 1dacb0c into kdl-org:main Jan 9, 2025
@bgotink bgotink deleted the better-errors branch January 9, 2025 11:22
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants