Re: [Rd] Help finding some code in the R source code

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Mon 14 Nov 2005 - 00:39:05 GMT

Greg,

On Nov 13, 2005, at 7:03 PM, Greg Evans wrote:

> I'm trying to write some Python code to check if a string text
> contains a complete R statement. I'm hoping someone will be able
> to point me to the right place in the R source code, so I can use
> it as a starting point.

What happens internally is that R runs the expression through the parser. When the parser returns PARSE_INCOMPLETE then you know that the expression is not complete and thus more input is needed. If you are directly interfacing R from Python then you can easily do exactly the same thing.
However, if you want a solution in pure Python, it may be more difficult as it would be equal to re-writing the R parser in Python... (or some 'light' version of it..).

Cheers,
Simon



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon Nov 14 11:42:41 2005

This archive was generated by hypermail 2.1.8 : Mon 14 Nov 2005 - 08:21:04 GMT