123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- extern "C" {
- enum json_tokener_error {
- json_tokener_success,
- json_tokener_continue,
- json_tokener_error_depth,
- json_tokener_error_parse_eof,
- json_tokener_error_parse_unexpected,
- json_tokener_error_parse_null,
- json_tokener_error_parse_boolean,
- json_tokener_error_parse_number,
- json_tokener_error_parse_array,
- json_tokener_error_parse_object_key_name,
- json_tokener_error_parse_object_key_sep,
- json_tokener_error_parse_object_value_sep,
- json_tokener_error_parse_string,
- json_tokener_error_parse_comment,
- json_tokener_error_size
- };
- enum json_tokener_state {
- json_tokener_state_eatws,
- json_tokener_state_start,
- json_tokener_state_finish,
- json_tokener_state_null,
- json_tokener_state_comment_start,
- json_tokener_state_comment,
- json_tokener_state_comment_eol,
- json_tokener_state_comment_end,
- json_tokener_state_string,
- json_tokener_state_string_escape,
- json_tokener_state_escape_unicode,
- json_tokener_state_boolean,
- json_tokener_state_number,
- json_tokener_state_array,
- json_tokener_state_array_add,
- json_tokener_state_array_sep,
- json_tokener_state_object_field_start,
- json_tokener_state_object_field,
- json_tokener_state_object_field_end,
- json_tokener_state_object_value,
- json_tokener_state_object_value_add,
- json_tokener_state_object_sep,
- json_tokener_state_array_after_sep,
- json_tokener_state_object_field_start_after_sep,
- json_tokener_state_inf
- };
- struct json_tokener_srec
- {
- enum json_tokener_state state, saved_state;
- struct json_object *obj;
- struct json_object *current;
- char *obj_field_name;
- };
- struct json_tokener
- {
- char *str;
- struct printbuf *pb;
- int max_depth, depth, is_double, st_pos, char_offset;
- enum json_tokener_error err;
- unsigned int ucs_char;
- char quote_char;
- struct json_tokener_srec *stack;
- int flags;
- };
- typedef struct json_tokener json_tokener;
- const char *json_tokener_error_desc(enum json_tokener_error jerr);
- JSON_EXPORT enum json_tokener_error json_tokener_get_error(struct json_tokener *tok);
- JSON_EXPORT struct json_tokener* json_tokener_new(void);
- JSON_EXPORT struct json_tokener* json_tokener_new_ex(int depth);
- JSON_EXPORT void json_tokener_free(struct json_tokener *tok);
- JSON_EXPORT void json_tokener_reset(struct json_tokener *tok);
- JSON_EXPORT struct json_object* json_tokener_parse(const char *str);
- JSON_EXPORT struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokener_error *error);
- JSON_EXPORT void json_tokener_set_flags(struct json_tokener *tok, int flags);
- JSON_EXPORT struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
- const char *str, int len);
- }
|