Add --dot flag to parse subcommand, for printing tree as DOT graph
This commit is contained in:
parent
8389ffd2a1
commit
97fd990822
10 changed files with 106 additions and 43 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#include <unistd.h>
|
||||
#include "tree_sitter/api.h"
|
||||
#include "./array.h"
|
||||
#include "./get_changed_ranges.h"
|
||||
|
|
@ -123,6 +124,8 @@ TSRange *ts_tree_get_changed_ranges(const TSTree *self, const TSTree *other, uin
|
|||
return result;
|
||||
}
|
||||
|
||||
void ts_tree_print_dot_graph(const TSTree *self, FILE *file) {
|
||||
void ts_tree_print_dot_graph(const TSTree *self, int fd) {
|
||||
FILE *file = fdopen(dup(fd), "a");
|
||||
ts_subtree_print_dot_graph(self->root, self->language, file);
|
||||
fclose(file);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue