Shouldn't the parser complain about unfinished strings in files?
It doesn't and will tack on a newline if there isn't one there. 

  > withOption <- function(optionList, expr) {
  +     oldOption <- options(optionList)
  +     on.exit(options(oldOption))
  +     expr
  + }

  > cat(file=tf<-tempfile(), "\"string without closing quote\n")
  > p <- withOption(list(keep.source=FALSE), parse(tf))
  > p
  expression("string without closing quote\n")

  > cat(file=tf<-tempfile(), "\"string with no closing quote nor newline")
  > p <- withOption(list(keep.source=FALSE), parse(tf))
  > p
  expression("string with no closing quote nor newline\n")

It does complain when parsing a character string with the same problem.
  > p <- withOption(list(keep.source=FALSE), parse(text="\"unfinished string"))
  Error in parse(text = "\"unfinished string") :
    2:0: unexpected end of input
  1: "unfinished string
    ^

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to