| 31 | static int pprint = 0; // to pretty-print or not |
| 32 | |
| 33 | static int node_info(Node u) |
| 34 | { |
| 35 | fprintf(stderr, "node: "); |
| 36 | show(stderr, u->id, 0); |
| 37 | fprintf(stderr, " children: %u ", outdegree(u)); |
| 38 | jsmntok_t *val = node_attr_value(u, "token_id"); |
| 39 | if (val) { |
| 40 | fprintf(stderr, " token_id: "); |
| 41 | show(stderr, val, 0); |
| 42 | } |
| 43 | jsmntok_t *type = node_attr_value(u, "node-type"); |
| 44 | if (type && string_eq(type, "Token")) { |
| 45 | fprintf(stderr, " token: "); |
| 46 | show(stderr, u->label, 1); |
| 47 | } |
| 48 | else { |
| 49 | fprintf(stderr, " nonterm: "); |
| 50 | show(stderr, u->label, 1); |
| 51 | } |
| 52 | fputc('\n', stderr); |
| 53 | return 1; |
| 54 | } |
| 55 | |
| 56 | static int edge_info(Edge e) |
| 57 | { |
no test coverage detected