[antlr-interest] replacing NoViableAltException with exception with less stack

Randall R Schulz rschulz at sonic.net
Mon Sep 10 13:49:50 PDT 2007


On Monday 10 September 2007 13:40, Loring Craymer wrote:
> That may be the only practical solution since the
> stack trace stuff is from java.lang.Throwable.
> Alternatively, you might try adding a dummy
> fillInStackTrace() method to RecognitionException or
> NoViableAltException--that might work.

Overriding fillInStackTrace() is the canonical way to allow instances of 
Throwable subclasses to be initialized cheaply (the real 
fillInStackTrace() is quite expensive).

Naturally, that technique serves other purposes for which a real stack 
trace is not desired or required, as well.


Randall Schulz


More information about the antlr-interest mailing list