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 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel