]> git.evergreen-ils.org Git - working/Evergreen.git/blob - OpenSRF/src/libjson/json_tokener.h
7bfa35657c2c50433cbc3c4dc2868482bba15910
[working/Evergreen.git] / OpenSRF / src / libjson / json_tokener.h
1 /*
2  * $Id$
3  *
4  * Copyright Metaparadigm Pte. Ltd. 2004.
5  * Michael Clark <michael@metaparadigm.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public (LGPL)
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details: http://www.gnu.org/
16  *
17  */
18
19 #ifndef _json_tokener_h_
20 #define _json_tokener_h_
21
22 #include "json_object.h"
23
24 enum json_tokener_error {
25   json_tokener_success,
26   json_tokener_error_parse_unexpected,
27   json_tokener_error_parse_null,
28   json_tokener_error_parse_boolean,
29   json_tokener_error_parse_number,
30   json_tokener_error_parse_array,
31   json_tokener_error_parse_object,
32   json_tokener_error_parse_string,
33   json_tokener_error_parse_comment,
34   json_tokener_error_parse_eof,
35 };
36
37 enum json_tokener_state {
38   json_tokener_state_eatws,
39   json_tokener_state_start,
40   json_tokener_state_finish,
41   json_tokener_state_null,
42   json_tokener_state_comment_start,
43   json_tokener_state_comment,
44   json_tokener_state_comment_eol,
45   json_tokener_state_comment_end,
46   json_tokener_state_string,
47   json_tokener_state_string_escape,
48   json_tokener_state_escape_unicode,
49   json_tokener_state_boolean,
50   json_tokener_state_number,
51   json_tokener_state_array,
52   json_tokener_state_array_sep,
53   json_tokener_state_object,
54   json_tokener_state_object_field_start,
55   json_tokener_state_object_field,
56   json_tokener_state_object_field_end,
57   json_tokener_state_object_value,
58   json_tokener_state_object_sep,
59 };
60
61 struct json_tokener
62 {
63   char *source;
64   int pos;
65   struct printbuf *pb;
66 };
67
68 extern struct json_object* json_tokener_parse(char *s);
69
70 #endif