class TreeSitter::Tree
- TreeSitter::Tree
- Reference
- Object
Overview
A Tree represents the syntax tree of an entire source code file. It contains Node instances
that indicate the structure of the source code. It can also be edited and used to produce a new
Tree in the event that the source code changes.
Defined in:
tree_sitter/tree.crInstance Method Summary
- #changed_ranges(old_tree : Tree) : Range::Iterator
-
#copy : Tree
Create a shallow copy of the syntax tree.
-
#root_node : Node
Get the root node of the syntax tree.
-
#save_dot(io : IO::FileDescriptor)
Write a DOT graph describing the syntax tree to the given file.
-
#save_dot(file : Path | String)
Write a DOT graph describing the syntax tree to the given file.
-
#save_png(file : Path | String) : Nil
Write a PNG graph describing the syntax tree to the given file.
Instance Method Detail
Create a shallow copy of the syntax tree. This is very fast.
You need to copy a syntax tree in order to use it on more than one thread at a time, as syntax trees are not thread safe.
Write a DOT graph describing the syntax tree to the given file.
Write a DOT graph describing the syntax tree to the given file.
Write a PNG graph describing the syntax tree to the given file.