'Recover from an error found on the input stream.  This is
for NoViableAlt and mismatched symbol exceptions.  If you enable
single token insertion and deletion, this will usually not
handle mismatched symbol exceptions but there could be a mismatched
token that the match() routine could not recover from.'

def recover(self, input, re):

    if (self._state.lastErrorIndex == input.index()):
        input.consume()
    self._state.lastErrorIndex = input.index()
    followSet = self.computeErrorRecoverySet()
    self.beginResync()
    self.consumeUntil(input, followSet)
    self.endResync()
