[Rd] AddComment (gram.y)

Peter Danenberg pcd at wikitex.org
Mon Apr 21 06:15:54 CEST 2008

> 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.

More information about the R-devel mailing list