[antlr-interest] error(208)
Ranco Marcus
ranco.marcus at epirion.nl
Tue Jun 7 01:57:22 PDT 2011
Hello Peter,
You should probably change the name of rule PV to lowercase pv, because it is a parser rule and not a lexer rule.
Best regards,
Ranco
________________________________________
From: antlr-interest-bounces at antlr.org [antlr-interest-bounces at antlr.org] on behalf of P.N. [peter.nabbefeld at gmx.de]
Sent: Tuesday, June 07, 2011 10:32 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] error(208)
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
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list