diff options
author | Guido van Rossum <guido@python.org> | 2006-02-27 22:32:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-02-27 22:32:47 (GMT) |
commit | c2e20744b2b7811632030470971c31630f0975e2 (patch) | |
tree | e97b1c1471fd00e4e5648ed317274c1d9005d2ca /Include/Python-ast.h | |
parent | 5fec904f84a40005f824abe295525a1710056be0 (diff) | |
download | cpython-c2e20744b2b7811632030470971c31630f0975e2.zip cpython-c2e20744b2b7811632030470971c31630f0975e2.tar.gz cpython-c2e20744b2b7811632030470971c31630f0975e2.tar.bz2 |
PEP 343 -- the with-statement.
This was started by Mike Bland and completed by Guido
(with help from Neal).
This still needs a __future__ statement added;
Thomas is working on Michael's patch for that aspect.
There's a small amount of code cleanup and refactoring
in ast.c, compile.c and ceval.c (I fixed the lltrace
behavior when EXT_POP is used -- however I had to make
lltrace a static global).
Diffstat (limited to 'Include/Python-ast.h')
-rw-r--r-- | Include/Python-ast.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h index 2059b3c..3c5677c 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -61,11 +61,11 @@ struct _mod { struct _stmt { enum { FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3, Delete_kind=4, Assign_kind=5, AugAssign_kind=6, Print_kind=7, - For_kind=8, While_kind=9, If_kind=10, Raise_kind=11, - TryExcept_kind=12, TryFinally_kind=13, Assert_kind=14, - Import_kind=15, ImportFrom_kind=16, Exec_kind=17, - Global_kind=18, Expr_kind=19, Pass_kind=20, Break_kind=21, - Continue_kind=22 } kind; + For_kind=8, While_kind=9, If_kind=10, With_kind=11, + Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14, + Assert_kind=15, Import_kind=16, ImportFrom_kind=17, + Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21, + Break_kind=22, Continue_kind=23 } kind; union { struct { identifier name; @@ -125,6 +125,12 @@ struct _stmt { } If; struct { + expr_ty context_expr; + expr_ty optional_vars; + asdl_seq *body; + } With; + + struct { expr_ty type; expr_ty inst; expr_ty tback; @@ -355,6 +361,8 @@ stmt_ty While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, PyArena *arena); stmt_ty If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, PyArena *arena); +stmt_ty With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int + lineno, PyArena *arena); stmt_ty Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, PyArena *arena); stmt_ty TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int |