[antlr-interest] What does " The following alternatives can never be matched" mean

qinglangee zcqingdao at 163.com
Tue Dec 1 19:35:09 PST 2009


Hi all. 
 
I had a toy grammer,

grammar cub;

prog:   (command)+ ;
command	: (function |var)+;
function : (Letter)+',';
var : (Letter)+;
Letter  :	'A'..'Z';
WS	:	( '\t'|' '|'\r'|'\n'|'\u000C' )+ 	{ $channel = HIDDEN; } ;

I expected it can recognise text like:

Funone,varone
Funtwo,vartwo

Here is a tool run: 
[11:14:04] warning(200): cub.g:4:25: Decision can match input such as
"Letter" using multiple alternatives: 1, 2, 3
As a result, alternative(s) 3,2 were disabled for that input
[11:14:04] error(201): cub.g:4:25: The following alternatives can never be
matched: 2

I didn't know who can never be matched, and why?

Regard,
langee

-- 
View this message in context: http://n2.nabble.com/What-does-The-following-alternatives-can-never-be-matched-mean-tp4097824p4097824.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list