aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-12-14 22:20:16 -0800
committerBruce Hill <bruce@bruce-hill.com>2020-12-14 22:20:16 -0800
commitf019a4fcb180bbf5888fed6c618b8d92a9936755 (patch)
treef99282a42630017be42b6209303bcc86ed27b3f2
parent94ba1fd177f28ef3d06f4aeb2e6044cb6c321992 (diff)
Fix for json header file
-rw-r--r--bpeg.c5
-rw-r--r--vm.h2
2 files changed, 3 insertions, 4 deletions
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;
}
diff --git a/vm.h b/vm.h
index 2b34594..3470e9c 100644
--- a/vm.h
+++ b/vm.h
@@ -18,8 +18,6 @@ __attribute__((nonnull))
void destroy_match(match_t **m);
__attribute__((nonnull))
void print_match(file_t *f, match_t *m, print_options_t options);
-__attribute__((nonnull))
-void json_match(FILE *f, const char *text, match_t *m, int verbose);
#endif
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1