My example grammar file is shown below (end). I am using ANTLRWorks 1.2.3.
When I enter "bab be baj" in the interpreter, I see the parse tree
correctly. However, I see also that there are errors reported in the
console. When I look at the console, I see the output below. What does this
mean? Is this a problem with my grammar?
[06:41:35] error(208): test.g:24:1: The following token definitions can
never be matched because prior tokens match the same input: SECOND
[06:41:35] Interpreting...
[06:41:35] problem matching token at 1:4 NoViableAltException(' '@[1:1:
Tokens : ( CODE | FIRST | SECOND | THIRD );])
[06:41:35] problem matching token at 1:7 NoViableAltException(' '@[1:1:
Tokens : ( CODE | FIRST | SECOND | THIRD );])
//GRAMMAR FILE
grammar test;
//http://www.antlr.org/wiki/display/ANTLR3/Grammar+options
options {
language=Java;
output=AST;
ASTLabelType=CommonTree;
}
//http://www.antlr.org/wiki/display/ANTLR3/Grammars
@header {
package com.test.parser.antlr;
}
@lexer::header {
package com.test.parser.antlr;
}
expr : (CODE)+;
CODE: (FIRST)? SECOND (THIRD)?;
FIRST:
('b');
SECOND:
('a'|'e'|'i'|'o'|'u');
THIRD:
('b'|'j'|'v'|'g'|'s'|'m'|'d');
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address