Uses the R parser to walk the syntax tree so that occurrences of pkg::fun
or library()/require()/requireNamespace()/loadNamespace()/use()/getFromNamespace()
inside string literals or comments are ignored.
Named arguments such as library(package = "pkg") are supported, as are
fully-qualified forms like base::library(pkg) or
methods::getFromNamespace(fn, "pkg").
Introspection helpers such as packageVersion(), getNamespace(),
asNamespace(), and attachNamespace() are not treated as dependency
introducers, because they are commonly used for version or feature checks
on packages that may or may not be required at runtime.
If the file cannot be parsed as valid R (syntax error, corrupt encoding,
etc.), the function falls back to a regex-based detector and emits a
warning() naming the file so users can investigate.