From wdunlap at tibco.com  Fri Sep  2 00:24:19 2011
From: wdunlap at tibco.com (William Dunlap)
Date: Thu, 1 Sep 2011 22:24:19 +0000
Subject: [Rd] parser does not catch strings without closing quote
Message-ID: <E66794E69CFDE04D9A70842786030B9304F690@PA-MBX04.na.tibco.com>

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 



[Rd] parser does not catch strings without closing quote
William Dunlap