get_symbols: Get Sets of Defined and Used Symbols

View source: R/get_symbols.R

get_symbolsR Documentation

Get Sets of Defined and Used Symbols

Description

This function returns the set of symbols defined by an expression and the set of symbols used by an expression.

Usage

get_symbols(node, initial = SymbolSets(), ...)

Arguments

node

(ASTNode) The expression to analyze.

initial

(SymbolSets) The initial sets of defined/used expressions.

...

Further arguments to methods.

recursive

(logical) Search for symbols in function definitions?

include_default_arguments

(logical) Search for symbols in default arguments?

only_undefined_uses

(logical) Exclude used symbols that are defined in node before they are used?

Value

A SymbolSets object, with elements defined and used. Element defined is a list of expressions that define a symbol. Element used is a list of used symbols.

See Also

names_defined(), names_used(), CodeDepends::getInputs()

Examples

ast = quote_ast(x <- sum(x, 1, y))
get_symbols(ast)

nick-ulle/ast documentation built on May 14, 2024, 7:40 p.m.