[antlr-interest] ANTLR 3: Lexer problem

Terence Parr parrt at cs.usfca.edu
Thu Sep 15 18:35:46 PDT 2005


On Sep 12, 2005, at 7:29 AM, Oliver Zeigermann wrote:

> Again me - I am pretty sure to start bothering ;)

Not yet! ;)

> 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?

Ter
  --
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com



More information about the antlr-interest mailing list