Validating Syntax only with PyParser_SimpleParseString ?
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=). 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++ -- http://mail.python.org/mailman/listinfo/python-list
Re: Validating Syntax only with PyParser_SimpleParseString ?
Thanks for th eanswers so far. But as you can see from the function I use, I do need an interface function to do th ejob from C++. I canno timagine there is no clean way to do this. Calling th epython interpreter to execute a compule function in python and then get the output parsed to get th eerror message i snot an option. The strange thing however is that I have tried to use th ecompile interface function first and this one did return an error. I supposed this was because th ewhole context did not exist so I went to the "parse only" function. The main question I have is what to do with the pointer to the node structure returned by this function, as freeing th epointer with free() throws an error. -- http://mail.python.org/mailman/listinfo/python-list