[antlr-interest] Re: Local lookahead depth

lgcraymer lgc at mail1.jpl.nasa.gov
Mon Nov 10 00:30:47 PST 2003


--- In antlr-interest at yahoogroups.com, "Oliver Zeigermann" 
<oliver at z...> wrote:

> > STAR_WORD
> > { int count = 0; }
> >     :
> >     ( '*' { count++; } )+ '#'
> >     { if (count == 1000)
> >           $setType(SHORTWORD);
> >       else if (count == 10000)
> >           $setType(LONGWORD);
> >     }
> > }
> >     ;
> 
> It does not work. This grammar would accept 1001 (etc.) stars 
followed
> by a single '#' as well.

Yes, but those would be labeled as "STAR_WORD" instead of your two 
choices--that's enough to ensure that an exception is thrown in the 
parser.

--Loring

> Oliver


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list