[antlr-interest] ANTLR 3: Lexer problem

Oliver Zeigermann oliver.zeigermann at gmail.com
Mon Sep 12 07:29:38 PDT 2005


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

Anyway, any idea why this lexer grammar 

ELEMENT
    : "<t>"
            (ELEMENT
            | (options {greedy=true;} : ~'<')*
            )*
      "</t>"      
    ;

fails to parse this

<t>Huhu</t>

while this works ok:

ELEMENT
    : "<t>"
            (ELEMENT
            | ~'<'
            )*
      "</t>"      
    ;

The second grammar is not suitable for me as I want text (everything,
not starting with '>') to be reported in a bunch, and not as single
characters. And - of course - this is not my real grammar, but a
simplified version of it.

Oliver


More information about the antlr-interest mailing list