Closed rkaminsk closed 1 year ago
Playground link to the trace: https://lexy.foonathan.net/playground/?id=ExfrcWWor&mode=trace
I'm not sure what you want exactly: It tries to parse 5
as an expression, which then fails, so it gets your custom "expected expr" error message. It then cancels that and tries to finish the statement, but is missing a semicolon for that.
It then cancels that and tries to finish the statement, but is missing a semicolon for that.
My point is that the second error message does not really help the user. The actual error would not be fixed, even if a semicolon would be used instead of a 5
. That's why I wrote that the second part is confusing.
Not sure what would be the best way to handle this in practice. Maybe report the first error, then implement some custom form of error recovery and only after successful recovery report further errors. I have not yet looked at error recovery with lexy in detail yet. I only skimmed some examples.
I'm closing this as the library can't really do anything else here.
The following example produces confusing error messages. Is some kind of error recovery happening treating the empty second argument of
+
as an expression? It would be more helpful, if the second part of the error message is just listed as context (or not at all in this case).The output is