pocketpy/scripts/get_opcodes.py
blueloveTH 0891000a46 init
2022-11-06 12:16:57 +08:00

13 lines
298 B
Python

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