Extract Elements from Parse Tree of R Script
Source:R/extract_from_parse_tree.R
extract_from_parse_tree.RdThe 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
TRUEif the object is to be selected andFALSEelse. The value ofTRUEmust be given an attributenamethat is expected to be a character of length one.- dbg
if
TRUEeach node in printed during the climing of the tree- path
for internal use
- parent
for internal use
- index
for internal use