From f019a4fcb180bbf5888fed6c618b8d92a9936755 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 14 Dec 2020 22:20:16 -0800 Subject: Fix for json header file --- bpeg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bpeg.c') diff --git a/bpeg.c b/bpeg.c index bdb0099..2adc39f 100644 --- a/bpeg.c +++ b/bpeg.c @@ -14,6 +14,7 @@ #include "compiler.h" #include "file_loader.h" #include "grammar.h" +#include "json.h" #include "utils.h" #include "viz.h" #include "vm.h" @@ -89,7 +90,7 @@ static int run_match(grammar_t *g, const char *filename, vm_op_t *pattern, unsig printf("{\"filename\":\"%s\",", filename ? filename : "-"); printf("\"tree\":{\"rule\":\"text\",\"start\":%d,\"end\":%ld,\"children\":[", 0, f->end - f->contents); - json_match(stdout, f->contents, m, (flags & BPEG_VERBOSE) ? 1 : 0); + json_match(f->contents, m, (flags & BPEG_VERBOSE) ? 1 : 0); printf("]}}\n"); } else { if (printed_matches > 1) @@ -239,7 +240,7 @@ int main(int argc, char *argv[]) // Piped in input: ret &= run_match(g, NULL, pattern, flags); } - if (flags & BPEG_JSON) printf("]"); + if (flags & BPEG_JSON) printf("]\n"); return ret; } -- cgit v1.2.3