Description Usage Arguments Details Value See Also Examples
This function traverses the given RStatic object and returns a list of indices for all descendants that satisfy the given test function.
1 2 | find_node_indices(node, test, ..., recursive = TRUE, initial = list(),
index = integer(0))
|
node |
(ASTNode) The RStatic object to search. |
test |
(function) The test function, which should accept an rstatic object to check as its first argument and return a scalar logical. |
... |
Additional arguments to the test function. |
recursive |
(logical) Search recursively in matching nodes? |
initial |
(list) Initial list of indices for matching nodes. |
index |
(integer) The index of |
All indices are relative to node
, unless index
is supplied.
Note that node
itself is not tested.
A list of indices for matching nodes.
1 2 3 4 5 6 7 8 9 | ast = quote_ast(
function(x, y) {
x = x + y
function() x
})
find_node_indices(ast, is, "Function")
find_node_indices(ast, is_symbol, "x")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.