Skip to contents

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 and FALSE else. The value of TRUE must be given an attribute name 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

Value

vector of character or NULL