Add debug and debug-graph flags to parse and test commands

This commit is contained in:
Max Brunsfeld 2019-01-08 21:03:51 -08:00
parent 6c4d00aad5
commit 98807d2053
10 changed files with 182 additions and 32 deletions

View file

@ -1542,8 +1542,16 @@ void ts_parser_set_logger(TSParser *self, TSLogger logger) {
self->lexer.logger = logger;
}
void ts_parser_print_dot_graphs(TSParser *self, FILE *file) {
self->dot_graph_file = file;
void ts_parser_print_dot_graphs(TSParser *self, int fd) {
if (self->dot_graph_file) {
fclose(self->dot_graph_file);
}
if (fd >= 0) {
self->dot_graph_file = fdopen(fd, "a");
} else {
self->dot_graph_file = NULL;
}
}
void ts_parser_halt_on_error(TSParser *self, bool should_halt_on_error) {