Mercurial > cpython-lru_cache-weakref
diff Include/Python-ast.h @ 58250:edfed0e32ced legacy-trunk
Issue #2333: Backport set and dict comprehensions syntax.
| author | Alexandre Vassalotti <alexandre@peadrop.com> |
|---|---|
| date | Mon, 11 Jan 2010 22:36:12 +0000 |
| parents | c2fdf25329ff |
| children |
line wrap: on
line diff
--- a/Include/Python-ast.h Mon Jan 11 17:15:13 2010 +0000 +++ b/Include/Python-ast.h Mon Jan 11 22:36:12 2010 +0000 @@ -186,10 +186,10 @@ enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, - GeneratorExp_kind=9, Yield_kind=10, Compare_kind=11, - Call_kind=12, Repr_kind=13, Num_kind=14, Str_kind=15, - Attribute_kind=16, Subscript_kind=17, Name_kind=18, - List_kind=19, Tuple_kind=20}; + SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11, + Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15, + Num_kind=16, Str_kind=17, Attribute_kind=18, + Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22}; struct _expr { enum _expr_kind kind; union { @@ -237,6 +237,17 @@ struct { expr_ty elt; asdl_seq *generators; + } SetComp; + + struct { + expr_ty key; + expr_ty value; + asdl_seq *generators; + } DictComp; + + struct { + expr_ty elt; + asdl_seq *generators; } GeneratorExp; struct { @@ -458,6 +469,12 @@ #define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4) expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); +#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4) +expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int + col_offset, PyArena *arena); +#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5) +expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int + lineno, int col_offset, PyArena *arena); #define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena);
