writeDotGraph method

void writeDotGraph(
  1. StringSink output
)

Writes a Graphviz representation of the retained concrete syntax tree.

This is the sink-based Dart equivalent of ts_tree_print_dot_graph. The caller retains ownership of output, just as native Tree-sitter duplicates the supplied file descriptor before closing its stream.

Implementation

void writeDotGraph(StringSink output) {
  _checkNotDisposed();
  output.writeln('digraph tree {');
  output.writeln('edge [arrowhead=none]');
  final generated = generatedTree;
  if (generated != null) {
    _writeGeneratedDotSubtree(output, generated, generated.rootNode);
  } else {
    _writeVisibleDotSubtree(output, rootNode);
  }
  output.writeln('}');
}