'Tree parsers parse nodes they usually have a token object as
payload. Set the exception token and do the default behavior.'

def getErrorMessage(self, e, tokenNames):

    if isinstance(self, TreeParser):
        adaptor = e.input.getTreeAdaptor()
        e.token = adaptor.getToken(e.node)
        if (e.token is not None):
            e.token = CommonToken(type=adaptor.getType(e.node), text=adaptor.getText(e.node))
    return BaseRecognizer.getErrorMessage(self, e, tokenNames)
