From pcd at wikitex.org  Mon Apr 21 06:15:54 2008
From: pcd at wikitex.org (Peter Danenberg)
Date: Sun, 20 Apr 2008 23:15:54 -0500
Subject: [Rd] AddComment (gram.y)
In-Reply-To: <480A5A28.60302@stats.uwo.ca>
References: <20080419050915.GA1820@klutometis.wikitex.org>
	<4809D46D.2030308@stats.uwo.ca>
	<20080419185707.GA10684@klutometis.wikitex.org>
	<480A5A28.60302@stats.uwo.ca>
Message-ID: <20080421041554.GA32674@klutometis.wikitex.org>

> They aren't "cannibalized", they are still there, where the source
> ref says they are.

I was thinking along the lines of using parse() to unambiguously
associate a comment block with a code object; sure, srcref() retains
them: but that's no different than parsing a text file.

If I can't associate comment with code in parse(), I don't see how I
can avoid reimplementing the R parser; at least far enough to identify
top-level objects (but why stop there?).

By "cannibalizing", I'm referring to the following; take trivial.R:

   # Comment relevant to foo
   foo <- "bar"

attributes(parse("trivial.R"))$srcref[[1]] returns:

   foo <- "bar"

which is consistent with SkipComment.



[Rd] AddComment (gram.y)
Peter Danenberg