[Rd] parse/INSTALL feature request(s)

Michael Toews mwtoews at sfu.ca
Sun Oct 22 00:36:43 CEST 2006


> What would be possible is to do like other preprocessors do, and put
> comments into the source file to indicate the origin of each line:  then
> the parser could tell you the location in the original file, which would
> be a lot more useful.

I think what you are referring to is already nicely implemented (in 
R/src/main/source.c lines 89 to 97), and the errors are correctly shown 
in my example as lines 1222 to 1223. However, these line numbers are 
irrelevant to the original files, as they been concatenated into one 
large file (I think on line 765 of R/src/scripts/INSTALL.in ). This 
single file is loaded into an R environment (on line 790 of INSTALL.in), 
which is also the region where my original error from 'R CMD INSTALL' 
was thrown. The loading is done by the 'tools:::makeLazyLoading' 
function, which loads in the single R-source file into a fresh 
environment for the package.

I'm unsure of why a single R source file is needed in INSTALL (which 
limits the ability to show any offending file names and their line 
numbers). The functions in R/src/library/tools/R/makeLazyLoad.R could 
perhaps be made a bit more versatile to individually read the R source 
files for a package using a 'pattern="\.R$"', and throw an error from 
'sys.source' displaying the file name, and other error messages from 
'parse'. This is simply a feature-request suggestion, but as Gabor 
advised, I should really develop my functions file-by-file.
+mt




More information about the R-devel mailing list