findAssignTo | R Documentation |
This finds the variable declarations and assignments to variables in an abstract syntax tree.
findAssignTo(cur, var = character(), collector = genDeclAssignCollector())
cur |
the starting |
var |
a character vector of zero or more variable names. If this is non-empty, only declarations and assignments to variables in this vector are included in the result. |
collector |
the closures that collect the assignments/declarations as we iterate over the abstract syntax tree. |
A list of zero or more CXCursor
objects.
Duncan Temple Lang
createTU
getVariables
f = system.file("exampleCode/assignment.c", package = "RCIndex")
tu = createTU(f)
# All assignments
asgn = findAssignTo(tu)
table(names(asgn))
# Get the declarations and assignments for variables and and b
b = findAssignTo(tu, c("a", "b"))
# Just b
b = findAssignTo(tu, "b")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.