[Python-checkins] python/dist/src/Modules parsermodule.c,2.68,2.69

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 24 May 2002 08:47:08 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv941/Modules

Modified Files:
	parsermodule.c 
Log Message:
Disambiguate the grammar for backtick.
The old syntax suggested that a trailing comma was OK inside backticks,
but in fact (due to ideosyncrasies of pgen) it was not.  Fix the grammar
to avoid the ambiguity.  Fred: you may want to update the refman.

Index: parsermodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v
retrieving revision 2.68
retrieving revision 2.69
diff -C2 -d -r2.68 -r2.69
*** parsermodule.c	8 Dec 2001 18:02:57 -0000	2.68
--- parsermodule.c	24 May 2002 15:47:06 -0000	2.69
***************
*** 845,848 ****
--- 845,849 ----
  VALIDATER(arglist);             VALIDATER(argument);
  VALIDATER(listmaker);           VALIDATER(yield_stmt);
+ VALIDATER(testlist1);
  
  #undef VALIDATER
***************
*** 1058,1061 ****
--- 1059,1070 ----
  
  static int
+ validate_testlist1(node *tree)
+ {
+     return (validate_repeating_list(tree, testlist1,
+                                     validate_test, "testlist1"));
+ }
+ 
+ 
+ static int
  validate_testlist_safe(node *tree)
  {
***************
*** 2186,2190 ****
            case BACKQUOTE:
              res = ((nch == 3)
!                    && validate_testlist(CHILD(tree, 1))
                     && validate_ntype(CHILD(tree, 2), BACKQUOTE));
              break;
--- 2195,2199 ----
            case BACKQUOTE:
              res = ((nch == 3)
!                    && validate_testlist1(CHILD(tree, 1))
                     && validate_ntype(CHILD(tree, 2), BACKQUOTE));
              break;
***************
*** 2671,2674 ****
--- 2680,2686 ----
            case testlist:
              res = validate_testlist(tree);
+             break;
+           case testlist1:
+             res = validate_testlist1(tree);
              break;
            case test: