Hi -
I am trying to print the filename, line number, and the actual line that
has an error.  Getting the filename and line number is relatively easy,
however I have not found a good way to get the actual line that caused
the error.  The original implementation of displayRecognitionError(..)
does not print the line. TIA 

Here is what I have:

.g file
----------
@parser::apifuncs
{
    RECOGNIZER->displayRecognitionError = AntlrErrorHandler;
}

.c file
----------
void AntlrErrorHandler (pANTLR3_BASE_RECOGNIZER recognizer,
pANTLR3_UINT8 * tokenNames) 
{
    ANTLR3_FPRINTF(stderr, "File: %s\r\n",
recognizer->state->exception->streamName->chars);
    ANTLR3_FPRINTF(stderr, "Line number: %s\r\n",
recognizer->state->exception->line);

   // how do I get the actual line?

  // ...
}
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to