Microchip® Advanced Software Framework

jsmn.c File Reference

Implementation of the JSMN (Jasmine) JSON parser.

For more information on JSMN:

See Also
http://zserge.com/jsmn.html
#include <stdlib.h>
#include "jsmn.h"

Functions

static jsmntok_tjsmn_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 jsmntok_t* jsmn_alloc_token ( jsmn_parser parser,
jsmntok_t tokens,
size_t  num_tokens 
)
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 void jsmn_fill_token ( jsmntok_t token,
jsmntype_t  type,
int  start,
int  end 
)
static

Fills token type and boundaries.

References jsmntok_t::end, 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 
)
static jsmnerr_t jsmn_parse_primitive ( jsmn_parser parser,
const char *  js,
size_t  len,
jsmntok_t tokens,
size_t  num_tokens 
)
static
static jsmnerr_t jsmn_parse_string ( jsmn_parser parser,
const char *  js,
size_t  len,
jsmntok_t tokens,
size_t  num_tokens 
)
static