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

Igor Inas igor.inas at gmail.com
Thu May 26 02:26:48 PDT 2005


On 4/13/05, Micheal J <open.zone at virgin.net> wrote:
> > 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#

What is the current status of this issue? It's not fixed either in
2.7.5 jar or 2.7.5 source code on the web page. I had to recompile
antlr source codes and add the recover method to CharScanner
yesterday. Quite unpleasant solution for a minor bug.

Igor Inas


More information about the antlr-interest mailing list