From hb at maths.lth.se  Sun Aug 14 11:42:12 2005
From: hb at maths.lth.se (Henrik Bengtsson)
Date: Sun, 14 Aug 2005 11:42:12 +0200
Subject: [Rd] parse():ing a unclosed string
Message-ID: <42FF11F4.4070802@maths.lth.se>

When parse():ing R code from *file* with a unclosed string, that is, a 
string that has an open quoation mark, but not a ending one, the string 
seems to be closed automagically.  Is this a "bug"?

Example:

 > code <- "x <- '123";
 > parse(text=code)           # Gives an error as expected
Error in parse(file, n, text, prompt) : parse error

 > cat(file="foo.R", code)
 > expr <- parse("foo.R")     # Closes the open string
 > print(expr)
expression(x <- "123\n")

Parsing from stdin(), that is parse(), gives an error too.

Platform: Windows XP Pro SP2, R Version 2.1.1 Patched (2005-07-20) as 
well as R Version 2.2.0 Under development (unstable) (2005-07-19 r34991).

Best

Henrik Bengtsson



[Rd] parse():ing a unclosed string
Henrik Bengtsson