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

Mark Volkmann r.mark.volkmann at gmail.com
Sun Feb 24 15:27:45 PST 2008


On Sun, Feb 24, 2008 at 5:19 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
>
>  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

I didn't see your post until after I sent my last post.
Does that mean it isn't possible to do what Alan wants with the
current lexer implementation or could the grammar be modified to do
what he wants?

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list