(self)
return '\n'.join(output)
Return a marked-up hex dump of the program (for debugging).
Return a marked-up hex dump of the program (for debugging).
Return a marked - up hex dump of the program ( for debugging ) .
def __repr__(self):
        """Return a marked-up hex dump of the program (for debugging)."""
        code = self.bytecode.getvalue()
        offset_val, p = 0, 0
        output = []
        for key in sorted(self.line_numbers.keys())[1:]:
            offset, linum = code[p+1:p+3], code[p+3:p+5]
            last_offset = offset_val
            offset_val = struct.unpack('<H', offset)[0] - (self.code_start + 1)
            linum_val, = struct.unpack('<H', linum)
            output.append('%s %s (+%03d) %s [%05d] %s' % (
                binascii.hexlify(code[p:p+1]),
                binascii.hexlify(offset),
                offset_val - last_offset,
                binascii.hexlify(code[p+3:p+5]),
                linum_val,
                binascii.hexlify(code[p+5:])
            ))
            p = self.line_numbers[key]
        output.append('%s %s (ENDS) %s %s' % (
            binascii.hexlify(code[p:p+1]),
            binascii.hexlify(code[p+1:p+3]),
            binascii.hexlify(code[p+3:p+5]),
            binascii.hexlify(code[p+5:])
        ))
        return '\n'.join(output)
def __repr__ ( self ) : code = self . bytecode . getvalue ( ) offset_val , p = 0 , 0 output = [ ] for key in sorted ( self . line_numbers . keys ( ) ) [ 1 : ] : offset , linum = code [ p + 1 : p + 3 ] , code [ p + 3 : p + 5 ] last_offset = offset_val offset_val = struct . unpack ( '<H' , offset ) [ 0 ] - ( self . code_start + 1 ) linum_val , = struct . unpack ( '<H' , linum ) output . append ( '%s %s (+%03d) %s [%05d] %s' % ( binascii . hexlify ( code [ p : p + 1 ] ) , binascii . hexlify ( offset ) , offset_val - last_offset , binascii . hexlify ( code [ p + 3 : p + 5 ] ) , linum_val , binascii . hexlify ( code [ p + 5 : ] ) ) ) p = self . line_numbers [ key ] output . append ( '%s %s (ENDS) %s %s' % ( binascii . hexlify ( code [ p : p + 1 ] ) , binascii . hexlify ( code [ p + 1 : p + 3 ] ) , binascii . hexlify ( code [ p + 3 : p + 5 ] ) , binascii . hexlify ( code [ p + 5 : ] ) ) ) return '\n' . join ( output )