[Rd] [External] parse data wrong for R 4.0. raw strings
Gábor Csárdi
c@@rd|@g@bor @end|ng |rom gm@||@com
Wed Apr 22 16:38:31 CEST 2020
I don't know, maybe it would make sense to keep the whole expression,
that's the text of the tag after all.
Also, if we don't keep the whole expression, then it is not a valid
string literal any more, because it does not have quoting.
I can try to look into a patch. This is for 4.1 I believe, so in some
sense it is not urgent?
Gabor
On Wed, Apr 22, 2020 at 3:31 PM <luke-tierney using uiowa.edu> wrote:
>
> 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