[antlr-interest] ANTLR 2.7.5 Bug (affects lexers in C#, Java and C++)

Micheal J open.zone at virgin.net
Wed Apr 13 09:53:40 PDT 2005


> On Apr 5, 2005, at 1:19 PM, Luis Leal wrote:
> 
> > Hi,
> >
> > I've found the following small bug in the 2.7.5 C# runtime 
> for which I 
> > couldn't find a report on the list. (I haven't checked the java or 
> > other runtimes).
> >
> > Lexers generated with defaultErrorHandler=true contain a 
> reference to 
> > a recover method which does not seem to be implemented.  
> Copying the 
> > recover method from Parser.cs to CharScanner.cs resolves 
> the problem.
> 
> Hmm...Michael can correct me, but I thought we fixed that 
> right before 
> 2.7.5 shipped...maybe it was just after.
> 
> Ter

We fixed a related issue in Parsers Ter, not this one. ;-)

ANTLR lexers don't (shouldn't?) have the recover() method so, it could be
classed as a bug in the C# codegen since it shouldn't be generating calls to
recover() for lexers.

I've confirmed that this issue also affects the Java and C++ codegens
(Python doesn't yet generate the recover() method) so, should I:

1. Fix the C#, Java and C++ codegens so they don't generate recover() for
lexers (they will use the old consume()/consumeUntil() methods instead).

OR

2. Add recover() to the CharScanner class for C#, Java and C++ (as Luis did
for C# in his private copy of ANTLR).

The effort involved is about the same in either case.

Micheal
ANTLR/C#



More information about the antlr-interest mailing list