Reputation: 1
So i am currently doing a pascal compiler in java as a project and i am making the error handling, but i noticed that if there were two or more errors in the file i was parsing it would only show the first error it finds and doesn't show the error message for the other errors, i suppose after the first error the parser stops and because of that it never gets to the rest of the errors, but project requires me to show all the errors and not stop at the first one, how can i fix it?
I have already tried overwriting the DefaultErrorStrategy but it hasn't really done nothing
Upvotes: 0
Views: 46
Reputation: 53502
ANTLR4 tries to recover from certain syntax errors, mostly when the insertion of a missing symbol would lead to correct syntax at this point, or the removal of one would do the job. Other than that there's no way to get ANTLR to continue parsing once it encountered a syntax error, at least not with the error strategies that are part of the official distribution.
Upvotes: 0