Find the kind of a node
Arguments
- x
A node, either from
tree_root()
or from anothernode_*()
function.
Examples
src <- "x <- rnorm(100, mean = 2)
any(duplicated(y))
x <- z + 1
any(duplicated(x))"
root <- src |>
tree_new() |>
tree_root()
root |>
node_find(ast_rule(pattern = "any(duplicated($VAR))")) |>
node_kind()
#> $rule_1
#> [1] "call"
#>
root |>
node_find(ast_rule(pattern = "$X + $VALUE")) |>
node_kind()
#> $rule_1
#> [1] "binary_operator"
#>