aboutsummaryrefslogtreecommitdiff
path: root/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'json.c')
-rw-r--r--json.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/json.c b/json.c
index 231ccce..297aa30 100644
--- a/json.c
+++ b/json.c
@@ -30,6 +30,9 @@ static int _json_match(const char *text, match_t *m, int comma, bool verbose)
}
printf("\",\"range\":[%ld,%ld]", m->start - text, m->end - text);
+ if (m->pat->type == BP_TAGGED)
+ printf(",\"tag\":\"%.*s\"", (int)m->pat->args.capture.namelen, m->pat->args.capture.name);
+
if (m->children && (verbose || m->pat->type != BP_REF)) {
printf(",\"children\":[");
for (int i = 0; m->children && m->children[i]; i++)