4

I want to catch the ANTLR errors in some way and suppress them showing up in my java logs.

I am beginner in ANTLR and using ANTLR3.4

I went through this and I could not find any methods like these.

lexer.removeErrorListeners();
lexer.addErrorListener(someListener());
parser.removeErrorListeners();
parser.addErrorListener(someListener());

Is there a way that I could to suppress ANTLR console error?

Community
  • 1
  • 1
DejaVu
  • 73
  • 1
  • 9

1 Answers1

2

In ANTLR 3, you need to override BaseRecognizer.emitErrorMessage to control the way errors are printed. The listener mechanism was added in ANTLR 4 (which I highly encourage you to use as it's vastly superior to ANTLR 3).

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280