+
+ fprintf(stderr, "In expression %s\n", expr);
+ fprintf(stderr, "Near here ----");
+
+ for (i = 0; i < state->error_pos; i++)
+ fprintf(stderr, "-");
+
+ fprintf(stderr, "^\n");
+}
+
+static bool
+filter_json(int opt, struct json_object *jsobj, char *expr)
+{
+ struct jp_state *state;
+ const char *prefix = NULL;
+ struct list_head matches;
+ struct match_item *item, *tmp;
+ struct json_object *res = NULL;
+
+ state = jp_parse(expr);
+
+ if (!state)
+ {
+ fprintf(stderr, "Out of memory\n");
+ goto out;
+ }
+ else if (state->error_code)
+ {
+ print_error(state, expr);
+ goto out;
+ }
+
+ INIT_LIST_HEAD(&matches);
+
+ res = jp_match(state->path, jsobj, match_cb, &matches);
+ prefix = (state->path->type == T_LABEL) ? state->path->str : NULL;
+
+ switch (opt)