[antlr-interest] funny error message

Daniels, Troy (US SSA) troy.daniels at baesystems.com
Thu Feb 14 07:27:54 PST 2008


 


  _____  

	From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
	Sent: Wednesday, February 13, 2008 12:45 PM
	To: antlr-interest at antlr.org
	Subject: Re: [antlr-interest] funny error message
	
	

	  

	  

	From: Darien Hager [mailto:darien.hager at etelos-inc.com] 
	Sent: Tuesday, February 12, 2008 6:40 PM
	To: antlr-interest at antlr.org
	Subject: Re: [antlr-interest] funny error message 

	  

	  

	Well, with hindsight it looks like a pretty good error message.
	
	I guess it might hinge on the definition of "unreachable" or
what component is doing the reaching. Two possible quick interpretations
of the message:
	
	This token cannot be reached...
	1) ...because it is an orphan not used by any parser rules. 

	The lexer and parser are not connected. The lexer just has to
tokenize and does not care if the consumer (which may not be a parser)
knows about the token.  

However, I can see "...because it is an orphan not used by any lexer
rules. "  While this lexer grammar is valid, it's likely not what the
user intended.

A: B;

fragment B: 'B';

fragment C: 'C';

C isn't unreachable in sense #2, but it won't ever be used.

Troy

	
	2) ...because other lexer tokens will always match first.  
	
	I think I might assume explanation #1, just from reading the
error message, while it appears to be #2 that is happening.
	

	But, as #1 has no meaning, then there is only #2 to consider J 

	Jim 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080214/5bfab5fe/attachment.html 


More information about the antlr-interest mailing list