[antlr-interest] Re: bug in java.g?

lgcraymer lgc at mail1.jpl.nasa.gov
Wed Feb 4 11:39:56 PST 2004


--- In antlr-interest at yahoogroups.com, SainTiss <saintiss at a...> wrote:
> > You really need a "statementComplete" rule such as Monty suggested _without
> > the EOF_, but called by no rule within your grammar (EOF makes sense if you
> > are sure to get an EOF as the next token, but not if you may have
> > extraneous garbage).
> 
> Ah, it *does* seem to work now (forgot to ignore whitespace once more)... 
> Thanks... Interesting enough, adding a statementComplete rule is the key, but 
> it doesn't matter if you call statement() or statementComplete() afterwards 
> so it seems!
> Does that mean that the mere fact of there being a rule which calls statement 
> and is itself never called suffices to not have the lookahead set?

What happens is that the lookahead set for statement() now includes the lookahead set for statementComplete, so the answer is 
"yes".

> >
> > BTW, why are you doing single statement matches?  If you are doing
> > interpretation of phrases, I have a string InputBuffer class which can be
> > refilled.  That will be included with the 2.8 distribution--I need it to
> > support testing--but that won't be until after 2.7.3 is officially
> > released.  I can send you a copy if you would like.
> 
> In fact, what I want to do is parse some user code, which must be a number of 
> statements, and transform the declaration statements into assignment 
> statements. Should work fine with the TokenStreamRewriteEngine by Terence... 
> So I think an InputBuffer which can be refilled is not of much use in this 
> case... Unless I'm missing your point?

No--I was just curious as to why you would be matching single statements.

--Loring


 

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/ 




More information about the antlr-interest mailing list