I\'m using ANTLR4 to parse a syntax file. When I use BaseErrorListener to detect errors, I got a problem. When faced with an illegal input string, ANTLR automatically matches th
Your main rule needs to end with the EOF
token - an ANTLR-provided special token that matches end of input.
If the token's not there, ANTLR will just parse whatever it can match and then stop. By putting the EOF
at the end of your entry rule, you tell ANTLR that whatever it parses must end at the end of input.