Learn R Programming

treesitter (version 0.3.0)

is_tree: Is x a tree?

Description

Checks if x is a tree_sitter_tree or not.

Usage

is_tree(x)

Value

TRUE if x is a tree_sitter_tree, otherwise FALSE.

Arguments

x

[object]

An object.

Examples

Run this code
if (FALSE) { # rlang::is_installed("treesitter.r")
language <- treesitter.r::language()
parser <- parser(language)

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

is_tree(tree)

is_tree(1)
}

Run the code above in your browser using DataLab