My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
jsmn.c File Reference

https://github.com/zserge/jsmn. More...

#include "jsmn.h"

Go to the source code of this file.

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...
 
static int 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 int jsmn_parse_string (jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens)
 Fills next token with JSON string. More...
 
int 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...
 
void jsmn_init (jsmn_parser *parser)
 Creates a new parser based over a given buffer with an array of tokens available. More...
 

Detailed Description

https://github.com/zserge/jsmn.

Copyright (c) 2010 Serge A. Zaitsev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file jsmn.c.

Function Documentation

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.

Definition at line 28 of file jsmn.c.

static void jsmn_fill_token ( jsmntok_t token,
jsmntype_t  type,
int  start,
int  end 
)
static

Fills token type and boundaries.

Definition at line 46 of file jsmn.c.

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.

Definition at line 331 of file jsmn.c.

int 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.

Definition at line 173 of file jsmn.c.

static int jsmn_parse_primitive ( jsmn_parser parser,
const char *  js,
size_t  len,
jsmntok_t tokens,
size_t  num_tokens 
)
static

Fills next available token with JSON primitive.

Definition at line 57 of file jsmn.c.

static int jsmn_parse_string ( jsmn_parser parser,
const char *  js,
size_t  len,
jsmntok_t tokens,
size_t  num_tokens 
)
static

Fills next token with JSON string.

Definition at line 106 of file jsmn.c.