extract_from_parse_tree: Extract Elements from Parse Tree of R Script

View source: R/extract_from_parse_tree.R

extract_from_parse_treeR Documentation

Extract Elements from Parse Tree of R Script

Description

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


KWB-R/kwb.code documentation built on July 28, 2023, 5:57 p.m.