Avoid Printed Parser Errors in Java Console

22 views
Skip to first unread message

austen...@googlemail.com

unread,
Sep 10, 2014, 3:33:32 AM9/10/14
to antlr-di...@googlegroups.com
Hello,

i use ANTLR to parse a programming language from Java in my app and the results are added to a custom editor (indicated as marks).

My goal is to just show the marks in the editor without a printed output to my available Java console (error and output stream connected to the console).

I've implemented my own BaseErrorListener and removed the default as described in the ANTLR book:

MyErrorListener errList=new MyErrorListener ();
lexer.removeErrorListeners();
lexer.addErrorListener(errList);
parser.removeErrorListeners();   
parser.addErrorListener(errList);

However i still get a printed output of parser errors:
....
extraneous input........
line .... no viable alternative at input.....

....

How can i avoid printed error messages with ANTLR?

Thanks in advance for any help.
Reply all
Reply to author
Forward
0 new messages