c2compiler icon indicating copy to clipboard operation
c2compiler copied to clipboard

Parser: improve error message handling

Open chqrlie opened this issue 6 months ago • 2 comments

  • use single on_error handler with error level and message arguments
  • remove Warning token type, never returned anyway.
  • improve #error and #warning message parsing consistency
  • make num_error messages non fatal
  • fix #warning behavior

chqrlie avatar Jun 11 '25 12:06 chqrlie

It seems to make parsing slower... What was it that you were trying to improve?

bvdberg avatar Jun 13 '25 11:06 bvdberg

It seems to make parsing slower...

This is surprising, the changes should not affect the inner loops, only the error cases.

What was it that you were trying to improve?

I was just trying to improve the consistency:

  • both warnings and errors should be produced synchronously,
  • #warning used to output an error with on_warning, itself using diag.error instead of diag.warn
  • num_error are errors, not warnings, but non fatal.
  • #error returned an error token without showing the error message.

chqrlie avatar Jun 13 '25 20:06 chqrlie