[antlr-interest] funny error message

Benjamin Shropshire shro8822 at vandals.uidaho.edu
Tue Feb 12 16:40:56 PST 2008


I was getting a funny "token definitions are unreachable" warning. After 
a few hours of staring at it I (by accident) figured out it was saying 
that one of my lex rules would never match because a previously defined 
rule would match anything it could.

the rules

GText    : ~('\n' | '\r')*    ;
Literal_text    : '\"' ( 'a'..'z') '\"'    ;

The full warning is:

warning(208): D:\__.g:##:##: The following token definitions are 
unreachable: Literal_text

Could someone please improve this error message? The text is almost 
worthless unless you already know what it's saying.

Hopefully Google will index this before the next person has trouble with 
this error because IIRC Google wasn't any help either.


More information about the antlr-interest mailing list