[Rd] Roxygen
Duncan Murdoch
murdoch at stats.uwo.ca
Fri Mar 21 11:36:59 CET 2008
On 21/03/2008 2:09 AM, Peter Danenberg wrote:
>> No, we want a solution in R.
>
> Would it suffice, by the way, to source() a file and introspect upon
> its objects with ls(), formals(), typeof(), mode(), and the like; or
> should we formalize, say, a BNF and write the accompanying automaton?
I don't know Manuel's intentions, but I'd say you should make use of the
parse() function, not source. parse() converts source into unevaluated
expressions. If you start writing your own parser of R code, it will be
hard to validate, and hard to maintain, because there are occasional
tweaks to the R definition.
parse() currently does nothing with comments, but it does tell you where
each parsed expression came from, so your code could use that
information to look again through the source for the bits that interest you.
Duncan Murdoch
More information about the R-devel
mailing list