Parses every file in r_files, walks its AST, and returns a list of node
records – one per named function definition discovered. Handles standard
<-/= assignments, S4 generics/methods/classes, and R6 class methods.
Files that cannot be parsed are skipped with a warning; the function never
throws.
Arguments
- r_files
Character vector of absolute paths to
.Rsource files (typically ther_fileselement returned bydetect_rproject()).
Value
A list of node records. Each record is a named list with elements:
node_id"<file_stem>::<fn_name>"character(1).nameFunction name, character(1).
fileAbsolute path of the source file, character(1).
line_startInteger: first line of the definition.
line_endInteger: last line of the definition.
signatureDeparsed signature:
"name(arg1, arg2)", character(1).body_textFull source text of the definition, character(1).
roxygen_textAdjacent Roxygen block (may be
""), character(1).complexityInteger: approximate cyclomatic complexity.
calls_listCharacter vector of called symbol names.
Examples
if (FALSE) { # \dontrun{
proj <- detect_rproject("/path/to/mypkg")
nodes <- extract_function_nodes(proj$r_files)
length(nodes) # number of functions found
} # }