From simon.urbanek at r-project.org  Mon Nov 14 01:39:05 2005
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Sun, 13 Nov 2005 19:39:05 -0500
Subject: [Rd] Help finding some code in the R source code
In-Reply-To: <3D39BB5C5071174C8F25FC1EDC3B7D6E1CD186@postie.datamine.co.nz>
References: <3D39BB5C5071174C8F25FC1EDC3B7D6E1CD186@postie.datamine.co.nz>
Message-ID: <D08AEFB8-1804-43DC-8697-56A219895940@r-project.org>

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



[Rd] Help finding some code in the R source code
Simon Urbanek