Go to the documentation of this file.
28 #if !HAVE_STRNCASECMP && defined(_MSC_VER)
30 # define strncasecmp _strnicmp
31 #elif !HAVE_STRNCASECMP
44 "unexpected end of data",
45 "unexpected character",
49 "array value separator ',' expected",
50 "quoted object property name expected",
51 "object property name separator ':' expected",
52 "object value separator ',' expected",
53 "invalid string sequence",
86 for(i = tok->
depth; i >= 0; i--)
111 size_t len = strlen(str);
112 size_t nn =
min(len,n);
113 char* s = (
char*)malloc(
sizeof(
char) * (nn + 1));
128 #define state tok->stack[tok->depth].state
129 #define saved_state tok->stack[tok->depth].saved_state
130 #define current tok->stack[tok->depth].current
131 #define obj_field_name tok->stack[tok->depth].obj_field_name
134 const char *str,
int len)
159 }
else if(c ==
'/') {
227 if(tok->
depth == 0)
goto out;
253 }
else if(c ==
'/') {
291 }
else if(c ==
'\\') {
332 unsigned char utf_out[3];
337 utf_out[0] = 0xc0 | (tok->
ucs_char >> 6);
338 utf_out[1] = 0x80 | (tok->
ucs_char & 0x3f);
341 utf_out[0] = 0xe0 | (tok->
ucs_char >> 12);
342 utf_out[1] = 0x80 | ((tok->
ucs_char >> 6) & 0x3f);
343 utf_out[2] = 0x80 | (tok->
ucs_char & 0x3f);
382 if(c ==
'.' || c ==
'e') tok->
is_double = 1;
388 }
else if(tok->
is_double && sscanf(tok->
pb->
buf,
"%lf", &numd) == 1) {
426 }
else if(c ==
',') {
439 }
else if (c ==
'"' || c ==
'\'') {
454 }
else if(c ==
'\\') {
494 }
else if(c ==
',') {
514 mc_debug(
"json_tokener_parse_ex: error %s at offset %d\n",
static const char * json_false_str
@ json_tokener_state_comment_start
struct json_object * json_object_new_array()
@ json_tokener_state_eatws
@ json_tokener_state_object_field
@ json_tokener_state_string_escape
struct json_object * json_object_new_int(int i)
struct json_object * json_object_get(struct json_object *this)
static const char * json_null_str
void json_object_object_add(struct json_object *this, const char *key, struct json_object *val)
const char * json_hex_chars
void json_tokener_free(struct json_tokener *tok)
@ json_tokener_error_parse_object_key_sep
@ json_tokener_state_array_add
struct json_object * json_object_new_object()
@ json_tokener_state_comment
const char * json_number_chars
@ json_tokener_error_parse_array
void json_tokener_reset(struct json_tokener *tok)
void mc_debug(const char *msg,...)
@ json_tokener_state_object_value
char * json_c_strndup(const char *str, size_t n)
int printbuf_memappend(struct printbuf *p, const char *buf, int size)
#define JSON_TOKENER_MAX_DEPTH
@ json_tokener_state_comment_end
@ json_tokener_state_object_sep
@ json_tokener_error_parse_unexpected
@ json_tokener_error_parse_number
@ json_tokener_state_object_field_end
void printbuf_reset(struct printbuf *p)
@ json_tokener_error_parse_string
void printbuf_free(struct printbuf *p)
@ json_tokener_state_string
enum json_tokener_state state saved_state
void json_object_put(struct json_object *this)
@ json_tokener_state_escape_unicode
struct printbuf * printbuf_new()
@ json_tokener_state_object_field_start
struct json_object * json_object_new_boolean(boolean b)
@ json_tokener_error_parse_object_key_name
struct json_object * json_object_new_double(double d)
@ json_tokener_state_boolean
@ json_tokener_state_finish
@ json_tokener_state_array
static const char * json_true_str
const char * json_tokener_errors[]
enum json_tokener_error err
@ json_tokener_state_number
@ json_tokener_error_parse_eof
@ json_tokener_state_start
struct json_object * json_object_new_string(const char *s)
@ json_tokener_error_parse_null
@ json_tokener_state_array_sep
struct json_object * json_tokener_parse(const char *str)
@ json_tokener_error_depth
@ json_tokener_state_comment_eol
struct json_object * current
@ json_tokener_error_parse_comment
struct json_tokener_srec stack[JSON_TOKENER_MAX_DEPTH]
@ json_tokener_state_object_value_add
struct json_object * json_tokener_parse_ex(struct json_tokener *tok, const char *str, int len)
int json_object_array_add(struct json_object *this, struct json_object *val)
struct json_tokener * json_tokener_new()
@ json_tokener_error_parse_boolean
@ json_tokener_state_null
static void json_tokener_reset_level(struct json_tokener *tok, int depth)
@ json_tokener_error_parse_object_value_sep
csm
Author(s): Andrea Censi
autogenerated on Wed Aug 17 2022 02:50:33