scanner23.py 908 B

12345678910111213141516171819202122232425262728
  1. # Copyright (c) 2016-2018, 2021 by Rocky Bernstein
  2. """
  3. Python 2.3 bytecode massaging.
  4. This massages tokenized 2.3 bytecode to make it more amenable for
  5. grammar parsing.
  6. """
  7. import uncompyle6.scanners.scanner24 as scan
  8. # bytecode verification, verify(), uses JUMP_OPs from here
  9. from xdis.opcodes import opcode_23
  10. JUMP_OPS = opcode_23.JUMP_OPS
  11. # We base this off of 2.4 instead of the other way around
  12. # because we cleaned things up this way.
  13. # The history is that 2.7 support is the cleanest,
  14. # then from that we got 2.6 and so on.
  15. class Scanner23(scan.Scanner24):
  16. def __init__(self, show_asm=False):
  17. scan.Scanner24.__init__(self, show_asm)
  18. self.opc = opcode_23
  19. self.opname = opcode_23.opname
  20. # These are the only differences in initialization between
  21. # 2.3-2.6
  22. self.version = (2, 3)
  23. self.genexpr_name = '<generator expression>'
  24. return