def parse_fields(self):
        """Determine the start and end columns and names of the fields."""

        rule = self.t['toprule'].rstrip()  # keep leading space for correct columns!!
        if not (rule == self.t['midrule'].rstrip() and rule == self.t['botrule'].rstrip()):
            raise ParseError("Table rules differ from each other (check white space).")
        names = self.t['fields'].split()
        nfields = len(rule.split())
        if nfields != len(names):
            raise ParseError("number of field names (%d) does not match number of fields (%d)"
                             % (nfields, len(names)))
        fields = []     #  list of tuples (first,last) column of the field
        ifield = 0
        is_field = rule.startswith('=')  # state
        len_rule = len(rule)
        start_field = 0
        end_field = 0
        for c in xrange(len_rule):
            char = rule[c]
            if not is_field and char == '=':
                start_field = c
                is_field = True
            if is_field and (char == ' ' or c == len_rule-1):
                # finished field
                fields.append((start_field, c))
                ifield += 1
                is_field = False
        self.names = names
        self.fields = fields
Determine the start and end columns and names of the fields.