[Python-checkins] python/dist/src/Python ast.c,1.1.2.9,1.1.2.10

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Tue, 01 Oct 2002 12:34:40 -0700


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

Modified Files:
      Tag: ast-branch
	ast.c 
Log Message:
Small step towards parsing arglists:
Handle simple positional arguments.



Index: ast.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -d -r1.1.2.9 -r1.1.2.10
*** ast.c	1 Oct 2002 18:33:47 -0000	1.1.2.9
--- ast.c	1 Oct 2002 19:34:38 -0000	1.1.2.10
***************
*** 807,812 ****
      */
  
      REQ(n, arglist);
!     return Call(func, NULL, NULL, NULL, NULL);
  }
  
--- 807,836 ----
      */
  
+     int i, nargs;
+     asdl_seq *args = NULL;
+ 
      REQ(n, arglist);
! 
!     nargs = 0;
!     for (i = 0; i < NCH(n); i++)
! 	if (TYPE(CHILD(n, i)) == argument)
! 	    nargs++;
! 
!     args = asdl_seq_new(nargs);
!     for (i = 0; i < NCH(n); i++) {
! 	node *ch = CHILD(n, i);
! 	if (TYPE(ch) == argument) {
! 	    expr_ty e;
! 	    if (NCH(ch) == 1)
! 		e = ast_for_expr(CHILD(ch, 0));
! 	    else
! 		e = NULL;
! 	    asdl_seq_SET(args, i / 2, e);
! 	}
!     }
!     
! 
!     /* XXX syntax error if more than 255 arguments */
!     return Call(func, args, NULL, NULL, NULL);
  }