Allow F as floating-point suffix

This commit is contained in:
Robin Voetter
2021-03-30 13:08:34 +02:00
parent 938359c6c9
commit 1e7b5edb10
2 changed files with 2 additions and 2 deletions

View File

@@ -89,7 +89,7 @@ fn parseTypes(allocator: *Allocator, out: []registry.Declaration, types_elem: *x
fn parseForeigntype(ty: *xml.Element) !registry.Declaration { fn parseForeigntype(ty: *xml.Element) !registry.Declaration {
const name = ty.getAttribute("name") orelse return error.InvalidRegistry; const name = ty.getAttribute("name") orelse return error.InvalidRegistry;
const depends = ty.getAttribute("requires") orelse if (mem.eql(u8, name, "int")) const depends = ty.getAttribute("requires") orelse if (mem.eql(u8, name, "int"))
"vk_platform" // for some reason, int doesn't depend on vk_platform (but the other c types do) "vk_platform" // for some reason, int doesn't depend on vk_platform (but the other c types do)
else else
return error.InvalidRegistry; return error.InvalidRegistry;

View File

@@ -506,7 +506,7 @@ fn Renderer(comptime WriterType: type) type {
try self.writer.print("@as(f32, {s}.{s})", .{tok.text, decimal.text}); try self.writer.print("@as(f32, {s}.{s})", .{tok.text, decimal.text});
const f = (try tokenizer.next()) orelse return error.InvalidConstantExpr; const f = (try tokenizer.next()) orelse return error.InvalidConstantExpr;
if (f.kind != .id or !mem.eql(u8, f.text, "f")) { if (f.kind != .id or f.text.len != 1 or (f.text[0] != 'f' and f.text[0] != 'F')) {
return error.InvalidApiConstant; return error.InvalidApiConstant;
} }
}, },