[Rd] Roxygen

hadley wickham h.wickham at gmail.com
Fri Mar 21 16:29:31 CET 2008


On Fri, Mar 21, 2008 at 11:36 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> 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.

But you'll still need a formal grammar for the documentation comments.
 Borrowing the basic style of javadoc should suffice, although there
are some tricky issues with line-endings etc.

Hadley

-- 
http://had.co.nz/



More information about the R-devel mailing list