Re: [Rd] question about R_ParseVector function

From: Duncan Murdoch <>
Date: Tue, 29 May 2007 05:29:51 -0400

Ev Whin wrote:
> Hi r-devel,
> The R_ParseVector has been changed in R-2.5.0, and there is a simple
> description about the 4th argument at
>, it says that:
> "R_ParseVector() has a new 4th argument 'SEXP srcfile' allowing source
> references to be attached to the returned expression list. "
> I do not quite understand the purpose of adding the 4th argument. Would some
> experts explain this function in details?

The 4th argument isn't used by the parser, but it is carried along and attached to the output as part of the source reference in a srcref attribute. The normal use would be a srcfile() object, or NULL for nothing.

Source references are currently used instead of deparsing when available, so that if a user parses something like

x <- 1 # comment
y <- 2

the comment and strange formatting aren't lost when displaying the code.

In the long term, I hope to also be able to use the source references in a source level debugger: they allow R to know where the code comes from as it is executing it, so the display could allow single stepping through the original source file, rather than through a deparsed version of the code. It's also possible that run-time errors could report the location of the line of code that triggered them.

Duncan Murdoch mailing list Received on Tue 29 May 2007 - 09:31:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 May 2007 - 13:33:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.