[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-devel
Subject:    [Rd] incomplete results from as.character.srcref() in some cases involving quote()
From:       Georgi Boshnakov <georgi.boshnakov () manchester ! ac ! uk>
Date:       2018-06-18 14:20:00
Message-ID: 438D2EC9EAFE5946B2D5864670EA468E018F65DC48 () MBXP01 ! ds ! man ! ac ! uk
[Download RAW message or body]

Hi,

The result of  as,character() on  'srcref' objects doesn't have the closing ')' in \
some cases involving 'quote':

> e4 <- quote({2+2})
> class(attr(e4, "wholeSrcref"))
[1] "srcref"
> as.character(attr(e4, "wholeSrcref"))
[1] "e4 <- quote({2+2}"

As a result printing the object also lacks it and gives an incomplete expression:

> attr(e4, "wholeSrcref")
e4 <- quote({2+2}

It seems that it is the top level quote that suffers from this. Here the inner \
'quote' has the matching ')' but the outer one doesn't:

> e5 <- quote({quote({2+2})})
> class(attr(e5, "wholeSrcref"))
[1] "srcref"
> attr(e5, "wholeSrcref")
e5 <- quote({quote({2+2})}
> as.character(attr(e5, "wholeSrcref"))
[1] "e5 <- quote({quote({2+2})}"
> attributes(e5)
...

$wholeSrcref
e5 <- quote({quote({2+2})}


Attribute 'wholeSrcref' seems undocumented but it is of class 'srcref' which is \
documented (eg ?srcref) and has supporting methods.


Georgi Boshnakov



	[[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic