7 void *jsonp_alloc(void *(*mallocProc)(size_t));
8 void jsonp_parse(void *parser, int token, struct token tokentype, struct parser *);
9 void jsonp_free(void *p, void (*freeProc)(void*));
10 void jsonp_trace(FILE *out, char *prompt);
16 struct parser state = {0};
20 jp = jsonp_alloc(malloc);
24 //jsonp_trace(stdout, "trace: ");
25 while (fgets(line, sizeof line, stdin)) {
27 for (in = line; *in; in++) {
35 ttype = scan_json_ch(*in, &t);
37 printf("scanning error\n");
42 //printf("feeding %d\n", ttype);
43 jsonp_parse(jp, ttype, t, &state);
49 ttype = scan_json_ch(0, &t);
52 jsonp_parse(jp, ttype, t, &state);
55 jsonp_parse(jp, 0, t, &state);