[Rd] [External] parse data wrong for R 4.0. raw strings

iuke-tier@ey m@iii@g oii uiow@@edu iuke-tier@ey m@iii@g oii uiow@@edu
Wed Apr 22 16:31:17 CEST 2020


Looks like a bug. Will have a look when I get a chance.

Simpler version:

getParseData(parse(text = 'r"-|hello|-"'))


> getParseData(parse(text = 'r"(hello)"'))
   line1 col1 line2 col2 id parent     token terminal    text
1     1    1     1   10  1      3 STR_CONST     TRUE "hello)
3     1    1     1   10  3      0      expr    FALSE

The opening quote probably should not be there either.

More likely to get fixed sooner if someone can provide a patch.

Best,

luke

On Wed, 22 Apr 2020, Gábor Csárdi wrote:

> This seems like a bug to me:
>
> code <- 'x <- r"(hello, "world")"'
> getParseData(parse(text = code))
> #>   line1 col1 line2 col2 id parent       token terminal             text
> #> 7     1    1     1   24  7      0        expr    FALSE
> #> 1     1    1     1    1  1      3      SYMBOL     TRUE                x
> #> 3     1    1     1    1  3      7        expr    FALSE
> #> 2     1    3     1    4  2      7 LEFT_ASSIGN     TRUE               <-
> #> 4     1    6     1   24  4      6   STR_CONST     TRUE "hello, "world")
> #> 6     1    6     1   24  6      7        expr    FALSE
>
> Note that for STR_CONST, the opening delimiter is not included, but
> the paren from the closing delimiter is.
>
> Best,
> Gabor
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney using uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu


More information about the R-devel mailing list