node-first-child-byte | R Documentation |
These functions return the first child of x
that extends beyond the given
byte
offset. Note that byte
is a 0-indexed offset.
node_first_child_for_byte()
considers both named and anonymous nodes.
node_first_named_child_for_byte()
considers only named nodes.
node_first_child_for_byte(x, byte)
node_first_named_child_for_byte(x, byte)
x |
A node. |
byte |
The byte to start the search from. Note that |
A new node, or NULL
if there is no node past the byte
offset.
language <- treesitter.r::language()
parser <- parser(language)
text <- "fn <- function() { 1 + 1 }"
tree <- parser_parse(parser, text)
node <- tree_root_node(tree)
# Navigate to first child
node <- node_child(node, 1)
node
# `fn {here}<- function()`
node_first_child_for_byte(node, 3)
node_first_named_child_for_byte(node, 3)
# Past any node
node_first_child_for_byte(node, 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.