std.json: Add support for recursive objects to std.json.parse (#9307)
* Add support for recursive objects to std.json.parse * Remove previously defined error set * Try with function which returns an error set * Don't analyze already inferred types * Add comptime to inferred_type parameter * Make ParseInternalError to accept only a single argument * Add public `ParseError` for `parse` function * Use error.Foo syntax for errors instead of a named error set * Better formatting * Update to latest code changes
This commit is contained in:
@@ -349,7 +349,9 @@ fn caseInEql(a: []const u8, b: []const u8) bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
pub fn parseFloat(comptime T: type, s: []const u8) !T {
|
||||
pub const ParseFloatError = error{InvalidCharacter};
|
||||
|
||||
pub fn parseFloat(comptime T: type, s: []const u8) ParseFloatError!T {
|
||||
if (s.len == 0 or (s.len == 1 and (s[0] == '+' or s[0] == '-'))) {
|
||||
return error.InvalidCharacter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user