24 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
25 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
26 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
28 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
29 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
30 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
31 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0
33 #define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1)
34 #define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2)
35 #define ALPHA(c) (_charclass[(unsigned char)(c)] == 3)
47 #define TOKEN_CB_CALL(type, _ns, _current_too, _final) \
51 ssize_t _sz = (p - chunk_start) + _current_too; \
57 _ret = cb(type, chunk_start, _sz, key); \
59 if(_current_too && _ret == -1) state = ns; \
62 chunk_start = p + _current_too; \
66 #define TOKEN_CB(_type, _ns, _current_too) \
67 TOKEN_CB_CALL(_type, _ns, _current_too, 0)
69 #define PJSON_KEY_FINAL_CHUNK_TYPE PJSON_KEY_END
70 #define PJSON_VALUE_FINAL_CHUNK_TYPE PJSON_VALUE_END
72 #define TOKEN_CB_FINAL(_type, _ns, _current_too) \
73 TOKEN_CB_CALL(_type##_FINAL_CHUNK_TYPE, _ns, _current_too, 1)
79 pjson_parse(
int *stateContext,
const void *jsonbuf,
size_t size,
82 const char *chunk_start = (
const char *)jsonbuf;
83 const char *p = chunk_start;
84 const char *end = p + size;
91 int C = *(
const unsigned char *)p;
99 if(C ==
CQUOTE && !escaped) {
100 in_string = !in_string;
123 include = !(p - chunk_start);
127 include = !(p - chunk_start);
199 include = !(p - chunk_start);
234 include = !(p - chunk_start);
238 include = !(p - chunk_start);
265 if(p - chunk_start) {
276 *stateContext = (int)state;
277 return chunk_start - (
const char *)jsonbuf;