12345module juptune.data.json.parser;
Result next(
JsonParser.Token token
);
Parses the next token from the input.
The lifetime of the token's data is directly tied to the input slice's lifetime.
Given the following input
`json { "array": [1, true], "null": null, "subobj": { "false": false, "int": 213, "float": 1.23, "str": "string", "str2": "escaped\n", } } `
The following tokens are generated (using enum JsonParser.Token.Type)
`txt objectStart name ("array") arrayStart integer (1) boolean (true) arrayEnd
name ("null") null
name ("subobj") objectStart name ("false") boolean (false)
name ("int") integer (213)
name ("float") floating (1.23)
name ("str") string ("string", hasEscapeChars: false)
name ("str2") string ("escaped\\n", hasEscapeChars: true) objectEnd objectEnd `
JsonParserError.eofunder various conditions, such as the input being empty, or an object/array being unterminated.
JsonParserError.missingCommaif there's a comma missing between values within an object/array.
JsonParserError.missingColonif there's a colon missing between an object's field's name and its value.
JsonParserError.extraCommaif the final item within an object/array has a comma after it.
JsonParserError.unexpectedCharacterunder various conditions, namely when this function cannot determine what the next token should be.
JsonParserError.invalidNumberif an integer/floating value is invalid (for various reasons).
JsonParserError.unterminatedStringif a string is unterminated.
JsonParserError.tooDeepif the depth buffer is exceeded.
JsonParserError.wrongDepthif there's an objectEndis found when an arrayEndwas expected (or vice-versa).
JsonParserError.invalidKeywordif "true", "false", or "null" was expected but something else was there (e.g. a typo like "nul").
An errorful Resultif something went wrong.