Handle syntax error

def p_error(self, elem):
        '''Handle syntax error'''
        self.errors.append("Syntax error on line " + str(self.lexer.lineno)
                           + ". Got unexpected token " + elem.type)