[antlr-interest] error(208)

P.N. peter.nabbefeld at gmx.de
Tue Jun 7 01:32:10 PDT 2011


Hello!

Using the following rules for grammar (ESC_SEQ defined as fragment):

root	:	 object;
object	:	'{' props '}';
props	:	prop (',' prop)*;
prop	:	ID ('=' PV | '+' | '-');
PV 	:	STRING | object | INT;
ID	:	('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;
INT	:	'0' | ('1'..'9') ('0'..'9')*;
WS	:	(' '|'\t'|'\r'|'\n') {$channel=HIDDEN;};
STRING	:	'"' (ESC_SEQ | ~('\\'|'"'))* '"';

When I try to generate the Java code, the following error message is shown:
"error(208):  The following token definitions can never be matched 
because prior tokens match the same input: INT,STRING"

Why do I get this message, as every lexical rule has its own starting 
character?

Kind regards

Peter



More information about the antlr-interest mailing list