Funcpointer parsing

This commit is contained in:
Robin Voetter
2020-06-11 01:54:24 +02:00
parent 649e855d4e
commit ad1abc7602
4 changed files with 191 additions and 35 deletions

View File

@@ -70,6 +70,8 @@ fn parseTypes(allocator: *Allocator, out: []registry.Declaration, types_elem: *x
break :blk try parseContainer(allocator, ty, false);
} else if (mem.eql(u8, category, "union")) {
break :blk try parseContainer(allocator, ty, true);
} else if (mem.eql(u8, category, "funcpointer")) {
break :blk try parseFuncPointer(allocator, ty);
}
continue;
@@ -184,6 +186,11 @@ fn parseContainer(allocator: *Allocator, ty: *xml.Element, is_union: bool) !regi
};
}
fn parseFuncPointer(allocator: *Allocator, ty: *xml.Element) !registry.Declaration {
var xctok = xmlc.XmlCTokenizer.init(ty);
return try xmlc.parseTypedef(allocator, &xctok);
}
fn lenToPointerSize(len: []const u8) registry.Pointer.PointerSize {
if (mem.eql(u8, len, "null-terminated")) {
return .zero_terminated;