[Rd] parse/INSTALL feature request(s)
Duncan Murdoch
murdoch at stats.uwo.ca
Sun Oct 22 03:07:58 CEST 2006
On 10/21/2006 6:36 PM, Michael Toews wrote:
>> 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
Thank you.
> (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 ).
No, that's not what I was referring to. Preprocessors put lines like
#line 3 "header.h"
into their output so that the compiler can put useful debugging
information into files when it processes them. R could do that when it
concatenates the files, and then tell you the origin of each line, not
the relatively useless line number from the concatenated file. (A very
simple version would add a record like that on every line, and that
would work with the current error reporting system; a slightly more
sophisticated version would just put those lines in between each
concatenated file, and then the error reporting would need to be made
aware of them.)
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.
I'm reasonably hopeful that version 2.5.0 will have more source level
debugging support in it, at least to the level of the "slightly more
sophisticated version", and maybe better than that.
If you'd like to help with this, you can see the (currently extremely
unstable and incomplete) code on the djm-source branch in the
repository. No support for "#line" yet.
Duncan Murdoch
More information about the R-devel
mailing list