[antlr-interest] Error reporting with DebugListener attached

Terence Parr parrt at cs.usfca.edu
Thu Feb 26 12:13:14 PST 2009


call the display recognition error method in your parser with the  
exception.
Ter
On Feb 26, 2009, at 8:28 AM, Indhu Bharathi wrote:

> Hi,
>
> I'm attaching a debug listener to my parser and overriding  
> 'recognitionException' method as shown below.
>
> public void recognitionException (RecognitionException e) {
>     System.err.println(e);
> }
>
> But I see that the error message printed is not as good as what is  
> printed in stderr when the debug option is not set. Is there a way  
> to attach debug listener and still get error messages in stderr? By  
> default when debug listener is attached, error messages to stderr  
> are turned off. Or is there a simple way to report error as good as  
> how ANTLR does it in stderr instead of just printing 'e'?
>
> - Indhu
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list