visit: VisitExpression

VisitExpressionR Documentation

VisitExpression

Description

Visit R expression objects.

Usage

VisitExpression(e, Function, Assign, Call, Leaf, global=FALSE, assign.name=NA)

Arguments

e

Expression to visit.

Function

Function call when visiting a AST node that is a function declaration.

Assign

Function call when visiting a AST node that is a assignation.

Call

Function call when visiting a AST node that is a function call.

Leaf

Function call when visiting a AST node that is a leaf (identifier or constant).

global

TRUE if this expression is at a global level

assign.name

Identifier name assigned to this expression.

Details

This function visit an expression by doing a depth-first walk of the abstract syntax tree represented by the expression object.

Function is called on call to function. It takes as arguments args the list of argument of the function, the body of the function and ref which is a srcref of the function.

Assign is called on assignment. It takes as arguments the name of the assigned identifier and value the value assigned.

Call is called on function calls. It takes as arguments the name of the function called and args the expressions of the passed arguments.

Leaf is called on the leafs of the AST (i.e. identifiers and simple values like numeric and characters). It takes as arguments the value of the node.

Additionally the three first function also have an argument res containing the result of the recursive call of VisitExpressions on childs (either function body, assignment value or argument expressions).

Also there are global and assign.name which are the same as for VisitExpressions.

Author(s)

Maëlick Claes <himself@maelick.net>


ecos-umons/sourceR documentation built on June 26, 2022, 2:21 p.m.