[Rd] regression bug with getParseData and/or parse in R-3.1.0

Duncan Murdoch murdoch.duncan at gmail.com
Thu Jun 12 14:39:25 CEST 2014


On 12/06/2014, 7:37 AM, Karl Forner wrote:
> Hi,
> 
> With R-3.1.0 I get:
>> getParseData(parse(text = "{1}", keep.source = TRUE))
>   line1 col1 line2 col2 id parent     token terminal text
> 7     1    1     1    3  7      9      expr    FALSE
> 1     1    1     1    1  1      7       '{'     TRUE    {
> 2     1    2     1    2  2      3 NUM_CONST     TRUE    1
> 3     1    2     1    2  3      5      expr    FALSE
> 4     1    3     1    3  4      7       '}'     TRUE    }
> 
> Which has two problems:
> 1) the parent of the first expression (id=7) should be 0
> 2) the parent of the expression with id=3 should be 7

I believe this has been fixed in R-patched.  Could you please check?

The problem was due to an overly aggressive optimization introduced in
R-devel in June, 2013.  It assumed a vector was initialized to zeros,
but in some fairly common circumstances it wasn't, so the parent
calculation was wrong.

Luckily 3.1.1 has been delayed by incompatible schedules of various
people, or this fix might have missed that too.  As with some other
fixes in R-patched, this is a case of a bug that sat there for most of a
year before being reported.  Please people, test pre-release versions.

Duncan Murdoch


> 
> For reference, with R-3.0.2:
> 
>> getParseData(parse(text = "{1}", keep.source = TRUE))
>   line1 col1 line2 col2 id parent     token terminal text
> 7     1    1     1    3  7      0      expr    FALSE
> 1     1    1     1    1  1      7       '{'     TRUE    {
> 2     1    2     1    2  2      3 NUM_CONST     TRUE    1
> 3     1    2     1    2  3      7      expr    FALSE
> 4     1    3     1    3  4      7       '}'     TRUE    }
> 
> which is correct.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list