diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-09 23:35:54 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-09 23:35:54 (GMT) |
commit | ee936a21308679654b2d458166ff094ed735fef7 (patch) | |
tree | 612cd109e8ede4080f58f30ece3212d8e0f996d2 /Include | |
parent | e36561352895170f28f77f0b4ec4292e35d1cc01 (diff) | |
download | cpython-ee936a21308679654b2d458166ff094ed735fef7.zip cpython-ee936a21308679654b2d458166ff094ed735fef7.tar.gz cpython-ee936a21308679654b2d458166ff094ed735fef7.tar.bz2 |
Issue #2335: Backport set literals syntax from Python 3.x.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/Python-ast.h | 16 | ||||
-rw-r--r-- | Include/graminit.h | 25 | ||||
-rw-r--r-- | Include/opcode.h | 13 |
3 files changed, 31 insertions, 23 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h index 3210fc7..f50fb22 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -185,11 +185,11 @@ struct _stmt { }; enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, - IfExp_kind=5, Dict_kind=6, ListComp_kind=7, - GeneratorExp_kind=8, Yield_kind=9, Compare_kind=10, - Call_kind=11, Repr_kind=12, Num_kind=13, Str_kind=14, - Attribute_kind=15, Subscript_kind=16, Name_kind=17, - List_kind=18, Tuple_kind=19}; + 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}; struct _expr { enum _expr_kind kind; union { @@ -226,6 +226,10 @@ struct _expr { } Dict; struct { + asdl_seq *elts; + } Set; + + struct { expr_ty elt; asdl_seq *generators; } ListComp; @@ -449,6 +453,8 @@ expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int #define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4) expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena *arena); +#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3) +expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena); #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); diff --git a/Include/graminit.h b/Include/graminit.h index 6df6509..fdc6481 100644 --- a/Include/graminit.h +++ b/Include/graminit.h @@ -73,15 +73,16 @@ #define exprlist 326 #define testlist 327 #define dictmaker 328 -#define classdef 329 -#define arglist 330 -#define argument 331 -#define list_iter 332 -#define list_for 333 -#define list_if 334 -#define gen_iter 335 -#define gen_for 336 -#define gen_if 337 -#define testlist1 338 -#define encoding_decl 339 -#define yield_expr 340 +#define dictorsetmaker 329 +#define classdef 330 +#define arglist 331 +#define argument 332 +#define list_iter 333 +#define list_for 334 +#define list_if 335 +#define gen_iter 336 +#define gen_for 337 +#define gen_if 338 +#define testlist1 339 +#define encoding_decl 340 +#define yield_expr 341 diff --git a/Include/opcode.h b/Include/opcode.h index 9739782..3824f7f 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -99,13 +99,14 @@ extern "C" { #define LOAD_NAME 101 /* Index in name list */ #define BUILD_TUPLE 102 /* Number of tuple items */ #define BUILD_LIST 103 /* Number of list items */ -#define BUILD_MAP 104 /* Always zero for now */ -#define LOAD_ATTR 105 /* Index in name list */ -#define COMPARE_OP 106 /* Comparison operator */ -#define IMPORT_NAME 107 /* Index in name list */ -#define IMPORT_FROM 108 /* Index in name list */ - +#define BUILD_SET 104 /* Number of set items */ +#define BUILD_MAP 105 /* Always zero for now */ +#define LOAD_ATTR 106 /* Index in name list */ +#define COMPARE_OP 107 /* Comparison operator */ +#define IMPORT_NAME 108 /* Index in name list */ +#define IMPORT_FROM 109 /* Index in name list */ #define JUMP_FORWARD 110 /* Number of bytes to skip */ + #define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning of code */ #define JUMP_IF_TRUE_OR_POP 112 /* "" */ |