is_node: Is 'x' a node?

View source: R/node.R

is_nodeR Documentation

Is x a node?

Description

Checks if x is a tree_sitter_node or not.

Usage

is_node(x)

Arguments

x

⁠[object]⁠

An object.

Value

TRUE if x is a tree_sitter_node, otherwise FALSE.

Examples


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

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

is_node(node)

is_node(1)


treesitter documentation built on June 24, 2024, 5:07 p.m.