aboutsummaryrefslogtreecommitdiff
path: root/json.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2022-04-30 15:23:02 -0400
committerBruce Hill <bruce@bruce-hill.com>2022-04-30 15:23:02 -0400
commit206e1fa68fb921d0fd8c9d31ec59a9b7d0fc2a5d (patch)
tree916e508c47a30ed69c6e904479e642d12ec4d080 /json.c
parent24ed834317f3fda8f0f55489f54a2df1aca5de17 (diff)
Added tagged definitions: `foo:: blah`
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++)