Package io.github.treesitter.jtreesitter
Class Tree
java.lang.Object
io.github.treesitter.jtreesitter.Tree
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Create a shallow copy of the syntax tree.void
close()
void
Edit the syntax tree to keep it in sync with source code that has been modified.getChangedRanges
(Tree newTree) Compare an old edited syntax tree to a new syntax tree representing the same document.Get the included ranges of the syntax tree.Get the language that was used to parse the syntax tree.Get the root node of the syntax tree.getRootNodeWithOffset
(int bytes, Point extent) Get the root node of the syntax tree, but with its position shifted forward by the given offset.getText()
Get the source code of the syntax tree, if available.toString()
walk()
Create a new tree cursor starting from the root node of the tree.
-
Method Details
-
getLanguage
Get the language that was used to parse the syntax tree. -
getText
-
getRootNode
Get the root node of the syntax tree. -
getRootNodeWithOffset
-
getIncludedRanges
-
getChangedRanges
Compare an old edited syntax tree to a new syntax tree representing the same document.For this to work correctly, this tree must have been edited such that its ranges match up to the new tree.
- Returns:
- A list of ranges whose syntactic structure has changed.
-
edit
Edit the syntax tree to keep it in sync with source code that has been modified. -
walk
Create a new tree cursor starting from the root node of the tree. -
clone
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
RuntimeException
-
toString
-