[Python-checkins] python/dist/src/Python pythonrun.c,2.161,2.161.2.1
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Sun, 07 Jul 2002 10:43:10 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv31177/Python
Modified Files:
Tag: ast-branch
pythonrun.c
Log Message:
New preferred interface to parser is:
PyParser_ASTFromString
PyParser_ASTFromFile
Incorporates logic of theller's pending patch -- filename is passed
as arg to String version.
Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.161
retrieving revision 2.161.2.1
diff -C2 -d -r2.161 -r2.161.2.1
*** pythonrun.c 30 Jun 2002 15:26:10 -0000 2.161
--- pythonrun.c 7 Jul 2002 17:43:08 -0000 2.161.2.1
***************
*** 4,7 ****
--- 4,8 ----
#include "Python.h"
+ #include "Python-ast.h"
#include "grammar.h"
#include "node.h"
***************
*** 11,14 ****
--- 12,16 ----
#include "compile.h"
#include "symtable.h"
+ #include "ast.h"
#include "eval.h"
#include "marshal.h"
***************
*** 1154,1157 ****
--- 1156,1185 ----
PyNode_Free(n);
return st;
+ }
+
+ /* Preferred access to parser is through AST. */
+ mod_ty
+ PyParser_ASTFromString(char *s, char *filename, grammar *g, int start,
+ perrdetail *err_ret, int flags)
+ {
+ node *n;
+ n = PyParser_ParseStringFlags(s, g, start, err_ret, flags);
+ if (n)
+ return PyAST_FromNode(n);
+ else
+ return NULL;
+ }
+
+ mod_ty
+ PyParser_ASTFromFile(FILE *fp, char *filename, grammar *g, int start,
+ char *ps1, char *ps2, perrdetail *err_ret, int flags)
+ {
+ node *n;
+ n = PyParser_ParseFileFlags(fp, filename, g, start, ps1, ps2,
+ err_ret, flags);
+ if (n)
+ return PyAST_FromNode(n);
+ else
+ return NULL;
}