On Wed, May 6, 2009 at 4:30 PM, Jim Idle <[email protected]> wrote:

> 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
>

What you say makes sense.  However,  my point is that I have only just
started the development of my grammar and I don't want want to spend time on
error handling yet. It is also the first time I am using ANTLR (I have used
Flex/Bison before) and I was just looking for a simple way to detect whether
or not any parsing errors have occurred.  The current behavior is quite
confusing for a first time user,  so I'd say the default display error
method should increment the error count.

Even the error count method doesn't seem to be well documented,  I only
found it by looking at the source code.

Thank's anyway,   my problem is solved.

Johan

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to