mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Keep track of the root of the parse tree for the caller
This commit is contained in:
+4
-1
@@ -11,9 +11,10 @@ typedef enum json_expect {
|
|||||||
|
|
||||||
static json_pull *json_init() {
|
static json_pull *json_init() {
|
||||||
json_pull *j = malloc(sizeof(json_pull));
|
json_pull *j = malloc(sizeof(json_pull));
|
||||||
j->container = NULL;
|
|
||||||
j->error = NULL;
|
j->error = NULL;
|
||||||
j->line = 1;
|
j->line = 1;
|
||||||
|
j->root = NULL;
|
||||||
|
j->container = NULL;
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +127,8 @@ static json_object *add_object(json_pull *j, json_type type) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
j->root = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
|
|||||||
+3
-1
@@ -18,13 +18,15 @@ typedef struct json_object {
|
|||||||
} json_object;
|
} json_object;
|
||||||
|
|
||||||
struct json_pull {
|
struct json_pull {
|
||||||
json_object *container;
|
json_object *root;
|
||||||
char *error;
|
char *error;
|
||||||
|
|
||||||
int (*read)(struct json_pull *);
|
int (*read)(struct json_pull *);
|
||||||
int (*peek)(struct json_pull *);
|
int (*peek)(struct json_pull *);
|
||||||
void *source;
|
void *source;
|
||||||
int line;
|
int line;
|
||||||
|
|
||||||
|
json_object *container;
|
||||||
};
|
};
|
||||||
typedef struct json_pull json_pull;
|
typedef struct json_pull json_pull;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user