diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/parsermodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 13fdfae..6ff98de 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -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. */ |