Validating Syntax only with PyParser_SimpleParseString ?

gaston.gloesener at web.de gaston.gloesener at web.de
Wed Mar 29 08:03:17 EST 2006


I am seeking for a method to parse single lines of Python code (infact
they are only formulas, so I generate a line like RESULT=<formula>). I
do only want to know if the syntax is correct and if there is an error
best would be to know where.

I did find PyParser_SimpleParseString which does return a node
structure. If there is an error it seems to return NULL, while I did
not find this documented.

Th eproblem with this is that first I do not get th elopcation of the
syntax error, and second I don't know what is the proper method to free
the node structure after I got it, since I will not use it. Or is there
any better method doing this anyway.

Environment: Windows / Borland C++




More information about the Python-list mailing list