I have the following lexer rules in my grammar file:
LINE : 'F' | 'G';
RULE : (('->' ('F' | 'G')) => 'F' | 'G' )
| LINE LINE + | LINE * (ROTATE + LINE+)+ ;
fragment ROTATE : ('/' | '\\');
I'm basically trying to match productions that look like F -> F/F\F\F/F. It successfully matches stuff like the above, but I'm guessing there's a problem with my syntactic predicate, since G -> G produces a MismatchedTokenException. The predicate serves to disambiguate between single letters on the lhs of '->', which I want to be recognized as the LINE token, and those on the rhs, which should be RULEs.
Any idea what I'm doing wrong?