[antlr-interest] Re: Lexer problem

manfredlotz Manfred.Lotz at web.de
Sat Dec 29 01:09:16 PST 2001


After scanning ".a." the lexer seems to think it has to be ",a,a". 
After finding 'b' it says unexpected char. 

Can a syntactic predicate help. I have to admit that I didn't
understand exactly what it is and what it can do for me. 



Manfred
 

--- In antlr-interest at y..., mzukowski at b... wrote:
> Take a look at the generated code.  Can you see why it doesn't work?
 You
> may need to use a syntactic predicate in front of ".a.a".
> 
> Monty
> 
> > -----Original Message-----
> > From: manfredlotz [mailto:Manfred.Lotz at w...]
> > Sent: Thursday, December 27, 2001 9:41 PM
> > To: antlr-interest at y...
> > Subject: [antlr-interest] Lexer problem
> > 
> > 
> > Using the definiton shown below the lexer has a problem to
recognize
> > tokens if they arrive in a certain order. 
> > 
> > E.g.,  ".a.a.b$" or ".ac$" work fine, however ".a.b$" does not.
> > 
> > Any idea what I have to change to make it working. I know it has
to do
> > with the fact that ".a" is a substring of ".a.a" but I don't know
how
> > to improve the t.g file.
> > 
> > Manfred
> > _____________________
> > 
> > class TLexer extends Lexer;
> > options {
> >         k=4;
> >         filter=IGNORE;
> > }
> > 
> > MYENDTOKEN   : '$' ;
> > 
> > A       :   ( ".a" | ".a.a" | ".b" | 'a' | 'c' )  ;
> > 
> > protected
> > IGNORE  : ( "\r\n" | '\r' | '\n'  ) { _ttype = Token.SKIP; };
> > 
> > 
> >  
> > 
> > Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/


 

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



More information about the antlr-interest mailing list