Johan Cockx wrote: > Hi, > > I am using ANTLR 3.1.3. > > The class BaseRecognizer has a method getNumberOfSyntaxErrors() that > is supposed to return the number of syntax errors detected. > > The count is maintained in BaseRecognizer.reportError(...). > > However, the Lexer class overrides this method and does not update > the syntax error count when a lexer error is reported. As a result, > the syntax error count is not reliable in the lexer. Take a look through past posts for advice on this, but basically you should code your lexer so that it cannot give syntax errors really. You should code it so that it intercepts things that go wrong and generates sensible errors.
If you want the simpler behavior, then you should indeed override the display error method. Whether the default one should increment the error count is a good question though. But it is unlikely that the default error message displayRecognitionError (which is what you normally override) would ever be what you want to display anyway of course. Jim List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
