Recovering from Errors in Subrules #4829
Unanswered
alerosmile
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.
-
I’m trying to understand what’s going on during error reporting and recovery. For this I’m debugging the sample from the ANTLR book with the following input (also from the book):
As expected an described in the book, the parser resynchronizes and stays within the loop because it identified the following variable z. If I put the ‘y’ line to the top of the class, the parser bails out and identifies none of the variables. I was wondering why and found that if I remove the Exception from the DefaultErrorStrategy (and therefore falling through to the next case), the parser resynchronizes and identifies x and z.
This behavior is described in the paragraph ‘Recovering from Errors in Subrules’ (Subrule start / Looping subrule continuation test) but I do not understand why it is like that. Why does the parser not try to resynchronize the same way at the start of the loop?
Thanks a lot.
Beta Was this translation helpful? Give feedback.
All reactions