def scan_offsets(handle):
    """
    Scan a PGN file opened in text mode for game offsets.

    Yields the starting offsets of all the games, so that they can be seeked
    later. This is just like :func:`~chess.pgn.scan_headers()` but more
    efficient if you do not actually need the header information.

    The PGN standard requires each game to start with an *Event*-tag. So does
    this scanner.
    """
    in_comment = False
    last_pos = handle.tell()
    line = handle.readline()
    while line:
        if not in_comment and line.startswith('[Event "'):
            yield last_pos
        elif not in_comment and '{' in line or in_comment and '}' in line:
            in_comment = line.rfind('{') > line.rfind('}')
        last_pos = handle.tell()
        line = handle.readline()
