|
@@ -22,20 +22,22 @@
|
|
|
extern "C" {
|
|
|
#endif // __cplusplus
|
|
|
|
|
|
+enum json_type {
|
|
|
+ JSON_TYPE_EOF = 0, // End of parsed tokens marker
|
|
|
+ JSON_TYPE_STRING = 1,
|
|
|
+ JSON_TYPE_NUMBER = 2,
|
|
|
+ JSON_TYPE_OBJECT = 3,
|
|
|
+ JSON_TYPE_TRUE = 4,
|
|
|
+ JSON_TYPE_FALSE = 5,
|
|
|
+ JSON_TYPE_NULL = 6,
|
|
|
+ JSON_TYPE_ARRAY = 7
|
|
|
+};
|
|
|
+
|
|
|
struct json_token {
|
|
|
- const char *ptr; // Points to the beginning of the token
|
|
|
- int len; // Token length
|
|
|
- int num_desc; // For arrays and object, total number of descendants
|
|
|
- int type; // Type of the token, possible values below
|
|
|
-
|
|
|
-#define JSON_TYPE_EOF 0 // End of parsed tokens marker
|
|
|
-#define JSON_TYPE_STRING 1
|
|
|
-#define JSON_TYPE_NUMBER 2
|
|
|
-#define JSON_TYPE_OBJECT 3
|
|
|
-#define JSON_TYPE_TRUE 4
|
|
|
-#define JSON_TYPE_FALSE 5
|
|
|
-#define JSON_TYPE_NULL 6
|
|
|
-#define JSON_TYPE_ARRAY 7
|
|
|
+ const char *ptr; // Points to the beginning of the token
|
|
|
+ int len; // Token length
|
|
|
+ int num_desc; // For arrays and object, total number of descendants
|
|
|
+ enum json_type type; // Type of the token, possible values below
|
|
|
};
|
|
|
|
|
|
// Error codes
|