From phgrosjean at sciviews.org  Fri Dec 28 23:02:56 2007
From: phgrosjean at sciviews.org (Philippe Grosjean)
Date: Fri, 28 Dec 2007 23:02:56 +0100
Subject: [Rd] parse() does not complain for not finished strings?
Message-ID: <47757290.5000301@sciviews.org>

Hello,
parse() is supposed to detect incomplete instructions, isn't it?
For instance:

> # Correct code
> msg <- 'log(10)'
> mc <- textConnection(msg)
> parse(mc)
expression(log(10))
> close(mc)

> # Now, an incomplete code
> msg <- 'log('
> mc <- textConnection(msg)
> parse(mc)
Error in parse(mc) : unexpected end of input at
2: log(
> close(mc)

> # Now, another incomplete code (character string not finished)
> msg <- 'text <- "some incomplete string'
> mc <- textConnection(msg)
> parse(mc)
expression(text <- "some incomplete string\n")
> close(mc)

I don't understand why parse() does not complain in this third case, and
why it "finishes" my string and adds a '\n' at its end. Does anybody
could explain me,... or is this a bug?
Many thanks.

Philippe Grosjean



[Rd] parse() does not complain for not finished strings?
Philippe Grosjean