[Rd] "\088" is legal syntax?

William Dunlap wdunlap at tibco.com
Fri Sep 2 02:56:48 CEST 2011


Also, the relax package in CRAN uses "\283" instead of "\303"
in many places:

./relax/R/relax.R:    pc<-eval(parse(text='"\\283"'))  # UTF-8-pre-char
./relax/R/weaveRhtml.R:      pc<-eval(parse(text='"\\283"'))  # UTF-8-pre-char
./relax/R/weaveRhtml.R:      input<-gsub("\283\237","ß",input)
./relax/R/weaveRhtml.R:      input<-gsub("(\283\244|\283\266|\283\274|\283\204|\283\226|\283\234)",
./relax/R/weaveRhtml.R:      input<-chartr("\283\244\283\266\283\274\283\204\283\226\283\234",
./relax/R/weaveR.R:      pc<-eval(parse(text='"\\283"'))  # UTF-8-pre-char
./relax/R/weaveR.R:    input<-gsub("\283\237","{\\\\ss}",input)
./relax/R/weaveR.R:    input<-gsub("(\283\244|\283\266|\283\274|\283\204|\283\226|\283\234)",
./relax/R/weaveR.R:    input<-chartr("\283\244\283\266\283\274\283\204\283\226\283\234",
./relax/R/weaveR.R:        # pc<-eval(parse(text='"\\283"'))  # UTF-8-pre-char
./relax/R/weaveR.R:             '"\\283\\244\\283\\266\\283\\274\\283\\204\\283\\226\\283\\234\\283\\237"'))


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] On Behalf Of William Dunlap
> Sent: Thursday, September 01, 2011 5:48 PM
> To: Duncan Murdoch
> Cc: r-devel at r-project.org
> Subject: Re: [Rd] "\088" is legal syntax?
> 
> The CRAN package svMisc misuses it, using "\8" instead of "\10" or "\b":
>  ./svMisc/R/progress.R:          backspaces <- paste(rep("\8", l3), collapse = "")
> 
> I noticed it when S+ emitted a warning when parsing that file:
>   > p <- parse("svMisc/R/progress.R")
>   Warning messages:
>     The initial backslash is ignored in \8 -- not a recognized escape sequence.
>           Use \\ to make a backslash in: parse("svMisc/R/progress.R")
> (S+ parses the "\8" as "8", as the warning obliquly implies.)
> 
> I grepped through other CRAN sources for "\\0*8" and also found
>   ./mvbutils/R/mvbutils.R:  rep.percent <- '\008'
> S+ emits no warning for that but parses it as "", because it
> considers the octal escape to stop at the first non-octal digit.
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
> 
> > -----Original Message-----
> > From: Duncan Murdoch [mailto:murdoch.duncan at gmail.com]
> > Sent: Thursday, September 01, 2011 5:30 PM
> > To: William Dunlap
> > Cc: r-devel at r-project.org
> > Subject: Re: [Rd] "\088" is legal syntax?
> >
> > On 11-09-01 5:43 PM, William Dunlap wrote:
> > > Is it intentional that the digit 8 is allowed
> > > in octal escape sequences in character literals?
> > >
> > >    >  "\110" == "\088"
> > >    [1] TRUE
> > >    >  "\8" == "\b"
> > >    [1] TRUE
> > >
> > > 9's are rejected, so I'd expected 8's to be illegal as well.
> >
> > It is documented that way in the R-lang manual, but I imagine it's just
> > a thinko.  It's been like that since octal escapes were added in 1998.
> > I wonder how much will break if I fix it?
> >
> > Duncan Murdoch
> >
> > >
> > >    >  "\9"
> > >    Error: '\9' is an unrecognized escape in character string starting "\9"
> > >    >  "\091")
> > >    Error: embedded nul in string: '\091'
> > >
> > > Bill Dunlap
> > > Spotfire, TIBCO Software
> > > wdunlap tibco.com
> > >
> > >> sessionInfo()
> > > R version 2.13.1 (2011-07-08)
> > > Platform: x86_64-unknown-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=C              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
> > >
> > > ______________________________________________
> > > R-devel at r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list