ANTLR assigns one, and only one, token type (name starting with uppercase letter) to each non-overlapping sequence of characters in the input. In your case, the ANY
rule matches a sequence, and the MAPPING
rule defined after it is also defined to match ANY
(as one of its alternatives). When the input is any
, your lexer will always assign the token type ANY
to it since that rule is defined first.
While you have allowed the input any
to be a MAPPING
, ANTLR is warning you that it will never assign the type MAPPING
to this input, so the current definition of MAPPING
is misleading. You should update your lexer rules so each sequence only matches one token type.