[antlr-interest] Error reporting in mismatchset
Heiko Folkerts
Heiko.Folkerts at david-bs.de
Mon Oct 12 00:01:32 PDT 2009
Hi,
I have to following piece of grammar from wich I want to create a helpful errormessage:
Statecheck: OBJECT COMPERATOR statearg SEMI;
Statearg: PARAMREF | STATE;
Now if I give the input
Motor =;
Where Motor is recognized as OBJECT and = recognized as COMPERATOR I get an mismatched set exception. That's right, since a statearg is expected.
Since this is a tree parser I get an unexpected node exception which is meaningless to our users. In the resulting exception neither the expecting nor the expecting set fields are set so I cannot create a helpful errormessage from it. I'd like to change the behaviour so that I can generate more helpful errormessages for this and other similar cases.
I tried to specify a manual exception handler as explained in the ANTLR reference but the code isn't reached because recoverFromMismatchedToken catches and handles the error allready.
So what should I override to make things work and do it the right way?
Thx
Mit freundlichem Gruß
Heiko Folkerts
Systementwicklung und -design
--
______________________________________________
DAVID GmbH · Wendenring 1 · 38114 Braunschweig
Tel.: +49 531 24379-14
Fax.: +49 531 24379-79
E-Mail: mailto:Heiko.Folkerts at david-bs.de
WWW: http://www.david-bs.de
Eintragung: Amtsgericht Braunschweig, HRB 3167
Geschäftsführer: Frank Ptok
______________________________________________
More information about the antlr-interest
mailing list