How to throw meaningful error on syntax or parsing error [duplicate]
问题 This question already has answers here : Is there a way to easily adapt the error messages of ANTLR4? (2 answers) Closed 10 days ago . I have a grammar for parsing jcl The jcl looks like below /*comment line //PR1290@ JOB (10),'ISPW COB SN900E' lexer and parser is working perfectly fine. Suppose instead of // if jcl starts from / currently lexer is throwing 1:0 token recognition error at: '/P' Parser will throw no viable alternative input R1290@ JOB I am looking for throwing error similar to