is_tree {treesitter}R Documentation

Is x a tree?

Description

Checks if x is a tree_sitter_tree or not.

Usage

is_tree(x)

Arguments

x

⁠[object]⁠

An object.

Value

TRUE if x is a tree_sitter_tree, otherwise FALSE.

Examples


language <- treesitter.r::language()
parser <- parser(language)

text <- "fn <- function() { 1 + 1 }"
tree <- parser_parse(parser, text)

is_tree(tree)

is_tree(1)


[Package treesitter version 0.1.0 Index]