[antlr-interest] funny error message

Terence Parr parrt at cs.usfca.edu
Tue Feb 12 18:19:15 PST 2008


Hi.  Do you have a suggestion? perhaps " this token definition can  
never be matched"?

Ter
On Feb 12, 2008, at 4:40 PM, Benjamin Shropshire wrote:

> 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