removed .string and .allocated_string from inner_parse when parsing numbers

Now returns an error UnexpectedToken
This commit is contained in:
D-Berg 2024-11-11 11:51:47 +01:00
parent a7792b4563
commit 8cfb9239e7

View File

@ -230,7 +230,7 @@ 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,
else => return error.UnexpectedToken,
};
return try std.fmt.parseFloat(T, slice);
@ -240,7 +240,6 @@ pub fn innerParse(
defer freeAllocated(allocator, token);
const slice = switch (token) {
inline .number, .allocated_number => |slice| slice,
.string, .allocated_string => return error.UnexpectedToken,
else => return error.UnexpectedToken,
};
return sliceToInt(T, slice);