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.