mirror of
https://github.com/sogou/workflow.git
synced 2026-10-17 04:31:07 +08:00
Update JSON parser.
This commit is contained in:
+5
-15
@@ -86,22 +86,12 @@ static int __json_isdigit(char c)
|
||||
#define isdigit(c) __json_isdigit(c)
|
||||
|
||||
static const int __character_map[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||
};
|
||||
|
||||
static int __json_string_length(const char *cursor, size_t *escape, size_t *len)
|
||||
@@ -111,7 +101,7 @@ static int __json_string_length(const char *cursor, size_t *escape, size_t *len)
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (__character_map[(unsigned char)cursor[n]])
|
||||
while (__character_map[(unsigned char)cursor[n]] == 0)
|
||||
n++;
|
||||
|
||||
if (cursor[n] == '\"')
|
||||
|
||||
@@ -38,7 +38,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
json_value_t *json_value_parse(const char *json);
|
||||
json_value_t *json_value_parse(const char *text);
|
||||
json_value_t *json_value_create(int type, ...);
|
||||
json_value_t *json_value_copy(const json_value_t *val);
|
||||
void json_value_destroy(json_value_t *val);
|
||||
|
||||
Reference in New Issue
Block a user