Walking a contexts parent's inside Recover to build error messages #4916
Unanswered
The-Futurist
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm starting to explore the antlr error strategy stuff for the first time, While digging into this I stumbled upon the idea of looking at the
recognizer.Context.Parentchain to shed light on what parser rule(s) the parser was in, when it gives up.This seem like a sensible idea for example with a malformed
ifconditional expression I see this in my case:So can see it gave up while parsing an expression within an
if. I can envisage generalizing this in such a way I can produce very specific error messages can be generated for a whole variety of cases.Invalid expression encountered within the if statement beginning on line 27for example.My question - is this a bad idea? are there pitfalls?
Beta Was this translation helpful? Give feedback.
All reactions