The grammar you posted does not produce the error/warning "mismatched input 'latency'". You probably didn't regenerate the lexer- and parser classes if this is the case.
The only problem with the grammar from you question is the fact that for the input latency eq foobar
, the lexer produces WS
tokens which your parser does not accept.
You probably want to skip these WS
tokens in the lexer:
WS: [
]+ -> skip;
With that change, your parser will produce the following parse tree for the input latency eq foobar
:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…