mirror of
https://github.com/ziglang/zig.git
synced 2024-11-24 13:20:14 +00:00
return UnexpectedToken when trying to parse a string as a int
This commit is contained in:
parent
560d6b99d5
commit
a7792b4563
@ -239,7 +239,8 @@ pub fn innerParse(
|
||||
const token = try source.nextAllocMax(allocator, .alloc_if_needed, options.max_value_len.?);
|
||||
defer freeAllocated(allocator, token);
|
||||
const slice = switch (token) {
|
||||
inline .number, .allocated_number, .string, .allocated_string => |slice| slice,
|
||||
inline .number, .allocated_number => |slice| slice,
|
||||
.string, .allocated_string => return error.UnexpectedToken,
|
||||
else => return error.UnexpectedToken,
|
||||
};
|
||||
return sliceToInt(T, slice);
|
||||
|
Loading…
Reference in New Issue
Block a user