For extensibility. We might add streaming parser options, even binary
JSON encoding options.
jv jv_load_file(const char *, int);
struct jv_parser;
-struct jv_parser* jv_parser_new();
+struct jv_parser* jv_parser_new(int);
void jv_parser_set_buf(struct jv_parser*, const char*, int, int);
jv jv_parser_next(struct jv_parser*);
void jv_parser_free(struct jv_parser*);
data = jv_string("");
} else {
data = jv_array();
- parser = jv_parser_new();
+ parser = jv_parser_new(0);
}
while (!feof(file) && !ferror(file)) {
char buf[4096];
return answer;
}
-struct jv_parser* jv_parser_new() {
+struct jv_parser* jv_parser_new(int flags) {
struct jv_parser* p = jv_mem_alloc(sizeof(struct jv_parser));
parser_init(p);
return p;
slurped = jv_array();
}
}
- struct jv_parser* parser = jv_parser_new();
+ struct jv_parser* parser = jv_parser_new(0);
char buf[4096];
while (read_more(buf, sizeof(buf))) {
if (options & RAW_INPUT) {