fix: don't log NUL characters

Graphviz dot will fail with this character present
This commit is contained in:
Amaan Qureshi 2024-02-17 03:04:47 -05:00
parent da1f890752
commit caa451f024

View file

@ -997,7 +997,7 @@ void ts_subtree__print_dot_graph(const Subtree *self, uint32_t start_offset,
ts_subtree_lookahead_bytes(*self)
);
if (ts_subtree_is_error(*self) && ts_subtree_child_count(*self) == 0) {
if (ts_subtree_is_error(*self) && ts_subtree_child_count(*self) == 0 && self->ptr->lookahead_char != 0) {
fprintf(f, "\ncharacter: '%c'", self->ptr->lookahead_char);
}