Consider we try to feed some incorrect input text to some grammar (e.g. text which contains some unknown token). In ANTLRWorks
during interpretation we will see
You need to add the following as the very last rule in your lexer. It will create a token for the invalid character(s) and send it to the parser where the error will be properly reported.
ANYCHAR : . ;
Well, this answer given by 280Z28 to my second part of this question solves both problems well. So, this is the proper answer.