[antlr-interest] ANTLR does not properly recognise single characters?

Mark mark at antelope.nildram.co.uk
Sun Dec 30 16:04:35 PST 2007


I'm having some rather strange behaviour from ANTLR when presenting it with
single character tokens.  I have the following declared:

L	:	(('A'..'Z')|('a'..'z')|'_');
N	:	('0'..'9');
IDENTIFIER  :	L ((L|N)*);

But when I run my parser I've seen the following error:
> line 3:10 mismatched input 't' expecting IDENTIFIER

This seems to make no sense, as "t" should match IDENTIFIER.  Changing the
identifier 't' in the source language to 'tu' fixes the problem, so the
problem is specific to matching single character tokens.  Can anyone shed
any light on what's going on here?

Thanks,
Mark


________________________________________________
Message sent using UebiMiau 2.7.2



More information about the antlr-interest mailing list