clone | R Documentation |
CXCursor
classThe CXCursor
is one of the two primary
data types in RCIndex
.
A cursor represents semantic information about an element
of code. It might be a call expression, a binary operator,
a C++ class definition, a variable declaration, a routine/function
declaration/definition.
Each cursor has a kind field that describes its purpose.
The set of possible cursor kinds is available via the variable
CXCursorKind
. These are enumeration values with a symbolic name
and a corresponding integer value used in C code.
clone(x, ...)
getParent(cursor, semantic = TRUE)
x |
the |
... |
additional parameters for the methods |
cursor |
the |
semantic |
a logical value indicating either the semantic parent or alternatively the lexical parent of this cursor. |
clone
returns a new object made from copying the input.
Duncan Temple Lang
libclang http://clang.llvm.org/doxygen/group__CINDEX.html
CXCursor-class
f = system.file("exampleCode", "fib.c", package = "RCIndex")
r = getRoutines(f)
r$fib
cur = as(r$fib, "CXCursor")
cur[[1]] # the ParmDecl
cur[[2]] # the body of the routine
cur[[2]][[2]] # the return
cur[[2]][[2]][[1]][[1]] # the BinaryOperator for fib(n-1) + fib(n-2)
getCursorTokens(cur[[2]][[2]][[1]][[1]]) #
bin = cur[[2]][[2]][[1]][[1]]
# get operator
toks = getCursorTokens(bin[[1]])
toks[length(toks)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.