(self)
Yields:
          Chunks of Lua code.
Yields:
          Chunks of Lua code.
Yields : Chunks of Lua code .
def to_lines(self):
        """
        Yields:
          Chunks of Lua code.
        """
        seen_header_comments = 0
        seen_non_comment_token = False

        for token in self._tokens:
            # Preserve the first two comments seen before the first
            # non-comment/space. (These are used by PICO-8 when generating a
            # label.)
            if (not seen_non_comment_token and
                not token.matches(lexer.TokComment) and
                not token.matches(lexer.TokSpace) and
                    not token.matches(lexer.TokNewline)):
                seen_non_comment_token = True
            if (not seen_non_comment_token and
                seen_header_comments < 2 and
                    token.matches(lexer.TokComment)):
                seen_header_comments += 1
                yield token.code
                yield b'\n'
                continue

            if (token.matches(lexer.TokComment) or
                    token.matches(lexer.TokSpace)):
                continue
            elif token.matches(lexer.TokNewline):
                # Preserve non-consecutive newlines. This is the easiest way to
                # handle PICO-8's newline-dependent language extensions,
                # especially short-ifs.
                self._last_was_name_keyword_number = False
                if not self._last_was_newline:
                    yield b'\n'
                self._last_was_newline = True
            elif token.matches(lexer.TokName):
                if self._last_was_name_keyword_number:
                    yield b' '
                self._last_was_name_keyword_number = True
                self._last_was_newline = False
                yield self._name_factory.get_short_name(token.code)
            elif token.matches(lexer.TokLabel):
                self._last_was_name_keyword_number = False
                self._last_was_newline = False
                yield (
                    b'::' +
                    self._name_factory.get_short_name(token.code[2:-2]) +
                    b'::')
            elif token.matches(lexer.TokKeyword):
                if self._last_was_name_keyword_number:
                    yield b' '
                self._last_was_name_keyword_number = True
                self._last_was_newline = False
                yield token.code
            elif token.matches(lexer.TokNumber):
                if self._last_was_name_keyword_number:
                    yield b' '
                self._last_was_name_keyword_number = True
                self._last_was_newline = False
                yield token.code
            else:
                self._last_was_name_keyword_number = token.code in b'])}'
                self._last_was_newline = False
                yield token.code
def to_lines ( self ) : seen_header_comments = 0 seen_non_comment_token = False for token in self . _tokens : # Preserve the first two comments seen before the first # non-comment/space. (These are used by PICO-8 when generating a # label.) if ( not seen_non_comment_token and not token . matches ( lexer . TokComment ) and not token . matches ( lexer . TokSpace ) and not token . matches ( lexer . TokNewline ) ) : seen_non_comment_token = True if ( not seen_non_comment_token and seen_header_comments < 2 and token . matches ( lexer . TokComment ) ) : seen_header_comments += 1 yield token . code yield b'\n' continue if ( token . matches ( lexer . TokComment ) or token . matches ( lexer . TokSpace ) ) : continue elif token . matches ( lexer . TokNewline ) : # Preserve non-consecutive newlines. This is the easiest way to # handle PICO-8's newline-dependent language extensions, # especially short-ifs. self . _last_was_name_keyword_number = False if not self . _last_was_newline : yield b'\n' self . _last_was_newline = True elif token . matches ( lexer . TokName ) : if self . _last_was_name_keyword_number : yield b' ' self . _last_was_name_keyword_number = True self . _last_was_newline = False yield self . _name_factory . get_short_name ( token . code ) elif token . matches ( lexer . TokLabel ) : self . _last_was_name_keyword_number = False self . _last_was_newline = False yield ( b'::' + self . _name_factory . get_short_name ( token . code [ 2 : - 2 ] ) + b'::' ) elif token . matches ( lexer . TokKeyword ) : if self . _last_was_name_keyword_number : yield b' ' self . _last_was_name_keyword_number = True self . _last_was_newline = False yield token . code elif token . matches ( lexer . TokNumber ) : if self . _last_was_name_keyword_number : yield b' ' self . _last_was_name_keyword_number = True self . _last_was_newline = False yield token . code else : self . _last_was_name_keyword_number = token . code in b'])}' self . _last_was_newline = False yield token . code