[Python-checkins] python/dist/src/Modules parsermodule.c,2.81,2.82 (original) (raw)

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Wed May 19 04:20:47 EDT 2004


Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Modules

Modified Files: parsermodule.c Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.)

The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev).

The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.

Index: parsermodule.c

RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -d -r2.81 -r2.82 *** parsermodule.c 20 Nov 2003 01:44:58 -0000 2.81 --- parsermodule.c 19 May 2004 08:20:13 -0000 2.82


*** 856,860 **** VALIDATER(arglist); VALIDATER(argument); VALIDATER(listmaker); VALIDATER(yield_stmt); ! VALIDATER(testlist1);

#undef VALIDATER --- 856,862 ---- VALIDATER(arglist); VALIDATER(argument); VALIDATER(listmaker); VALIDATER(yield_stmt); ! VALIDATER(testlist1); VALIDATER(gen_for); ! VALIDATER(gen_iter); VALIDATER(gen_if); ! VALIDATER(testlist_gexp);

#undef VALIDATER


*** 1247,1250 **** --- 1249,1267 ---- }


*** 1269,1272 **** --- 1286,1311 ---- }


*** 1289,1292 **** --- 1328,1350 ---- }


*** 2188,2192 ****

          if (res && (nch == 3))

! res = validate_testlist(CHILD(tree, 1)); break; case LSQB: --- 2246,2250 ----

          if (res && (nch == 3))

! res = validate_testlist_gexp(CHILD(tree, 1)); break; case LSQB:


*** 2245,2249 ****

  /*

! * list_iter | (',' test)* [','] */ if (nch == 2 && TYPE(CHILD(tree, 1)) == list_for) --- 2303,2307 ----

  /*

! * list_for | (',' test)* [','] */ if (nch == 2 && TYPE(CHILD(tree, 1)) == list_for)


*** 2267,2270 **** --- 2325,2365 ---- }


*** 2319,2322 **** --- 2414,2429 ---- return validate_numnodes(tree, nch + 1, "arglist");


*** 2378,2382 **** /* argument: * ! * [test '='] test / static int --- 2485,2489 ---- / argument: * ! * [test '='] test [gen_for] */ static int


*** 2385,2392 **** int nch = NCH(tree); int res = (validate_ntype(tree, argument) ! && ((nch == 1) || (nch == 3)) && validate_test(CHILD(tree, 0)));

! if (res && (nch == 3)) res = (validate_equal(CHILD(tree, 1)) && validate_test(CHILD(tree, 2))); --- 2492,2501 ---- int nch = NCH(tree); int res = (validate_ntype(tree, argument) ! && ((nch == 1) || (nch == 2) || (nch == 3)) && validate_test(CHILD(tree, 0)));

! if (res && (nch == 2)) ! res = validate_gen_for(CHILD(tree, 1)); ! else if (res && (nch == 3)) res = (validate_equal(CHILD(tree, 1)) && validate_test(CHILD(tree, 2)));



More information about the Python-checkins mailing list