Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 79 lines (67 sloc) 2.502 kb
d553293 move all files to trunk.
lloydh authored
1 /*
de81b1f @lloyd yajl 2 will be relicensed under the ISC license. same idea, fewer by…
authored
2 * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
d553293 move all files to trunk.
lloydh authored
16
17 #ifndef __YAJL_PARSER_H__
18 #define __YAJL_PARSER_H__
19
20 #include "api/yajl_parse.h"
57bac17 @lloyd implement a more efficient custom state stack (rather than re-using b…
authored
21 #include "yajl_bytestack.h"
d553293 move all files to trunk.
lloydh authored
22 #include "yajl_buf.h"
5752261 @lloyd yajl_tree to use same integer parsing routines as yajl's parser prope…
authored
23 #include "yajl_lex.h"
d553293 move all files to trunk.
lloydh authored
24
57bac17 @lloyd implement a more efficient custom state stack (rather than re-using b…
authored
25
d553293 move all files to trunk.
lloydh authored
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,
5752261 @lloyd yajl_tree to use same integer parsing routines as yajl's parser prope…
authored
32 yajl_state_map_sep,
d553293 move all files to trunk.
lloydh authored
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,
b9e91a3 @lloyd o rework yajl api
authored
38 yajl_state_array_need_val,
39 yajl_state_got_value,
d553293 move all files to trunk.
lloydh authored
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;
f02de67 @lloyd change yajl_get_error_offset() to yajl_get_bytes_consumed(), which wi…
authored
47 /* the number of bytes consumed from the last client buffer,
48 * in the case of an error this will be an error offset, in the
49 * case of an error this can be used as the error offset */
390748e @lloyd use size_t rather than unsigned int for representing buffer lengths f…
authored
50 size_t bytesConsumed;
d553293 move all files to trunk.
lloydh authored
51 /* temporary storage for decoded strings */
52 yajl_buf decodeBuf;
53 /* a stack of states. access with yajl_state_XXX routines */
57bac17 @lloyd implement a more efficient custom state stack (rather than re-using b…
authored
54 yajl_bytestack stateStack;
b78dd79 @lloyd * BREAKING API CHANGE: allow client to specify memory allocation ro…
authored
55 /* memory allocation routines */
56 yajl_alloc_funcs alloc;
b9e91a3 @lloyd o rework yajl api
authored
57 /* bitfield */
58 unsigned int flags;
d553293 move all files to trunk.
lloydh authored
59 };
60
61 yajl_status
0267389 @lloyd prune a now unused parameter (tanks' @agentdero)
authored
62 yajl_do_parse(yajl_handle handle, const unsigned char * jsonText,
390748e @lloyd use size_t rather than unsigned int for representing buffer lengths f…
authored
63 size_t jsonTextLen);
d553293 move all files to trunk.
lloydh authored
64
b9e91a3 @lloyd o rework yajl api
authored
65 yajl_status
66 yajl_do_finish(yajl_handle handle);
67
d553293 move all files to trunk.
lloydh authored
68 unsigned char *
69 yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText,
390748e @lloyd use size_t rather than unsigned int for representing buffer lengths f…
authored
70 size_t jsonTextLen, int verbose);
d553293 move all files to trunk.
lloydh authored
71
5752261 @lloyd yajl_tree to use same integer parsing routines as yajl's parser prope…
authored
72 /* A little built in integer parsing routine with the same semantics as strtol
73 * that's unaffected by LOCALE. */
74 long long
75 yajl_parse_integer(const unsigned char *number, unsigned int length);
76
d553293 move all files to trunk.
lloydh authored
77
78 #endif
Something went wrong with that request. Please try again.