[antlr-interest] Lookahead problems - Bug in C++ Runtime?

Martin Probst mail at martin-probst.com
Fri Sep 17 07:27:21 PDT 2004


Hi Ric,
the attached file is a patch against your antlr-20040907 snapshot. I
think I've found the problem in TokenBuffer::fill() (see the patch).
The problem was (as far as I understand it) a wrong condition in the
loop that appends tokens to the queue ("<=" vs "<"). This made the C++
TokenBuffer always consume one more token than desired, it was always
one token ahead of the lookahead.
I'm not 100% sure this doesn't break other things but at least in the
corresponding .java file the while loop has the same condition as in my
patched version.
I hope this will work for others too, at least it fixes my problems.

mfg
Martin

Am Fr, den 17.09.2004 schrieb Ric Klaren um 14:50:
> On Fri, Sep 17, 2004 at 01:03:25PM +0200, Martin Probst wrote:
> > I've done some work to track this down and it seems to be a bug in the
> > C++ runtime. I have created a very simple sample grammar and run it
> > through ANTLR one time as language="Cpp" and once as language="Java".
> > The result is that in java mode everything works fine and the parser is
> > LL(1). In C++ mode somehow two tokens are read from the lexer in
> > advance.
> 
> Thanks for the bug report and the example files. I'll have a look at it (no
> guarantee on when though at the moment.. I'm a bit swamped atm)
> 
> Cheers,
> 
> Ric


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: antlr-libcpp-tokenbuffer-la-fix.patch
Type: text/x-patch
Size: 555 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20040917/79ad131a/antlr-libcpp-tokenbuffer-la-fix.bin


More information about the antlr-interest mailing list