[antlr-interest] Why won't this match...

Terence Parr parrt at cs.usfca.edu
Sun Feb 24 15:19:32 PST 2008


On Feb 24, 2008, at 3:12 PM, Mark Volkmann wrote:

> On Sun, Feb 24, 2008 at 9:40 AM, alan brown <listbrownie at gmail.com>  
> wrote:
>> It must be something obvious but why won't this language parse the  
>> word
>> 'wibble'?  I would expect the lexer to be unable to match the input  
>> to
>> BIG_TOKEN but successfully match to LITTLE_TOKEN followed by  
>> SEMI_TOKEN.  If
>> I change the BIG_TOKEN definition to 'wobble' then all is well but  
>> I don't
>> know why this is failing.
>>
>> Any help is appreciated
>>
>> root                       : tokenizer2 | tokenizer1 ;
>>
>> tokenizer1              : BIG_TOKEN ;
>> tokenizer2             : LITTLE_TOKEN SEMI_TOKEN ;
>>
>> BIG_TOKEN           : 'wibbled' ;
>> LITTLE_TOKEN     : 'wi';
>> SEMI_TOKEN            : 'bble' ;
>
> This is "bang my head on the wall" frustrating!
> It looks so simple, but I can't get it to work either!
> Just when I thought I was getting the hang of it ...
> I hope someone else has an answer.

This is because of:

http://www.antlr.org:8888/browse/ANTLR-189

Ter


More information about the antlr-interest mailing list