[Python-checkins] CVS: python/dist/src/Modules parsermodule.c,2.51,2.52

Fred L. Drake python-dev@python.org
Wed, 23 Aug 2000 08:35:29 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv15339/Modules

Modified Files:
	parsermodule.c 
Log Message:

validate_listmaker():  Revise to match Skip's latest changes to the
      Grammar file.  This makes the test suite pass once again.


Index: parsermodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v
retrieving revision 2.51
retrieving revision 2.52
diff -C2 -r2.51 -r2.52
*** parsermodule.c	2000/08/22 01:44:16	2.51
--- parsermodule.c	2000/08/23 15:35:26	2.52
***************
*** 2194,2197 ****
--- 2194,2200 ----
  
  
+ /*  listmaker:
+  *    test ( list_for | (',' test)* [','] )
+  */
  static int
  validate_listmaker(node *tree)
***************
*** 2208,2213 ****
       *  list_iter | (',' test)* [',']
       */
!     if (nch == 2 && TYPE(CHILD(tree, 1)) == list_iter)
!         ok = validate_list_iter(CHILD(tree, 1));
      else {
          /*  (',' test)* [',']  */
--- 2211,2216 ----
       *  list_iter | (',' test)* [',']
       */
!     if (nch == 2 && TYPE(CHILD(tree, 1)) == list_for)
!         ok = validate_list_for(CHILD(tree, 1));
      else {
          /*  (',' test)* [',']  */
***************
*** 2216,2224 ****
              ok = (validate_comma(CHILD(tree, i))
                    && validate_test(CHILD(tree, i+1)));
!             if (ok)
!                 i += 2;
          }
!         if (ok && nch-i)
!             ok = validate_comma(CHILD(tree, nch-1));
      }
      return ok;
--- 2219,2230 ----
              ok = (validate_comma(CHILD(tree, i))
                    && validate_test(CHILD(tree, i+1)));
!             i += 2;
          }
!         if (ok && i == nch-1)
!             ok = validate_comma(CHILD(tree, i));
!         else if (i != nch) {
!             ok = 0;
!             err_string("illegal trailing nodes for listmaker");
!         }
      }
      return ok;