Kaydet (Commit) 02126f20 authored tarafından Fred Drake's avatar Fred Drake

Add support for yield statements.

(Should be merged with descr branch.)
üst 654c8db9
......@@ -830,7 +830,7 @@ VALIDATER(trailer); VALIDATER(subscript);
VALIDATER(subscriptlist); VALIDATER(sliceop);
VALIDATER(exprlist); VALIDATER(dictmaker);
VALIDATER(arglist); VALIDATER(argument);
VALIDATER(listmaker);
VALIDATER(listmaker); VALIDATER(yield_stmt);
#undef VALIDATER
......@@ -1538,6 +1538,18 @@ validate_raise_stmt(node *tree)
}
/* 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)
{
......@@ -2555,6 +2567,7 @@ validate_node(node *tree)
res = (validate_numnodes(tree, 1, "flow_stmt")
&& ((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)));
if (res)
......@@ -2562,6 +2575,9 @@ validate_node(node *tree)
else if (nch == 1)
err_string("illegal flow_stmt type");
break;
case yield_stmt:
res = validate_yield_stmt(tree);
break;
/*
* Compound statements.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment