B Tyner
2015-Feb-19 23:31 UTC
[R] non-terminal token lacking children from utils::getParseData
Hi, I have run across a source file for which the return value of getParseData() includes a record having FALSE for $terminal, yet it is not the parent of any other tokens. Before I spend time constructing a reproducible example, I wanted to verify that this is in fact unexpected behavior (under R 3.1.2)? Thanks, Ben [[alternative HTML version deleted]]
Duncan Murdoch
2015-Feb-19 23:34 UTC
[R] non-terminal token lacking children from utils::getParseData
On 19/02/2015 6:31 PM, B Tyner wrote:> Hi, > > I have run across a source file for which the return value > of getParseData() includes a record having FALSE for $terminal, yet it is > not the parent of any other tokens. Before I spend time constructing a > reproducible example, I wanted to verify that this is in fact unexpected > behavior (under R 3.1.2)?Before I spend the time thinking about that, I'd like to see a reproducible example. Duncan Murdoch
Benjamin Tyner
2015-Feb-20 02:03 UTC
[R] non-terminal token lacking children from utils::getParseData
I tried to reduce the offending portion as best I could to a more-or-less minimal example (1136 bytes), which can be downloaded via: wget https://www.dropbox.com/s/74rgxr5x2aalr99/badstring.R then once in R, > b <- parse(file = "~/badstring.R", keep.source = TRUE) > d <- getParseData(b, includeText = FALSE) > subset(d, line1 == 2L) line1 col1 line2 col2 id parent token terminal 10 2 5 24 1 10 21 expr FALSE > subset(d, parent == 10) [1] line1 col1 line2 col2 id parent token terminal <0 rows> (or 0-length row.names) here is my > sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base note that while it says R version 3.0.2 above, I have seen the same behaviour under version 3.1.2 as well. Regards Ben On 02/19/2015 06:34 PM, Duncan Murdoch wrote:> On 19/02/2015 6:31 PM, B Tyner wrote: >> Hi, >> >> I have run across a source file for which the return value >> of getParseData() includes a record having FALSE for $terminal, yet it is >> not the parent of any other tokens. Before I spend time constructing a >> reproducible example, I wanted to verify that this is in fact unexpected >> behavior (under R 3.1.2)? > Before I spend the time thinking about that, I'd like to see a > reproducible example. > > Duncan Murdoch > >