From pd@|gd @end|ng |rom gm@||@com  Thu Apr 11 10:57:56 2019
From: pd@|gd @end|ng |rom gm@||@com (peter dalgaard)
Date: Thu, 11 Apr 2019 10:57:56 +0200
Subject: [Rd] Parsing code with newlines
In-Reply-To: <9q0mukxxvgv.fsf@gmx.us>
References: <a564fafa0808040550j13fd5097q804fc9549cd4ad55@mail.gmail.com>
 <alpine.LFD.1.10.0808041402500.17316@gannet.stats.ox.ac.uk>
 <9q0r2ahx9kf.fsf@gmx.us> <48eaf7f6-3de0-bf4b-71be-50841711b656@gmail.com>
 <9q0mukxxvgv.fsf@gmx.us>
Message-ID: <2F6D5464-63E8-4A6B-9517-CE4E70C53480@gmail.com>

?\r" is CR not LF. On systems that use CRLF as newline, the combination should be "\n" at the C (or R) level. 

However, I suppose there is no particular reason not to treat CR as whitespace, as does happen with FF and HT.

-pd

> On 11 Apr 2019, at 01:59 , Mikhail Titov <mlt at gmx.us> wrote:
> 
> The barely modified test code I had in my previous post, does not parse
> what would seem a legit sample string "\r\n ls()". However, it does
> parse alright "\n ls()". Nowhere in the docs the intolerance to line
> feeds is mentioned. It is reproducible from R console as well.
> 
> ,----[ R console session ]
> | > parse(text="\r\n ls()")
> | Error in parse(text = "\r\n ls()") : <text>:1:1: unexpected input
> | 1:
> |     ^
> | >
> `----
> 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



[Rd] Parsing code with newlines
peter dalgaard