[Python-checkins] python/dist/src/Python ast.c,1.1.2.3,1.1.2.4
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Tue, 03 Sep 2002 16:19:25 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv2784
Modified Files:
Tag: ast-branch
ast.c
Log Message:
Handle single_input correctly following new Interactive definition.
Index: ast.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** ast.c 30 Aug 2002 20:12:05 -0000 1.1.2.3
--- ast.c 3 Sep 2002 23:19:23 -0000 1.1.2.4
***************
*** 126,133 ****
break;
case single_input:
! if (TYPE(CHILD(n, 0)) == NEWLINE)
! return Interactive(Pass(n->n_lineno));
! else
! return Interactive(ast_for_stmt(CHILD(n, 0)));
default:
goto error;
--- 126,157 ----
break;
case single_input:
! if (TYPE(CHILD(n, 0)) == NEWLINE) {
! stmts = asdl_seq_new(1);
! if (!stmts)
! return NULL;
! asdl_seq_SET(stmts, 0, Pass(n->n_lineno));
! return Interactive(stmts);
! }
! else {
! n = CHILD(n, 0);
! num = num_stmts(n);
! stmts = asdl_seq_new(num);
! if (!stmts)
! return NULL;
! if (num == 1)
! asdl_seq_SET(stmts, 0, ast_for_stmt(n));
! else {
! /* Only a simple_stmt can contain multiple statements. */
! REQ(n, simple_stmt);
! for (i = 0; i < NCH(n); i += 2) {
! stmt_ty s = ast_for_stmt(CHILD(n, i));
! if (!s)
! goto error;
! asdl_seq_SET(stmts, i / 2, s);
! }
! }
!
! return Interactive(stmts);
! }
default:
goto error;