Implementation of the JSMN (Jasmine) JSON parser.
For more information on JSMN:
Functions | |
static jsmntok_t * | jsmn_alloc_token (jsmn_parser *parser, jsmntok_t *tokens, size_t num_tokens) |
Allocates a fresh unused token from the token pull. More... | |
static void | jsmn_fill_token (jsmntok_t *token, jsmntype_t type, int start, int end) |
Fills token type and boundaries. More... | |
void | jsmn_init (jsmn_parser *parser) |
Creates a new parser based over a given buffer with an array of tokens available. More... | |
jsmnerr_t | jsmn_parse (jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens) |
Parse JSON string and fill tokens. More... | |
static jsmnerr_t | jsmn_parse_primitive (jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens) |
Fills next available token with JSON primitive. More... | |
static jsmnerr_t | jsmn_parse_string (jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens) |
Filsl next token with JSON string. More... | |
|
static |
Allocates a fresh unused token from the token pull.
References jsmntok_t::end, NULL, jsmntok_t::size, jsmntok_t::start, and jsmn_parser::toknext.
Referenced by jsmn_parse(), jsmn_parse_primitive(), and jsmn_parse_string().
|
static |
Fills token type and boundaries.
References jsmntok_t::end, jsmntok_t::size, jsmntok_t::start, and jsmntok_t::type.
Referenced by jsmn_parse_primitive(), and jsmn_parse_string().
void jsmn_init | ( | jsmn_parser * | parser | ) |
Creates a new parser based over a given buffer with an array of tokens available.
Create JSON parser over an array of tokens.
References jsmn_parser::pos, jsmn_parser::toknext, and jsmn_parser::toksuper.
Referenced by extractClientToken(), isJsonValidAndParse(), and isReceivedJsonValid().
jsmnerr_t jsmn_parse | ( | jsmn_parser * | parser, |
const char * | js, | ||
size_t | len, | ||
jsmntok_t * | tokens, | ||
unsigned int | num_tokens | ||
) |
Parse JSON string and fill tokens.
Run JSON parser.
References c, jsmntok_t::end, jsmn_alloc_token(), JSMN_ARRAY, JSMN_ERROR_INVAL, JSMN_ERROR_NOMEM, JSMN_ERROR_PART, JSMN_OBJECT, jsmn_parse_primitive(), jsmn_parse_string(), NULL, jsmn_parser::pos, jsmntok_t::size, jsmntok_t::start, jsmn_parser::toknext, jsmn_parser::toksuper, and jsmntok_t::type.
Referenced by extractClientToken(), isJsonValidAndParse(), and isReceivedJsonValid().
|
static |
Fills next available token with JSON primitive.
References jsmn_alloc_token(), JSMN_ERROR_INVAL, JSMN_ERROR_NOMEM, JSMN_ERROR_PART, jsmn_fill_token(), JSMN_PRIMITIVE, NULL, jsmn_parser::pos, and jsmn_parser::toksuper.
Referenced by jsmn_parse().
|
static |
Filsl next token with JSON string.
References c, jsmn_alloc_token(), JSMN_ERROR_INVAL, JSMN_ERROR_NOMEM, JSMN_ERROR_PART, jsmn_fill_token(), JSMN_STRING, NULL, jsmn_parser::pos, and jsmn_parser::toksuper.
Referenced by jsmn_parse().