The error handling mechanisms are fairly complicated, but adding your
own handlers is easy.

Just call the base versions after you do what you want:

public override void ReportError( RecognitionException e )
{
  // do something, the StackTrace for e will tell you where the error
occurred
  base.ReportError( e );
}

You can read more details about the ErrorHandling here:
http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery

Sam

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jan Newger
Sent: Monday, April 13, 2009 10:08 AM
To: Johannes Luber
Cc: [email protected]
Subject: Re: [antlr-interest] AntLR C# target exceptions problem

Thanks for your quick response, Johannes. Actually, I don't want to
override the error reporting mechanism, I just want the runtime to throw
the respective exceptions when the input is malformed (just in the same
way the java runtime does it).
Is the behavior I previously described considered a bug or is this "by
design"? It seems odd to me that exceptions are swallowed within the
parser itself. So even if I where to replace the error reporting
mechanism, I would change the error message of an exception which never
reaches my code in the first place. IMHO this is ether a serious bug or
I'm doing something incredibly stupid here.

Cheers
Jan

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to