From murdoch at stats.uwo.ca  Fri Mar 21 11:36:59 2008
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Fri, 21 Mar 2008 06:36:59 -0400
Subject: [Rd] Roxygen
In-Reply-To: <20080321060928.GA1283@klutometis.wikitex.org>
References: <47DFD659.40506@stat.uni-muenchen.de>	<20080319151841.GB15511@klutometis.wikitex.org>	<47E14D5E.7090105@stat.uni-muenchen.de>
	<20080321060928.GA1283@klutometis.wikitex.org>
Message-ID: <47E38FCB.2050104@stats.uwo.ca>

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



[Rd] Roxygen
Duncan Murdoch