36 if ((
unsigned)parser->
toknext >= num_tokens)
38 tok = &tokens[parser->
toknext++];
68 for (; parser->
pos < len; parser->
pos++) {
69 switch (js[parser->
pos]) {
88 if (js[parser->
pos] < 32 || js[parser->
pos] >= 127) {
126 for (; parser->
pos < len; parser->
pos++) {
127 char c = js[parser->
pos];
144 switch (js[parser->
pos]) {
174 jsmntok_t *tokens,
unsigned int num_tokens)
180 for (; parser->
pos < len; parser->
pos++) {
200 for (i = parser->
toknext - 1; i >= 0; i--) {
202 if (token->
start != -1 && token->
end == -1) {
203 if (token->
type != type)
206 token->
end = parser->
pos + 1;
213 for (; i >= 0; i--) {
215 if (token->
start != -1 && token->
end == -1) {
279 for (i = parser->
toknext - 1; i >= 0; i--) {
281 if (tokens[i].
start != -1 && tokens[i].end == -1)
303 return "No enough tokens";
305 return "Invalid character inside JSON string";
307 return "The string is not a full JSON packet, more bytes expected";
311 return "Unknown json error";
static jsmntok_t * jsmn_alloc_token(jsmn_parser *parser, jsmntok_t *tokens, size_t num_tokens)
static jsmnerr_t jsmn_parse_string(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens)
static jsmnerr_t jsmn_parse_primitive(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens)
jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens)
void jsmn_init(jsmn_parser *parser)
static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type, int start, int end)
const char * jsmn_strerror(jsmnerr_t err)