Split zhl multi-field declarations (22 lines: player hearts, BitSet128, BlendMode...) in zhl_match.py and zhl_fields.tsv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e9a88c1d9c
commit
60942dc32c
4 files changed
+88
-28
No files matched your search
@@ -99,4 +99,9 @@ with open(os.path.join(os.path.dirname(out), 'zhl_fields.tsv'), 'w') as o:
|
||||
b = re.search(r':\s*public\s+(\w+)', l)
|
||||
if b: o.write('%s\tbase\t%s\n' % (struct_, b.group(1)))
|
||||
m = re.match(r'^\s*([\w:<>,\s\*&]+?)\s*:\s*(0x[0-9a-fA-F]+)\s*;', l)
|
||||
if m and struct_: o.write('%s\t%s\t%s\n' % (struct_, m.group(2).lower(), ' '.join(m.group(1).split())))
|
||||
if not (m and struct_): continue
|
||||
parts = re.findall(r'([^,:]+?)\s*:\s*(0x[0-9a-fA-F]+)', l.split(';')[0]) # "int _a : 0x0, _b : 0x4;" is two fields
|
||||
ftype = parts[0][0].split()[:-1]
|
||||
for decl, off in parts:
|
||||
words = decl.split()
|
||||
o.write('%s\t%s\t%s\n' % (struct_, off.lower(), ' '.join((words if len(words) > 1 else ftype + words))))
|
||||
Reference in new issue
Block a user