[antlr-interest] C target: overriding parser and lexer error handlers
Vlad Roubtsov
vlad at demoninsight.com
Wed Jul 20 17:25:16 PDT 2011
Greetings,
I am new to ANTLR but have extensive experience with JavaCC. With some
difficulty (section '@apifuncs' does not appear to be documented but was
mentioned in this list) I can intercept parser errors with my own
implementation of displayRecognitionError():
@parser::apifuncs
{
RECOGNIZER->displayRecognitionError = <my parser error function>;
}
However, lexer errors continued to cause messages to be printed to stderr.
After some more poking around the source code the following seemed to work:
@lexer::apifuncs
{
LEXER->rec->displayRecognitionError = <my lexer error function>;
}
My question: are these @(lexer|parser)::apifuncs section declarations the
supported way to do this? (@members does not work).
Thank you,
Vlad
More information about the antlr-interest
mailing list