Extract Elements from Parse Tree of R Script
Source:R/extract_from_parse_tree.R
extract_from_parse_tree.Rd
The idea of this function is to collect objects of interest from the parse
tree, e.g. the names of functions that are called by a script. Therefore,
set the function matches
so that it returns TRUE
for the nodes
in the tree that are of interest.
Usage
extract_from_parse_tree(
x,
matches = matches_function,
dbg = FALSE,
path = integer(),
parent = NULL,
index = -1
)
Arguments
- x
parse tree as returned by
parse
- matches
function that is called for each node of the tree. Give a function here that returns
TRUE
if the object is to be selected andFALSE
else. The value ofTRUE
must be given an attributename
that is expected to be a character of length one.- dbg
if
TRUE
each node in printed during the climing of the tree- path
for internal use
- parent
for internal use
- index
for internal use