[antlr-interest] AntLR C# target exceptions problem
Johannes Luber
JALuber at gmx.de
Mon Apr 13 07:39:26 PDT 2009
> Johannes Luber wrote:
> >
> > Does putting a breakpoint into the catch block work? Otherwise the menu
> for exceptions offers the options to break when an exception is thrown and
> if an exception is caught. Furthermore, did you add a messagebox call or
> console print to check if the catch block is actually executed (in release
> mode)? Otherwise I can't check things out myself, as my development machine
> has a display problem and is thus unusable right now.
> >
>
> Putting a breakpoint into the catch block doesn't work. If you look at
> the code I posted, there actually is a messagebox call, which is never
> executed (debug or release mode doesn't matter).
>
> I noticed however, that when a NoViableAltException is thrown from my
> generated parser, that the parser itself catches it, calls ReportError
> then Recover and ultimately returns silently from this method (start
> symbol of my grammar). So in fact the exception is swallowed by the
> parser itself. Is this "by design"? I just didn't expect this kind of
> behavior, because it seems to be quite different from the java runtime
> approach. What would be the solution? Should I override the ReportError
> method in my parser and rethrow the exception?
I've never used the error recovery process myself, but I think that you have to overwrite 3 methods. If ReportError() is one of them I don't know but <http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery> has some insights. Don't forget to use .NET capitalisation instead the Java one.
Johannes
>
> Thanks and regards
> Jan
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
More information about the antlr-interest
mailing list