tree_text()
retrieves the tree'stext
that it was parsed with.tree_language()
retrieves the tree'slanguage
that it was parsed with.tree_included_ranges()
retrieves the tree'sincluded_ranges
that were provided toparser_set_included_ranges()
. Note that if no ranges were provided originally, then this still returns a default that always covers the entire document.
Value
tree_text()
returns a string.tree_language()
returns atree_sitter_language
.tree_included_ranges()
returns a list ofrange()
objects.
Examples
language <- treesitter.r::language()
parser <- parser(language)
text <- "1 + foo"
tree <- parser_parse(parser, text)
tree_text(tree)
#> [1] "1 + foo"
tree_language(tree)
#> <tree_sitter_language>
#> Language: r
tree_included_ranges(tree)
#> [[1]]
#> <tree_sitter_range>
#> Start <byte: 0, row: 0, column: 0>
#> End <byte: 4294967295, row: 4294967295, column: 4294967295>
#>