antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

How antlr turns off runtime error logging

Open yaosheng-zhang opened this issue 1 year ago • 2 comments

How to turn off the log output shown in the image? 微信图片_20230719094105

yaosheng-zhang avatar Jul 19 '23 01:07 yaosheng-zhang

This is the output from the default error reporter - it is telling you that your input is syntactically incorrect. You can clear the error handlers on the parser object and it will stop telling you that, but your input will still be incorrect (or your grammar is incorrect).

Most people install their own error handler to gather errors in a way that makes more sense for their application. Look at the source code for the default error handler for clues.

On Wed, Jul 19, 2023 at 9:42 AM Yaosheng Zhang @.***> wrote:

How to turn off the log output shown in the image? [image: 微信图片_20230719094105] https://user-images.githubusercontent.com/107973056/254439026-c25d3f76-6ce2-444e-88cb-1c8ab731fbfb.png

— Reply to this email directly, view it on GitHub https://github.com/antlr/antlr4/issues/4360, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7TMHVRDNYFQB4NDZBE63XQ43ORANCNFSM6AAAAAA2PFKULA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jimidle avatar Jul 19 '23 03:07 jimidle

Use either parser.removeErrorListeners() or lexer.removeErrorListener(ConsoleErrorListener.INSTANCE);

As mentioned here: https://stackoverflow.com/a/35286575/1760984

aldoKelvianto avatar May 12 '24 14:05 aldoKelvianto