Message-ID: <D08AEFB8-1804-43DC-8697-56A219895940@r-project.org>
Date: 2005-11-14T00:39:05Z
From: Simon Urbanek
Subject: Help finding some code in the R source code
In-Reply-To: <3D39BB5C5071174C8F25FC1EDC3B7D6E1CD186@postie.datamine.co.nz>
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