...
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user