[antlr-interest] Breaking out of a parser loop based on the current item

Monty Zukowski monty at codetransform.com
Mon Jul 19 20:17:28 PDT 2004


On Jul 19, 2004, at 5:09 PM, Richard Clark wrote:

> 2) Set up a loop that says:
>
>   ( WORD
>     ( if that word ends a sentence, or the next item is an @tag ) => {
> break }
>     | SPACE*) *
>
> I would prefer option 2, but I haven't been able to figure out how to
> end the loop in retrospect.

That would be nice, but is currently not possible in ANTLR.  I've had 
Ter explain it to me a few times but I can't remember the details right 
now.  It has to do with lookahead computations, I believe.  Anyhow you 
just can't do that.

Monty

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
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