Generator method for *gedcom lines*.

        GEDCOM line grammar is defined in Chapter 1 of GEDCOM standard, it
        consists of the level number, optional reference ID, tag name, and
        optional value separated by spaces. Chaper 1 is pure grammar level,
        it does not assign any semantics to tags or levels. Consequently
        this method does not perform any operations on the lines other than
        returning the lines in their order in file.

        This method iterates over all lines in input file and converts each
        line into :py:class:`gedcom_line` class.

        :param int offset: Position in the file to start reading.
        :returns: Iterator for gedcom_lines.
        :raises: :py:class:`ParserError` when lines have incorrect syntax.

def gedcom_lines(self, offset):
        """Generator method for *gedcom lines*.

        GEDCOM line grammar is defined in Chapter 1 of GEDCOM standard, it
        consists of the level number, optional reference ID, tag name, and
        optional value separated by spaces. Chaper 1 is pure grammar level,
        it does not assign any semantics to tags or levels. Consequently
        this method does not perform any operations on the lines other than
        returning the lines in their order in file.

        This method iterates over all lines in input file and converts each
        line into :py:class:`gedcom_line` class.

        :param int offset: Position in the file to start reading.
        :returns: Iterator for gedcom_lines.
        :raises: :py:class:`ParserError` when lines have incorrect syntax.
        """

        self._file.seek(offset)

        prev_gline = None
        while True:

            offset = self._file.tell()
            line = self._file.readline()  # stops at \n
            if not line:
                break
            line = line.lstrip().rstrip(b"\r\n")

            match = _re_gedcom_line.match(line)
            if not match:
                self._file.seek(offset)
                lineno = guess_lineno(self._file)
                line = line.decode(self._encoding, "ignore")
                raise ParserError("Invalid syntax at line "
                                  "{0}: `{1}'".format(lineno, line))

            level = int(match.group('level'))
            xref_id = match.group('xref')
            if xref_id:
                xref_id = xref_id.decode(self._encoding, self._errors)
            tag = match.group('tag').decode(self._encoding, self._errors)

            # simple structural integrity check
            if prev_gline is not None:
                if level - prev_gline.level > 1:
                    # nested levels should be incremental (+1)
                    self._file.seek(offset)
                    lineno = guess_lineno(self._file)
                    line = line.decode(self._encoding, "ignore")
                    raise IntegrityError("Structural integrity - "
                                         "illegal level nesting at line "
                                         "{0}: `{1}'".format(lineno, line))
                if tag in ("CONT", "CONC"):
                    # CONT/CONC level must be +1 from preceding non-CONT/CONC
                    # record or the same as preceding CONT/CONC record
                    if ((prev_gline.tag in ("CONT", "CONC") and
                         level != prev_gline.level) or
                        (prev_gline.tag not in ("CONT", "CONC") and
                         level - prev_gline.level != 1)):
                        self._file.seek(offset)
                        lineno = guess_lineno(self._file)
                        line = line.decode(self._encoding, "ignore")
                        raise IntegrityError("Structural integrity -  illegal "
                                             "CONC/CONT nesting at line "
                                             "{0}: `{1}'".format(lineno, line))

            gline = gedcom_line(level=level,
                                xref_id=xref_id,
                                tag=tag,
                                value=match.group('value'),
                                offset=offset)
            yield gline

            prev_gline = gline