...
This commit is contained in:
@@ -148,5 +148,22 @@ for cursor in tu.cursor.walk_preorder():
|
||||
field_type = map_type(field.type)
|
||||
print(f" {field_name}: {field_type}")
|
||||
else:
|
||||
raise Exception(f"Unsupported child of struct: {field.spelling}")
|
||||
raise Exception(
|
||||
f"Unsupported child of struct: {field.spelling}: {field.kind}"
|
||||
)
|
||||
print("}")
|
||||
|
||||
elif cursor.kind == CursorKind.ENUM_DECL:
|
||||
name = cursor.spelling
|
||||
print(f"export enum {name} : u32")
|
||||
print("{")
|
||||
for field in cursor.get_children():
|
||||
if field.kind == CursorKind.ENUM_CONSTANT_DECL:
|
||||
field_name = field.spelling
|
||||
field_value = field.enum_value
|
||||
print(f" {field_name} = {field_value}")
|
||||
else:
|
||||
raise Exception(
|
||||
f"Unsupported child of enum: {field.spelling}: {field.kind}"
|
||||
)
|
||||
print("}")
|
||||
|
||||
Reference in New Issue
Block a user