(self)
Generates lines of Lua source based on the parser output.

        Yields:
          Lines of Lua code.
Generates lines of Lua source based on the parser output.
Generates lines of Lua source based on the parser output .
def to_lines(self):
        """Generates lines of Lua source based on the parser output.

        Yields:
          Lines of Lua code.
        """
        self._pos = 0

        linebuf = []
        last_was_newline = False
        for chunk in self.walk():
            if self._args.get('ignore_tokens'):
                # Clean up extraneous spacing.
                if chunk == b'\n':
                    if last_was_newline:
                        chunk = b''
                    last_was_newline = True
                else:
                    last_was_newline = False
            parts = chunk.split(b'\n')
            while len(parts) > 1:
                linebuf.append(parts.pop(0))
                yield b''.join(linebuf) + b'\n'
                linebuf.clear()
            linebuf.append(parts.pop(0))

        # Write the last line and any trailing spaces, as lines.
        last = b''.join(linebuf) + self._get_code_for_spaces(None)
        parts = last.split(b'\n')
        for i in range(len(parts)-1):
            yield parts[i] + b'\n'
        if parts[-1]:
            yield parts[-1]
def to_lines ( self ) : self . _pos = 0 linebuf = [ ] last_was_newline = False for chunk in self . walk ( ) : if self . _args . get ( 'ignore_tokens' ) : # Clean up extraneous spacing. if chunk == b'\n' : if last_was_newline : chunk = b'' last_was_newline = True else : last_was_newline = False parts = chunk . split ( b'\n' ) while len ( parts ) > 1 : linebuf . append ( parts . pop ( 0 ) ) yield b'' . join ( linebuf ) + b'\n' linebuf . clear ( ) linebuf . append ( parts . pop ( 0 ) ) # Write the last line and any trailing spaces, as lines. last = b'' . join ( linebuf ) + self . _get_code_for_spaces ( None ) parts = last . split ( b'\n' ) for i in range ( len ( parts ) - 1 ) : yield parts [ i ] + b'\n' if parts [ - 1 ] : yield parts [ - 1 ]