get_opcodes.py 298 B

12345678910111213
  1. import os
  2. import re
  3. with open("src/opcodes.h", "rt", encoding='utf-8') as f:
  4. text = f.read()
  5. # opcodes = re.findall(r"OP_(\w+)", text)
  6. # print('\n'.join([f"OPCODE({o})" + o for o in opcodes]))
  7. text = re.sub(r"OP_(\w+)", lambda m: f"OPCODE({m.group(1)})", text)
  8. print(text.replace(',', ''))