| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef __YAJL_PARSER_H__ |
| 18 |
#define __YAJL_PARSER_H__ |
| 19 |
|
| 20 |
#include "api/yajl_parse.h" |
| 21 |
#include "yajl_bytestack.h" |
| 22 |
#include "yajl_buf.h" |
| 23 |
#include "yajl_lex.h" |
| 24 |
|
| 25 |
|
| 26 |
typedef enum { |
| 27 |
yajl_state_start = 0, |
| 28 |
yajl_state_parse_complete, |
| 29 |
yajl_state_parse_error, |
| 30 |
yajl_state_lexical_error, |
| 31 |
yajl_state_map_start, |
| 32 |
yajl_state_map_sep, |
| 33 |
yajl_state_map_need_val, |
| 34 |
yajl_state_map_got_val, |
| 35 |
yajl_state_map_need_key, |
| 36 |
yajl_state_array_start, |
| 37 |
yajl_state_array_got_val, |
| 38 |
yajl_state_array_need_val, |
| 39 |
yajl_state_got_value, |
| 40 |
} yajl_state; |
| 41 |
|
| 42 |
struct yajl_handle_t { |
| 43 |
const yajl_callbacks * callbacks; |
| 44 |
void * ctx; |
| 45 |
yajl_lexer lexer; |
| 46 |
const char * parseError; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
size_t bytesConsumed; |
| 51 |
|
| 52 |
yajl_buf decodeBuf; |
| 53 |
|
| 54 |
yajl_bytestack stateStack; |
| 55 |
|
| 56 |
yajl_alloc_funcs alloc; |
| 57 |
|
| 58 |
unsigned int flags; |
| 59 |
}; |
| 60 |
|
| 61 |
yajl_status |
| 62 |
yajl_do_parse(yajl_handle handle, const unsigned char * jsonText, |
| 63 |
size_t jsonTextLen); |
| 64 |
|
| 65 |
yajl_status |
| 66 |
yajl_do_finish(yajl_handle handle); |
| 67 |
|
| 68 |
unsigned char * |
| 69 |
yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText, |
| 70 |
size_t jsonTextLen, int verbose); |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
long long |
| 75 |
yajl_parse_integer(const unsigned char *number, size_t length); |
| 76 |
|
| 77 |
|
| 78 |
#endif |