This commit is contained in:
agra
2026-02-18 03:22:06 +02:00
parent 4aff004118
commit ae5e6cd507
3 changed files with 23 additions and 17 deletions

View File

@@ -363,7 +363,16 @@ pub const Parser = struct {
if (self.current.tag == .int_literal) {
const arg_start = self.current.loc.start;
const text = self.tokenSlice(self.current);
const value = std.fmt.parseInt(i64, text, 10) catch 0;
const base: u8 = if (text.len > 2 and text[0] == '0' and (text[1] == 'x' or text[1] == 'X'))
16
else if (text.len > 2 and text[0] == '0' and (text[1] == 'b' or text[1] == 'B'))
2
else
10;
const digits = if (base != 10) text[2..] else text;
const value = std.fmt.parseInt(i64, digits, base) catch {
return self.fail("invalid integer literal in type argument");
};
self.advance();
try args.append(self.allocator, try self.createNode(arg_start, .{ .int_literal = .{ .value = value } }));
} else {