[Rd] parse():ing a unclosed string

From: Henrik Bengtsson <hb_at_maths.lth.se>
Date: Sun 14 Aug 2005 - 09:42:12 GMT


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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun Aug 14 19:46:08 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:16 GMT