Please see the source code: https://gist.github.com/1684022 .
I have two signs:
ID : ('a'..'z' | 'A'..'Z') ('0'..'9' | 'a'..'z' | 'A'..'Z' | ' ')*;
PITCH
: (('A'|'a') '#'?)
| (('B'|'b') '#'?)
| (('C'|'c') '#'?);
Obviously, the letter "A" will be ambiguity.
Next, I define:
note : PITCH;
name : ID;
main : name ':' note '\n'?
Now, if I enter “A: A” as input to the parser, I always get an error message. Either the parser expects a PITCH, or an ID depending on whether the identifier or PITCH is determined:
mismatched input 'A' expecting ID
What is the correct way to allow this to work as intended?
, , , ANTLR " ". , main , name/ID, , , "A" PITCH, " " / " ", , "".
/ , ID PITCH, , dasblinkenlight?