1 /*
2  * $Id: json_tokener.h,v 1.9 2006/01/30 23:07:57 mclark Exp $
3  *
4  * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
5  * Michael Clark <michael@metaparadigm.com>
6  *
7  * This library is free software; you can redistribute it and/or modify
8  * it under the terms of the MIT license. See COPYING for details.
9  *
10  */
11 
12 #ifndef _json_tokener_h_
13 #define _json_tokener_h_
14 
15 #include "json_object.h"
16 
17 enum json_tokener_error {
18   json_tokener_success,
19   json_tokener_error_parse_unexpected,
20   json_tokener_error_parse_null,
21   json_tokener_error_parse_boolean,
22   json_tokener_error_parse_number,
23   json_tokener_error_parse_array,
24   json_tokener_error_parse_object,
25   json_tokener_error_parse_string,
26   json_tokener_error_parse_comment,
27   json_tokener_error_parse_eof
28 };
29 
30 enum json_tokener_state {
31   json_tokener_state_eatws,
32   json_tokener_state_start,
33   json_tokener_state_finish,
34   json_tokener_state_null,
35   json_tokener_state_comment_start,
36   json_tokener_state_comment,
37   json_tokener_state_comment_eol,
38   json_tokener_state_comment_end,
39   json_tokener_state_string,
40   json_tokener_state_string_escape,
41   json_tokener_state_escape_unicode,
42   json_tokener_state_boolean,
43   json_tokener_state_number,
44   json_tokener_state_array,
45   json_tokener_state_array_sep,
46   json_tokener_state_object,
47   json_tokener_state_object_field_start,
48   json_tokener_state_object_field,
49   json_tokener_state_object_field_end,
50   json_tokener_state_object_value,
51   json_tokener_state_object_sep
52 };
53 
54 struct json_tokener
55 {
56   char *source;
57   int pos;
58   struct printbuf *pb;
59 };
60 
61 extern struct json_object* json_tokener_parse(char *s);
62 
63 #endif
64