This function takes R code as string and creates the corresponding abstract syntax tree (AST) from which we can query nodes.
Arguments
- txt
A character string of length 1 containing the code to parse. If provided,
file
must not be provided.- file
Path to file containing the code to parse. If provided,
txt
must not be provided.Character vector indicating the tags to ignore. Default is
"ast-grep-ignore"
, meaning that any line that follows# ast-grep-ignore
will be ignored in the output ofnode_*()
functions.