softdevteam / grmtools

Rust grammar tool libraries and binaries
Other
517 stars 31 forks source link

Bespoke nimbleparse errors #439

Closed ratmice closed 10 months ago

ratmice commented 10 months ago

One thing I considered might be worth attempting (since it doesn't actually involve much in the way of new public API). is just doing bespoke error handling for nimbleparse using some of the code i'd written for the various branches.

nimbleparse is a good choice since it uses the RTParserBuilder which doesn't run into abstraction boundaries, so everything we need for error handling is in one place, and both lex/yacc are used.

So, this patch just does some initial error messages that use sort-of rust inspired messages with source underlining. There is one API change that needed to happen for the missing_from_lexer in order to obtain the spans.

One thing it doesn't try to do, but could be done is try to apply this to the parser that gets built and it's input in the way of errors or error recovery.