You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/site_scons/site_tools/micropython/qstrdefs.py

18 lines
419 B

import re
import sys
QSTR_BLACKLIST = set(['NULL', 'number_of'])
def process(source, target):
re_qstr = re.compile(r'MP_QSTR_[_a-zA-Z0-9]+')
for line in source:
for match in re_qstr.findall(line):
name = match.replace('MP_QSTR_', '')
if name not in QSTR_BLACKLIST:
target.write('Q(%s)\n' % name)
if __name__ == '__main__':
process(sys.stdin, sys.stdout)