I have a custom ParsingException(String message, int location, String offendingText)
I want my parser to throw this exception when a parsing / lexing error is encountered.
Is this correct ?
@parser::members
{
@Override
public void notifyErrorListeners(Token offendingToken, String msg, RecognitionException ex)
{
throw new ParsingException(msg,offendingToken.getStartIndex(),offendingToken.getText());
}
}
@lexer::members {
@Override
public void recover(RecognitionException ex)
{
throw new ParsingException(ex.getMessage(),getCharPositionInLine(),ex.getOffendingToken().getText());
}
}
I get an UnhandledException error with this.