[Python-checkins] CVS: python/dist/src/Modules parsermodule.c,2.61,2.62
Fred L. Drake
fdrake@users.sourceforge.net
Mon, 16 Jul 2001 19:59:17 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv1365/Modules
Modified Files:
parsermodule.c
Log Message:
Add support for yield statements.
(Should be merged with descr branch.)
Index: parsermodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v
retrieving revision 2.61
retrieving revision 2.62
diff -C2 -r2.61 -r2.62
*** parsermodule.c 2001/06/23 19:55:38 2.61
--- parsermodule.c 2001/07/17 02:59:15 2.62
***************
*** 831,835 ****
VALIDATER(exprlist); VALIDATER(dictmaker);
VALIDATER(arglist); VALIDATER(argument);
! VALIDATER(listmaker);
#undef VALIDATER
--- 831,835 ----
VALIDATER(exprlist); VALIDATER(dictmaker);
VALIDATER(arglist); VALIDATER(argument);
! VALIDATER(listmaker); VALIDATER(yield_stmt);
#undef VALIDATER
***************
*** 1539,1543 ****
--- 1539,1555 ----
+ /* yield_stmt: 'yield' testlist
+ */
static int
+ validate_yield_stmt(node *tree)
+ {
+ return (validate_ntype(tree, yield_stmt)
+ && validate_numnodes(tree, 2, "yield_stmt")
+ && validate_name(CHILD(tree, 0), "yield")
+ && validate_testlist(CHILD(tree, 1)));
+ }
+
+
+ static int
validate_import_as_name(node *tree)
{
***************
*** 2556,2559 ****
--- 2568,2572 ----
&& ((TYPE(CHILD(tree, 0)) == break_stmt)
|| (TYPE(CHILD(tree, 0)) == continue_stmt)
+ || (TYPE(CHILD(tree, 0)) == yield_stmt)
|| (TYPE(CHILD(tree, 0)) == return_stmt)
|| (TYPE(CHILD(tree, 0)) == raise_stmt)));
***************
*** 2562,2565 ****
--- 2575,2581 ----
else if (nch == 1)
err_string("illegal flow_stmt type");
+ break;
+ case yield_stmt:
+ res = validate_yield_stmt(tree);
break;
/*