[antlr-interest] Re: upgrade question

nagii5 nagii5 at yahoo.com
Tue Feb 19 12:14:34 PST 2002


pardon my ignorance... 
Would that mean i should increase the lookahead to the maximum 
needed for this grammer

i.e if i had to look for everything but </somelongelement>

then should i set k = "</somelongelement>".length();

thanks
nagesh


--- In antlr-interest at y..., Terence Parr <parrt at j...> wrote:
> 
> On Sunday, February 17, 2002, at 01:38  PM, nagii5 wrote:
> 
> > Thanks, Terrence
> > had another question on similar lines.
> > with 2.7.0 the following grammer would work
> >
> > protected SAMPLE: ( {!(LA(1) == '<' &&  LA(2) == '/' LA(3) == 'f'
> > && LA(4) == 'o' && LA(5) == 'o' && LA(6) == '>' } ? NL_CTR )* ;
> >
> > with 2.7.1,  i changed the above to look like
> >
> > protected SAMPLE: ( options{greedy=false;} : NL_CTR )* ;
> >
> > protected NL_CTR: c:. {if(c=='\n') newline();} ;
> >
> > and the generated code looks exactly as the documentation says
> > k = 3 isnt enough for such a rule.
> >
> > what do you suggest i should do in this case.
> > meaning should i increase my look ahead to the maximum needed
> > i.e. in this case k = 6.
> > or should i rather use some other way to deal with such rules.
> > which say everything but </foo>
> 
> Hmm...i'd increase the max lookahead and see what happens :)  It 
should 
> only use k=6 when it needs to :)
> 
> Ter


 

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



More information about the antlr-interest mailing list