lang-c
lang-c copied to clipboard
More precise parser error
When the parser encounters a type that is unknown, it fails with the following error:
expected: {"<typedef_name>"}
It would be extremely helpful if the parser would at the following point in the parser code:
__state.mark_failure(__pos, "<typedef_name>");
make an effort to print the actual type that it can not parse.
Indeed, error reporting is one of the weak places currently.
Our current parser generator lacks the facility to report exact text that failed to parse. We do return expanded source code and position, so the type name can be recovered from that. We could provide some helper functions to do that.