Skip to content

Continuation and parse

3 messages · Brian Ripley, Philippe GROSJEAN, Jim Lemon

#
On Wed, 28 Jun 2006, Jim Lemon wrote:

            
It's internal.  Look in src/main/main.c, in particular the R_Repl* 
functions.  In short, R_Parse1Buffer can return PARSE_INCOMPLETE.

This is not done by the R-level function parse(): that parses a whole 
buffer rather than a line at a time, and maps all non-OK results to an 
error.
#
Well, you haven't used the search engines with the right key: the magic 
words are:

 > RSiteSearch("incomplete line")

With the first document being my query (almost two years ago), and the 
second one being Peter Dalgaard answer. You must adapt it to cope with 
internationalization, but basically, you could use something like:

 > grep("\n2:",try(parse(textConnection("ls)")), silent = TRUE))
numeric(0)
 > grep("\n2:",try(parse(textConnection("ls(")), silent = TRUE))
[1] 1

Best,

Philippe Grosjean

..............................................<?}))><........
  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..............................................................
Jim Lemon wrote:
#
Hi gurus,

After an unsuccessful scrabble through the documentation and Jon's 
excellent search facility, I am no wiser as to how R recognizes an 
incomplete command line and politely raises its hand for more. The help 
page for parse gives no indication that it does anything more than spit 
the dummy when fed an incomplete command line, but something in there 
must recognize such ellipsis. Any hints?

Jim