| ... | @@ -867,7 +867,7 @@ pub const TokenStream = struct { | ... | @@ -867,7 +867,7 @@ pub const TokenStream = struct { |
| 867 | parser: StreamingParser, | 867 | parser: StreamingParser, |
| 868 | token: ?Token, | 868 | token: ?Token, |
| 869 | | 869 | |
| 870 | pub const Error = StreamingParser.Error || error.Incomplete; | 870 | pub const Error = StreamingParser.Error || error{UnexpectedEndOfJson}; |
| 871 | | 871 | |
| 872 | pub fn init(slice: []const u8) TokenStream { | 872 | pub fn init(slice: []const u8) TokenStream { |
| 873 | return TokenStream{ | 873 | return TokenStream{ |
| ... | @@ -878,7 +878,7 @@ pub const TokenStream = struct { | ... | @@ -878,7 +878,7 @@ pub const TokenStream = struct { |
| 878 | }; | 878 | }; |
| 879 | } | 879 | } |
| 880 | | 880 | |
| 881 | pub fn next(self: *TokenStream) !?Token { | 881 | pub fn next(self: *TokenStream) Error!?Token { |
| 882 | if (self.token) |token| { | 882 | if (self.token) |token| { |
| 883 | const copy = token; | 883 | const copy = token; |
| 884 | self.token = null; | 884 | self.token = null; |
| ... | @@ -901,7 +901,7 @@ pub const TokenStream = struct { | ... | @@ -901,7 +901,7 @@ pub const TokenStream = struct { |
| 901 | if(self.parser.complete){ | 901 | if(self.parser.complete){ |
| 902 | return null; | 902 | return null; |
| 903 | } else { | 903 | } else { |
| 904 | return error.Incomplete; | 904 | return error.UnexpectedEndOfJson; |
| 905 | } | 905 | } |
| 906 | } | 906 | } |
| 907 | }; | 907 | }; |
| ... | @@ -1456,5 +1456,5 @@ test "write json then parse it" { | ... | @@ -1456,5 +1456,5 @@ test "write json then parse it" { |
| 1456 | test "parsing empty string gives appropriate error" { | 1456 | test "parsing empty string gives appropriate error" { |
| 1457 | var p = Parser.init(debug.global_allocator, false); | 1457 | var p = Parser.init(debug.global_allocator, false); |
| 1458 | defer p.deinit(); | 1458 | defer p.deinit(); |
| 1459 | testing.expectError(error.Incomplete, p.parse("")); | 1459 | testing.expectError(error.UnexpectedEndOfJson, p.parse("")); |
| 1460 | } | 1460 | } |