From 206e1fa68fb921d0fd8c9d31ec59a9b7d0fc2a5d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 30 Apr 2022 15:23:02 -0400 Subject: Added tagged definitions: `foo:: blah` --- json.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'json.c') 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++) -- cgit v1.2.3