Closed jamesscottbrown closed 3 years ago
Thanks for your feedback
I'm thinking to change the regex to : ^(\s)()(\w+)\s+(?:<-|=)\s+function\s(
This would allow = for assignment.
Also, it will require the opening parenthesis, but not the closing parenthesis. This would match better, since the regex is performed per line, and some functions have newlines between arguments.
Your thoughts?
I have made this change for R
I've also changed the regexes for several other languages, so that only the opening parenthesis '(' is required
When scanning code in R files, callGraph searches for function definitions using the regex
Newlines between arguments
The
.
wildcard doesn't match newlines, so this fails to detect function definitions like:An alternative would be to replace
.
with the character set matching everything except closing parentheses ([^\)]
):Use of
=
instead of->
Whilst using
<-
for assignment is preferred,=
may be used. Any functions defined in this way will not be recognised.This could be fixed by replacing the
<-
with(<-|=)
.