[antlr-interest] ANTLR 3: Lexer problem

Oliver Zeigermann oliver.zeigermann at gmail.com
Fri Sep 16 09:28:30 PDT 2005


2005/9/16, Terence Parr <parrt at cs.usfca.edu>:
> > Anyway, any idea why this lexer grammar
> >
> > ELEMENT
> >     : "<t>"
> >             (ELEMENT
> >             | (options {greedy=true;} : ~'<')*
> >             )*
> >       "</t>"
> >     ;
> >
> > fails to parse this
> >
> > <t>Huhu</t>
> 
> I think that you have two optional things there.  The overall (...)*
> and the not less than loop.  Try (...)+ on the ~'<'.
> 
> Does antlr complain?

Oh, well, you are right! Switching to (...)+ fixes this! Thanks!

Oliver


More information about the antlr-interest mailing list