node_show_s_expression | R Documentation |
node
's s-expressionnode_show_s_expression()
prints a nicely formatted s-expression to the
console. It powers the print methods of nodes and trees.
node_show_s_expression(
x,
...,
max_lines = NULL,
show_anonymous = TRUE,
show_locations = TRUE,
show_parentheses = TRUE,
dangling_parenthesis = TRUE,
color_parentheses = TRUE,
color_locations = TRUE
)
x |
A node. |
... |
These dots are for future extensions and must be empty. |
max_lines |
An optional maximum number of lines to print. If the maximum is hit, then
|
show_anonymous |
Should anonymous nodes be shown? If |
show_locations |
Should node locations be shown? |
show_parentheses |
Should parentheses around each node be shown? |
dangling_parenthesis |
Should the |
color_parentheses |
Should parentheses be colored? Printing large s-expressions is faster if
this is set to |
color_locations |
Should locations be colored? Printing large s-expressions is faster if
this is set to |
x
invisibly.
language <- treesitter.r::language()
parser <- parser(language)
text <- "fn <- function(a, b = 2) { a + b + 2 }"
tree <- parser_parse(parser, text)
node <- tree_root_node(tree)
node_show_s_expression(node)
node_show_s_expression(node, max_lines = 5)
# This is more like a typical abstract syntax tree
node_show_s_expression(
node,
show_anonymous = FALSE,
show_locations = FALSE,
dangling_parenthesis = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.