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

lgcraymer lgc at mail1.jpl.nasa.gov
Tue Feb 3 16:48:24 PST 2004


--- In antlr-interest at yahoogroups.com, SainTiss <saintiss at a...> wrote:
> I told it to match one statement indeed, but the problem is that it does *not* 
> seem to ignore everything else... With this input:
> m = (TEST) n;
> there is one statement, but the parser crashes.
> With this input:
> m = (TEST) n;
> tessmklj
> The parser successfully parses the first statement, and does not crash... So 
> that does look quite odd, no?

If you are using the statement rule directly to match this, you expect this behavior--there is a lookahead set for statement which is 
checked and the "tessmklj" satisfies the lookahead.

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

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.

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