[IronPython] Checking syntax of source code without running it

Curt Hagenlocher curt at hagenlocher.org
Thu Jun 11 00:15:07 CEST 2009


Through the hosting API, it's something like this:

engine = IronPython.Hosting.Python.CreateEngine()
source = engine.CreateScriptSourceFromString(text, SourceCodeKind.File)
errors = ErrorListener()
command = source.Compile(errors)
if command is None:
    # compilation failed

Here, ErrorListener is some class that derives
from Microsoft.Scripting.Hosting.ErrorListener and stores the errors.

On Wed, Jun 10, 2009 at 12:52 PM, Harri Vartiainen
<harri.vartiainen at iki.fi>wrote:

> Hi,
>
>  What's the best way to check syntax of IronPython source code without
> actually running it?
>
>  I'd like to embed IronPython to application and make it as user
> friendly as possible, so all checking before running the code would be
> helpful.
>
>  There are many options listed here for CPython:
>
> http://stackoverflow.com/questions/205704/how-can-i-check-the-syntax-of-python-code-in-emacs-without-actually-executing-it
>
>
>
>  Next stop, debugging..
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090610/0ca11f07/attachment.html>


More information about the Ironpython-users mailing list