'Read a text format DNS message and build a dns.message.Message
object.'

def read(self):

    line_method = self._header_line
    section = None
    while 1:
        token = self.tok.get(True, True)
        if token.is_eol_or_eof():
            break
        if token.is_comment():
            u = token.value.upper()
            if (u == 'HEADER'):
                line_method = self._header_line
            elif ((u == 'QUESTION') or (u == 'ZONE')):
                line_method = self._question_line
                section = self.message.question
            elif ((u == 'ANSWER') or (u == 'PREREQ')):
                line_method = self._rr_line
                section = self.message.answer
            elif ((u == 'AUTHORITY') or (u == 'UPDATE')):
                line_method = self._rr_line
                section = self.message.authority
            elif (u == 'ADDITIONAL'):
                line_method = self._rr_line
                section = self.message.additional
            self.tok.get_eol()
            continue
        self.tok.unget(token)
        line_method(section)
