'Factor out what to do upon token mismatch so tree parsers can behave
differently.  Override and call mismatchRecover(input, ttype, follow)
to get single token insertion and deletion. Use this to turn of
single token insertion and deletion. Override mismatchRecover
to call this instead.'

def mismatch(self, input, ttype, follow):

    if self.mismatchIsUnwantedToken(input, ttype):
        raise UnwantedTokenException(ttype, input)
    elif self.mismatchIsMissingToken(input, follow):
        raise MissingTokenException(ttype, input, None)
    raise MismatchedTokenException(ttype, input)
