[antlr-interest] Where to hook up for error handling

Heiko Folkerts Heiko.Folkerts at david-bs.de
Tue Sep 22 01:30:53 PDT 2009


Hi all,
I need a litle help in error handling for a parser:
I am using a grammar that uses syntactic predicates and therefore has backtracking enabled. Every "line" in our grammar has to end with a semikolon. After diagnosing the various errornious inputs and the coresponding error message I want to be reported, I know that I want only one error per line. So, how can I tell antlr to restart parsing at the beginning of the next line? I understand that the resync mechanism recovers until it finds one of the tokens in the followsets, but I don't know where I should hook up to do it right. The backtracking produced multiple error messages in the past, since all paths are checked - but what If I recognize an error where It is useless to continue checking the other paths?

Any hints on how to know the underlying concepts and ideas are welcome.

Regards
Heiko


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