Closed liluyue closed 6 months ago
I think %expect-unused
(described in https://softdevteam.github.io/grmtools/master/book/errorrecovery.html#turning-lexing-errors-into-parsing-errors) covers this case.
I see it. Just like Rust's error report, adding a doc information or repair method prompt makes it easy to know how to do it
Just to make sure I've understood: %expect-unused
covers your use case?
Yes, but it's a bit cumbersome
To some extent we're limited a bit by compatibility with Yacc. Maybe there's a neater way to do this, but I don't immediately have a good idea.
One other thing worth mentioning is the unused rule error is a warning, which is often being treated as an error by default CTParserBuilder has show_warnings warnings_are_errors
though I don't recall off hand how nimbleparse behaves by default and if it differs.
Can we introduce a deliberate ignore pattern similar to the one that ignores variables starting with _ in Rust? Many times, new rules are introduced, but these rules are not mature enough. In order to avoid affecting existing functions, it is usually necessary to clean up or cut branches during compilation, which can be a bit troublesome