diff options
-rw-r--r-- | Doc/ref/ref5.tex | 11 | ||||
-rw-r--r-- | Grammar/Grammar | 15 | ||||
-rw-r--r-- | Include/Python-ast.h | 16 | ||||
-rw-r--r-- | Include/graminit.h | 77 | ||||
-rw-r--r-- | Lib/test/test_grammar.py | 25 | ||||
-rw-r--r-- | Parser/Python.asdl | 1 | ||||
-rw-r--r-- | Python/Python-ast.c | 58 | ||||
-rw-r--r-- | Python/ast.c | 40 | ||||
-rw-r--r-- | Python/compile.c | 26 | ||||
-rw-r--r-- | Python/graminit.c | 1096 | ||||
-rw-r--r-- | Python/symtable.c | 5 |
11 files changed, 803 insertions, 567 deletions
diff --git a/Doc/ref/ref5.tex b/Doc/ref/ref5.tex index 462548f..65a3cff 100644 --- a/Doc/ref/ref5.tex +++ b/Doc/ref/ref5.tex @@ -155,8 +155,7 @@ square brackets: \begin{productionlist} \production{test} - {\token{and_test} ( "or" \token{and_test} )* - | \token{lambda_form}} + {\token{or_test} | \token{lambda_form}} \production{testlist} {\token{test} ( "," \token{test} )* [ "," ]} \production{list_display} @@ -1017,7 +1016,8 @@ Boolean operations have the lowest priority of all Python operations: \begin{productionlist} \production{expression} - {\token{or_test} | \token{lambda_form}} + {\token{or_test} [\token{if} \token{or_test} \token{else} + \token{test}] | \token{lambda_form}} \production{or_test} {\token{and_test} | \token{or_test} "or" \token{and_test}} \production{and_test} @@ -1036,6 +1036,11 @@ The operator \keyword{not} yields \code{True} if its argument is false, \code{False} otherwise. \opindex{not} +The expression \code{\var{x} if \var{C} else \var{y}} first evaluates +\var{C} (\emph{not} \var{x}); if \var{C} is true, \var{x} is evaluated and +its value is returned; otherwise, \var{y} is evaluated and its value is +returned. + The expression \code{\var{x} and \var{y}} first evaluates \var{x}; if \var{x} is false, its value is returned; otherwise, \var{y} is evaluated and the resulting value is returned. diff --git a/Grammar/Grammar b/Grammar/Grammar index 666ff44..b11f33e 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -83,7 +83,17 @@ try_stmt: ('try' ':' suite except_clause: 'except' [test [',' test]] suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT -test: and_test ('or' and_test)* | lambdef +# Backward compatibility cruft to support: +# [ x for x in lambda: True, lambda: False if x() ] +# even while also allowing: +# lambda x: 5 if x else 2 +# (But not a mix of the two) +testlist_safe: old_test [(',' old_test)+ [',']] +old_test: or_test | old_lambdef +old_lambdef: 'lambda' [varargslist] ':' old_test + +test: or_test ['if' or_test 'else' test] | lambdef +or_test: and_test ('or' and_test)* and_test: not_test ('and' not_test)* not_test: 'not' not_test | comparison comparison: expr (comp_op expr)* @@ -110,7 +120,6 @@ subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] sliceop: ':' [test] exprlist: expr (',' expr)* [','] testlist: test (',' test)* [','] -testlist_safe: test [(',' test)+ [',']] dictmaker: test ':' test (',' test ':' test)* [','] classdef: 'class' NAME ['(' [testlist] ')'] ':' suite @@ -123,7 +132,7 @@ list_for: 'for' exprlist 'in' testlist_safe [list_iter] list_if: 'if' test [list_iter] gen_iter: gen_for | gen_if -gen_for: 'for' exprlist 'in' test [gen_iter] +gen_for: 'for' exprlist 'in' or_test [gen_iter] gen_if: 'if' test [gen_iter] testlist1: test (',' test)* diff --git a/Include/Python-ast.h b/Include/Python-ast.h index 3f07452..2059b3c 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -175,10 +175,10 @@ struct _stmt { struct _expr { enum { BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, - Dict_kind=5, ListComp_kind=6, GeneratorExp_kind=7, Yield_kind=8, - Compare_kind=9, Call_kind=10, Repr_kind=11, Num_kind=12, - Str_kind=13, Attribute_kind=14, Subscript_kind=15, Name_kind=16, - List_kind=17, Tuple_kind=18 } kind; + 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 } kind; union { struct { boolop_ty op; @@ -202,6 +202,12 @@ struct _expr { } Lambda; struct { + expr_ty test; + expr_ty body; + expr_ty orelse; + } IfExp; + + struct { asdl_seq *keys; asdl_seq *values; } Dict; @@ -371,6 +377,8 @@ expr_ty BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, PyArena *arena); expr_ty UnaryOp(unaryop_ty op, expr_ty operand, int lineno, PyArena *arena); expr_ty Lambda(arguments_ty args, expr_ty body, int lineno, PyArena *arena); +expr_ty IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, PyArena + *arena); expr_ty Dict(asdl_seq * keys, asdl_seq * values, int lineno, PyArena *arena); expr_ty ListComp(expr_ty elt, asdl_seq * generators, int lineno, PyArena *arena); diff --git a/Include/graminit.h b/Include/graminit.h index 2c855ea..e804734 100644 --- a/Include/graminit.h +++ b/Include/graminit.h @@ -40,40 +40,43 @@ #define try_stmt 295 #define except_clause 296 #define suite 297 -#define test 298 -#define and_test 299 -#define not_test 300 -#define comparison 301 -#define comp_op 302 -#define expr 303 -#define xor_expr 304 -#define and_expr 305 -#define shift_expr 306 -#define arith_expr 307 -#define term 308 -#define factor 309 -#define power 310 -#define atom 311 -#define listmaker 312 -#define testlist_gexp 313 -#define lambdef 314 -#define trailer 315 -#define subscriptlist 316 -#define subscript 317 -#define sliceop 318 -#define exprlist 319 -#define testlist 320 -#define testlist_safe 321 -#define dictmaker 322 -#define classdef 323 -#define arglist 324 -#define argument 325 -#define list_iter 326 -#define list_for 327 -#define list_if 328 -#define gen_iter 329 -#define gen_for 330 -#define gen_if 331 -#define testlist1 332 -#define encoding_decl 333 -#define yield_expr 334 +#define testlist_safe 298 +#define old_test 299 +#define old_lambdef 300 +#define test 301 +#define or_test 302 +#define and_test 303 +#define not_test 304 +#define comparison 305 +#define comp_op 306 +#define expr 307 +#define xor_expr 308 +#define and_expr 309 +#define shift_expr 310 +#define arith_expr 311 +#define term 312 +#define factor 313 +#define power 314 +#define atom 315 +#define listmaker 316 +#define testlist_gexp 317 +#define lambdef 318 +#define trailer 319 +#define subscriptlist 320 +#define subscript 321 +#define sliceop 322 +#define exprlist 323 +#define testlist 324 +#define dictmaker 325 +#define classdef 326 +#define arglist 327 +#define argument 328 +#define list_iter 329 +#define list_for 330 +#define list_if 331 +#define gen_iter 332 +#define gen_for 333 +#define gen_if 334 +#define testlist1 335 +#define encoding_decl 336 +#define yield_expr 337 diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index aa76b44..0d2d925 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -798,3 +798,28 @@ verify(len(list(g)) == 10) x = 10; t = False; g = ((i,j) for i in range(x) if t for j in range(x)) x = 5; t = True; verify([(i,j) for i in range(10) for j in range(5)] == list(g)) + +# Test ifelse expressions in various cases +def _checkeval(msg, ret): + "helper to check that evaluation of expressions is done correctly" + print x + return ret + +verify([ x() for x in lambda: True, lambda: False if x() ] == [True]) +verify([ x() for x in (lambda: True, lambda: False) if x() ] == [True]) +verify([ x(False) for x in (lambda x: False if x else True, lambda x: True if x else False) if x(False) ] == [True]) +verify((5 if 1 else _checkeval("check 1", 0)) == 5) +verify((_checkeval("check 2", 0) if 0 else 5) == 5) +verify((5 and 6 if 0 else 1) == 1) +verify(((5 and 6) if 0 else 1) == 1) +verify((5 and (6 if 1 else 1)) == 6) +verify((0 or _checkeval("check 3", 2) if 0 else 3) == 3) +verify((1 or _checkeval("check 4", 2) if 1 else _checkeval("check 5", 3)) == 1) +verify((0 or 5 if 1 else _checkeval("check 6", 3)) == 5) +verify((not 5 if 1 else 1) == False) +verify((not 5 if 0 else 1) == 1) +verify((6 + 1 if 1 else 2) == 7) +verify((6 - 1 if 1 else 2) == 5) +verify((6 * 2 if 1 else 4) == 12) +verify((6 / 2 if 1 else 3) == 3) +verify((6 < 4 if 0 else 2) == 2) diff --git a/Parser/Python.asdl b/Parser/Python.asdl index b0d383f..1b7e698 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -52,6 +52,7 @@ module Python | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) | Lambda(arguments args, expr body) + | IfExp(expr test, expr body, expr orelse) | Dict(expr* keys, expr* values) | ListComp(expr elt, comprehension* generators) | GeneratorExp(expr elt, comprehension* generators) diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 6935851..8d148e3 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -151,6 +151,12 @@ char *Lambda_fields[]={ "args", "body", }; +PyTypeObject *IfExp_type; +char *IfExp_fields[]={ + "test", + "body", + "orelse", +}; PyTypeObject *Dict_type; char *Dict_fields[]={ "keys", @@ -431,6 +437,7 @@ static int init_types(void) BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3); UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2); Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2); + IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3); Dict_type = make_type("Dict", expr_type, Dict_fields, 2); ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2); GeneratorExp_type = make_type("GeneratorExp", expr_type, @@ -1138,6 +1145,38 @@ Lambda(arguments_ty args, expr_ty body, int lineno, PyArena *arena) } expr_ty +IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, PyArena *arena) +{ + expr_ty p; + if (!test) { + PyErr_SetString(PyExc_ValueError, + "field test is required for IfExp"); + return NULL; + } + if (!body) { + PyErr_SetString(PyExc_ValueError, + "field body is required for IfExp"); + return NULL; + } + if (!orelse) { + PyErr_SetString(PyExc_ValueError, + "field orelse is required for IfExp"); + return NULL; + } + p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) { + PyErr_NoMemory(); + return NULL; + } + p->kind = IfExp_kind; + p->v.IfExp.test = test; + p->v.IfExp.body = body; + p->v.IfExp.orelse = orelse; + p->lineno = lineno; + return p; +} + +expr_ty Dict(asdl_seq * keys, asdl_seq * values, int lineno, PyArena *arena) { expr_ty p; @@ -2077,6 +2116,25 @@ ast2obj_expr(void* _o) goto failed; Py_DECREF(value); break; + case IfExp_kind: + result = PyType_GenericNew(IfExp_type, NULL, NULL); + if (!result) goto failed; + value = ast2obj_expr(o->v.IfExp.test); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "test", value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_expr(o->v.IfExp.body); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "body", value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_expr(o->v.IfExp.orelse); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "orelse", value) == -1) + goto failed; + Py_DECREF(value); + break; case Dict_kind: result = PyType_GenericNew(Dict_type, NULL, NULL); if (!result) goto failed; diff --git a/Python/ast.c b/Python/ast.c index 5d91344..94c877d 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -847,6 +847,25 @@ ast_for_lambdef(struct compiling *c, const node *n) return Lambda(args, expression, LINENO(n), c->c_arena); } +static expr_ty +ast_for_ifexpr(struct compiling *c, const node *n) +{ + /* test: or_test 'if' or_test 'else' test */ + expr_ty expression, body, orelse; + + assert(NCH(n) >= 3); + body = ast_for_expr(c, CHILD(n, 0)); + if (!body) + return NULL; + expression = ast_for_expr(c, CHILD(n, 2)); + if (!expression) + return NULL; + orelse = ast_for_expr(c, CHILD(n, 4)); + if (!orelse) + return NULL; + return IfExp(expression, body, orelse, LINENO(n), c->c_arena); +} + /* Count the number of 'for' loop in a list comprehension. Helper for ast_for_listcomp(). @@ -1456,7 +1475,8 @@ static expr_ty ast_for_expr(struct compiling *c, const node *n) { /* handle the full range of simple expressions - test: and_test ('or' and_test)* | lambdef + test: or_test ['if' or_test 'else' test] | lambdef + or_test: and_test ('or' and_test)* and_test: not_test ('and' not_test)* not_test: 'not' not_test | comparison comparison: expr (comp_op expr)* @@ -1468,6 +1488,15 @@ ast_for_expr(struct compiling *c, const node *n) term: factor (('*'|'/'|'%'|'//') factor)* factor: ('+'|'-'|'~') factor | power power: atom trailer* ('**' factor)* + + As well as modified versions that exist for backward compatibility, + to explicitly allow: + [ x for x in lambda: 0, lambda: 1 ] + (which would be ambiguous without these extra rules) + + old_test: or_test | old_lambdef + old_lambdef: 'lambda' [vararglist] ':' old_test + */ asdl_seq *seq; @@ -1476,9 +1505,14 @@ ast_for_expr(struct compiling *c, const node *n) loop: switch (TYPE(n)) { case test: - if (TYPE(CHILD(n, 0)) == lambdef) + case old_test: + if (TYPE(CHILD(n, 0)) == lambdef || + TYPE(CHILD(n, 0)) == old_lambdef) return ast_for_lambdef(c, CHILD(n, 0)); - /* Fall through to and_test */ + else if (NCH(n) > 1) + return ast_for_ifexpr(c, n); + /* Fallthrough */ + case or_test: case and_test: if (NCH(n) == 1) { n = CHILD(n, 0); diff --git a/Python/compile.c b/Python/compile.c index e743168..0e8e50c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2010,6 +2010,30 @@ compiler_class(struct compiler *c, stmt_ty s) } static int +compiler_ifexp(struct compiler *c, expr_ty e) +{ + basicblock *end, *next; + + assert(e->kind == IfExp_kind); + end = compiler_new_block(c); + if (end == NULL) + return 0; + next = compiler_new_block(c); + if (next == NULL) + return 0; + VISIT(c, expr, e->v.IfExp.test); + ADDOP_JREL(c, JUMP_IF_FALSE, next); + ADDOP(c, POP_TOP); + VISIT(c, expr, e->v.IfExp.body); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, next); + ADDOP(c, POP_TOP); + VISIT(c, expr, e->v.IfExp.orelse); + compiler_use_next_block(c, end); + return 1; +} + +static int compiler_lambda(struct compiler *c, expr_ty e) { PyCodeObject *co; @@ -3290,6 +3314,8 @@ compiler_visit_expr(struct compiler *c, expr_ty e) break; case Lambda_kind: return compiler_lambda(c, e); + case IfExp_kind: + return compiler_ifexp(c, e); case Dict_kind: /* XXX get rid of arg? */ ADDOP_I(c, BUILD_MAP, 0); diff --git a/Python/graminit.c b/Python/graminit.c index 64fbc2e..faca879 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -924,669 +924,665 @@ static state states_41[5] = { {1, arcs_41_3}, {2, arcs_41_4}, }; -static arc arcs_42_0[2] = { - {100, 1}, - {102, 2}, +static arc arcs_42_0[1] = { + {101, 1}, }; static arc arcs_42_1[2] = { - {101, 3}, + {27, 2}, {0, 1}, }; static arc arcs_42_2[1] = { - {0, 2}, + {101, 3}, }; -static arc arcs_42_3[1] = { - {100, 1}, +static arc arcs_42_3[2] = { + {27, 4}, + {0, 3}, }; -static state states_42[4] = { - {2, arcs_42_0}, +static arc arcs_42_4[2] = { + {101, 3}, + {0, 4}, +}; +static state states_42[5] = { + {1, arcs_42_0}, {2, arcs_42_1}, {1, arcs_42_2}, - {1, arcs_42_3}, + {2, arcs_42_3}, + {2, arcs_42_4}, }; -static arc arcs_43_0[1] = { +static arc arcs_43_0[2] = { + {102, 1}, {103, 1}, }; -static arc arcs_43_1[2] = { - {104, 0}, +static arc arcs_43_1[1] = { {0, 1}, }; static state states_43[2] = { - {1, arcs_43_0}, - {2, arcs_43_1}, + {2, arcs_43_0}, + {1, arcs_43_1}, }; -static arc arcs_44_0[2] = { - {105, 1}, - {106, 2}, +static arc arcs_44_0[1] = { + {104, 1}, }; -static arc arcs_44_1[1] = { - {103, 2}, +static arc arcs_44_1[2] = { + {23, 2}, + {21, 3}, }; static arc arcs_44_2[1] = { - {0, 2}, + {21, 3}, +}; +static arc arcs_44_3[1] = { + {101, 4}, }; -static state states_44[3] = { - {2, arcs_44_0}, - {1, arcs_44_1}, +static arc arcs_44_4[1] = { + {0, 4}, +}; +static state states_44[5] = { + {1, arcs_44_0}, + {2, arcs_44_1}, {1, arcs_44_2}, + {1, arcs_44_3}, + {1, arcs_44_4}, }; -static arc arcs_45_0[1] = { - {81, 1}, +static arc arcs_45_0[2] = { + {102, 1}, + {105, 2}, }; static arc arcs_45_1[2] = { - {107, 0}, + {89, 3}, {0, 1}, }; -static state states_45[2] = { - {1, arcs_45_0}, - {2, arcs_45_1}, +static arc arcs_45_2[1] = { + {0, 2}, }; -static arc arcs_46_0[10] = { - {108, 1}, - {109, 1}, - {110, 1}, - {111, 1}, - {112, 1}, - {113, 1}, - {114, 1}, - {82, 1}, - {105, 2}, - {115, 3}, +static arc arcs_45_3[1] = { + {102, 4}, }; -static arc arcs_46_1[1] = { - {0, 1}, +static arc arcs_45_4[1] = { + {91, 5}, }; -static arc arcs_46_2[1] = { - {82, 1}, +static arc arcs_45_5[1] = { + {26, 2}, }; -static arc arcs_46_3[2] = { - {105, 1}, - {0, 3}, +static state states_45[6] = { + {2, arcs_45_0}, + {2, arcs_45_1}, + {1, arcs_45_2}, + {1, arcs_45_3}, + {1, arcs_45_4}, + {1, arcs_45_5}, }; -static state states_46[4] = { - {10, arcs_46_0}, - {1, arcs_46_1}, - {1, arcs_46_2}, - {2, arcs_46_3}, +static arc arcs_46_0[1] = { + {106, 1}, +}; +static arc arcs_46_1[2] = { + {107, 0}, + {0, 1}, +}; +static state states_46[2] = { + {1, arcs_46_0}, + {2, arcs_46_1}, }; static arc arcs_47_0[1] = { - {116, 1}, + {108, 1}, }; static arc arcs_47_1[2] = { - {117, 0}, + {109, 0}, {0, 1}, }; static state states_47[2] = { {1, arcs_47_0}, {2, arcs_47_1}, }; -static arc arcs_48_0[1] = { - {118, 1}, +static arc arcs_48_0[2] = { + {110, 1}, + {111, 2}, }; -static arc arcs_48_1[2] = { - {119, 0}, - {0, 1}, +static arc arcs_48_1[1] = { + {108, 2}, +}; +static arc arcs_48_2[1] = { + {0, 2}, }; -static state states_48[2] = { - {1, arcs_48_0}, - {2, arcs_48_1}, +static state states_48[3] = { + {2, arcs_48_0}, + {1, arcs_48_1}, + {1, arcs_48_2}, }; static arc arcs_49_0[1] = { - {120, 1}, + {81, 1}, }; static arc arcs_49_1[2] = { - {121, 0}, + {112, 0}, {0, 1}, }; static state states_49[2] = { {1, arcs_49_0}, {2, arcs_49_1}, }; -static arc arcs_50_0[1] = { - {122, 1}, +static arc arcs_50_0[10] = { + {113, 1}, + {114, 1}, + {115, 1}, + {116, 1}, + {117, 1}, + {118, 1}, + {119, 1}, + {82, 1}, + {110, 2}, + {120, 3}, }; -static arc arcs_50_1[3] = { - {123, 0}, - {57, 0}, +static arc arcs_50_1[1] = { {0, 1}, }; -static state states_50[2] = { - {1, arcs_50_0}, - {3, arcs_50_1}, +static arc arcs_50_2[1] = { + {82, 1}, +}; +static arc arcs_50_3[2] = { + {110, 1}, + {0, 3}, +}; +static state states_50[4] = { + {10, arcs_50_0}, + {1, arcs_50_1}, + {1, arcs_50_2}, + {2, arcs_50_3}, }; static arc arcs_51_0[1] = { - {124, 1}, + {121, 1}, }; -static arc arcs_51_1[3] = { - {125, 0}, - {126, 0}, +static arc arcs_51_1[2] = { + {122, 0}, {0, 1}, }; static state states_51[2] = { {1, arcs_51_0}, - {3, arcs_51_1}, + {2, arcs_51_1}, }; static arc arcs_52_0[1] = { - {127, 1}, + {123, 1}, }; -static arc arcs_52_1[5] = { - {28, 0}, - {128, 0}, - {129, 0}, - {130, 0}, +static arc arcs_52_1[2] = { + {124, 0}, {0, 1}, }; static state states_52[2] = { {1, arcs_52_0}, - {5, arcs_52_1}, + {2, arcs_52_1}, }; -static arc arcs_53_0[4] = { +static arc arcs_53_0[1] = { {125, 1}, - {126, 1}, +}; +static arc arcs_53_1[2] = { + {126, 0}, + {0, 1}, +}; +static state states_53[2] = { + {1, arcs_53_0}, + {2, arcs_53_1}, +}; +static arc arcs_54_0[1] = { + {127, 1}, +}; +static arc arcs_54_1[3] = { + {128, 0}, + {57, 0}, + {0, 1}, +}; +static state states_54[2] = { + {1, arcs_54_0}, + {3, arcs_54_1}, +}; +static arc arcs_55_0[1] = { + {129, 1}, +}; +static arc arcs_55_1[3] = { + {130, 0}, + {131, 0}, + {0, 1}, +}; +static state states_55[2] = { + {1, arcs_55_0}, + {3, arcs_55_1}, +}; +static arc arcs_56_0[1] = { + {132, 1}, +}; +static arc arcs_56_1[5] = { + {28, 0}, + {133, 0}, + {134, 0}, + {135, 0}, + {0, 1}, +}; +static state states_56[2] = { + {1, arcs_56_0}, + {5, arcs_56_1}, +}; +static arc arcs_57_0[4] = { + {130, 1}, {131, 1}, - {132, 2}, + {136, 1}, + {137, 2}, }; -static arc arcs_53_1[1] = { - {127, 2}, +static arc arcs_57_1[1] = { + {132, 2}, }; -static arc arcs_53_2[1] = { +static arc arcs_57_2[1] = { {0, 2}, }; -static state states_53[3] = { - {4, arcs_53_0}, - {1, arcs_53_1}, - {1, arcs_53_2}, +static state states_57[3] = { + {4, arcs_57_0}, + {1, arcs_57_1}, + {1, arcs_57_2}, }; -static arc arcs_54_0[1] = { - {133, 1}, +static arc arcs_58_0[1] = { + {138, 1}, }; -static arc arcs_54_1[3] = { - {134, 1}, +static arc arcs_58_1[3] = { + {139, 1}, {29, 2}, {0, 1}, }; -static arc arcs_54_2[1] = { - {127, 3}, +static arc arcs_58_2[1] = { + {132, 3}, }; -static arc arcs_54_3[1] = { +static arc arcs_58_3[1] = { {0, 3}, }; -static state states_54[4] = { - {1, arcs_54_0}, - {3, arcs_54_1}, - {1, arcs_54_2}, - {1, arcs_54_3}, +static state states_58[4] = { + {1, arcs_58_0}, + {3, arcs_58_1}, + {1, arcs_58_2}, + {1, arcs_58_3}, }; -static arc arcs_55_0[7] = { +static arc arcs_59_0[7] = { {13, 1}, - {136, 2}, - {139, 3}, - {142, 4}, + {141, 2}, + {144, 3}, + {147, 4}, {19, 5}, - {144, 5}, - {145, 6}, + {149, 5}, + {150, 6}, }; -static arc arcs_55_1[3] = { +static arc arcs_59_1[3] = { {43, 7}, - {135, 7}, + {140, 7}, {15, 5}, }; -static arc arcs_55_2[2] = { - {137, 8}, - {138, 5}, +static arc arcs_59_2[2] = { + {142, 8}, + {143, 5}, }; -static arc arcs_55_3[2] = { - {140, 9}, - {141, 5}, +static arc arcs_59_3[2] = { + {145, 9}, + {146, 5}, }; -static arc arcs_55_4[1] = { - {143, 10}, +static arc arcs_59_4[1] = { + {148, 10}, }; -static arc arcs_55_5[1] = { +static arc arcs_59_5[1] = { {0, 5}, }; -static arc arcs_55_6[2] = { - {145, 6}, +static arc arcs_59_6[2] = { + {150, 6}, {0, 6}, }; -static arc arcs_55_7[1] = { +static arc arcs_59_7[1] = { {15, 5}, }; -static arc arcs_55_8[1] = { - {138, 5}, +static arc arcs_59_8[1] = { + {143, 5}, }; -static arc arcs_55_9[1] = { - {141, 5}, +static arc arcs_59_9[1] = { + {146, 5}, }; -static arc arcs_55_10[1] = { - {142, 5}, +static arc arcs_59_10[1] = { + {147, 5}, }; -static state states_55[11] = { - {7, arcs_55_0}, - {3, arcs_55_1}, - {2, arcs_55_2}, - {2, arcs_55_3}, - {1, arcs_55_4}, - {1, arcs_55_5}, - {2, arcs_55_6}, - {1, arcs_55_7}, - {1, arcs_55_8}, - {1, arcs_55_9}, - {1, arcs_55_10}, +static state states_59[11] = { + {7, arcs_59_0}, + {3, arcs_59_1}, + {2, arcs_59_2}, + {2, arcs_59_3}, + {1, arcs_59_4}, + {1, arcs_59_5}, + {2, arcs_59_6}, + {1, arcs_59_7}, + {1, arcs_59_8}, + {1, arcs_59_9}, + {1, arcs_59_10}, }; -static arc arcs_56_0[1] = { +static arc arcs_60_0[1] = { {26, 1}, }; -static arc arcs_56_1[3] = { - {146, 2}, +static arc arcs_60_1[3] = { + {151, 2}, {27, 3}, {0, 1}, }; -static arc arcs_56_2[1] = { +static arc arcs_60_2[1] = { {0, 2}, }; -static arc arcs_56_3[2] = { +static arc arcs_60_3[2] = { {26, 4}, {0, 3}, }; -static arc arcs_56_4[2] = { +static arc arcs_60_4[2] = { {27, 3}, {0, 4}, }; -static state states_56[5] = { - {1, arcs_56_0}, - {3, arcs_56_1}, - {1, arcs_56_2}, - {2, arcs_56_3}, - {2, arcs_56_4}, +static state states_60[5] = { + {1, arcs_60_0}, + {3, arcs_60_1}, + {1, arcs_60_2}, + {2, arcs_60_3}, + {2, arcs_60_4}, }; -static arc arcs_57_0[1] = { +static arc arcs_61_0[1] = { {26, 1}, }; -static arc arcs_57_1[3] = { - {147, 2}, +static arc arcs_61_1[3] = { + {152, 2}, {27, 3}, {0, 1}, }; -static arc arcs_57_2[1] = { +static arc arcs_61_2[1] = { {0, 2}, }; -static arc arcs_57_3[2] = { +static arc arcs_61_3[2] = { {26, 4}, {0, 3}, }; -static arc arcs_57_4[2] = { +static arc arcs_61_4[2] = { {27, 3}, {0, 4}, }; -static state states_57[5] = { - {1, arcs_57_0}, - {3, arcs_57_1}, - {1, arcs_57_2}, - {2, arcs_57_3}, - {2, arcs_57_4}, +static state states_61[5] = { + {1, arcs_61_0}, + {3, arcs_61_1}, + {1, arcs_61_2}, + {2, arcs_61_3}, + {2, arcs_61_4}, }; -static arc arcs_58_0[1] = { - {148, 1}, +static arc arcs_62_0[1] = { + {104, 1}, }; -static arc arcs_58_1[2] = { +static arc arcs_62_1[2] = { {23, 2}, {21, 3}, }; -static arc arcs_58_2[1] = { +static arc arcs_62_2[1] = { {21, 3}, }; -static arc arcs_58_3[1] = { +static arc arcs_62_3[1] = { {26, 4}, }; -static arc arcs_58_4[1] = { +static arc arcs_62_4[1] = { {0, 4}, }; -static state states_58[5] = { - {1, arcs_58_0}, - {2, arcs_58_1}, - {1, arcs_58_2}, - {1, arcs_58_3}, - {1, arcs_58_4}, +static state states_62[5] = { + {1, arcs_62_0}, + {2, arcs_62_1}, + {1, arcs_62_2}, + {1, arcs_62_3}, + {1, arcs_62_4}, }; -static arc arcs_59_0[3] = { +static arc arcs_63_0[3] = { {13, 1}, - {136, 2}, + {141, 2}, {75, 3}, }; -static arc arcs_59_1[2] = { +static arc arcs_63_1[2] = { {14, 4}, {15, 5}, }; -static arc arcs_59_2[1] = { - {149, 6}, +static arc arcs_63_2[1] = { + {153, 6}, }; -static arc arcs_59_3[1] = { +static arc arcs_63_3[1] = { {19, 5}, }; -static arc arcs_59_4[1] = { +static arc arcs_63_4[1] = { {15, 5}, }; -static arc arcs_59_5[1] = { +static arc arcs_63_5[1] = { {0, 5}, }; -static arc arcs_59_6[1] = { - {138, 5}, +static arc arcs_63_6[1] = { + {143, 5}, }; -static state states_59[7] = { - {3, arcs_59_0}, - {2, arcs_59_1}, - {1, arcs_59_2}, - {1, arcs_59_3}, - {1, arcs_59_4}, - {1, arcs_59_5}, - {1, arcs_59_6}, +static state states_63[7] = { + {3, arcs_63_0}, + {2, arcs_63_1}, + {1, arcs_63_2}, + {1, arcs_63_3}, + {1, arcs_63_4}, + {1, arcs_63_5}, + {1, arcs_63_6}, }; -static arc arcs_60_0[1] = { - {150, 1}, +static arc arcs_64_0[1] = { + {154, 1}, }; -static arc arcs_60_1[2] = { +static arc arcs_64_1[2] = { {27, 2}, {0, 1}, }; -static arc arcs_60_2[2] = { - {150, 1}, +static arc arcs_64_2[2] = { + {154, 1}, {0, 2}, }; -static state states_60[3] = { - {1, arcs_60_0}, - {2, arcs_60_1}, - {2, arcs_60_2}, +static state states_64[3] = { + {1, arcs_64_0}, + {2, arcs_64_1}, + {2, arcs_64_2}, }; -static arc arcs_61_0[3] = { +static arc arcs_65_0[3] = { {75, 1}, {26, 2}, {21, 3}, }; -static arc arcs_61_1[1] = { +static arc arcs_65_1[1] = { {75, 4}, }; -static arc arcs_61_2[2] = { +static arc arcs_65_2[2] = { {21, 3}, {0, 2}, }; -static arc arcs_61_3[3] = { +static arc arcs_65_3[3] = { {26, 5}, - {151, 6}, + {155, 6}, {0, 3}, }; -static arc arcs_61_4[1] = { +static arc arcs_65_4[1] = { {75, 6}, }; -static arc arcs_61_5[2] = { - {151, 6}, +static arc arcs_65_5[2] = { + {155, 6}, {0, 5}, }; -static arc arcs_61_6[1] = { +static arc arcs_65_6[1] = { {0, 6}, }; -static state states_61[7] = { - {3, arcs_61_0}, - {1, arcs_61_1}, - {2, arcs_61_2}, - {3, arcs_61_3}, - {1, arcs_61_4}, - {2, arcs_61_5}, - {1, arcs_61_6}, +static state states_65[7] = { + {3, arcs_65_0}, + {1, arcs_65_1}, + {2, arcs_65_2}, + {3, arcs_65_3}, + {1, arcs_65_4}, + {2, arcs_65_5}, + {1, arcs_65_6}, }; -static arc arcs_62_0[1] = { +static arc arcs_66_0[1] = { {21, 1}, }; -static arc arcs_62_1[2] = { +static arc arcs_66_1[2] = { {26, 2}, {0, 1}, }; -static arc arcs_62_2[1] = { +static arc arcs_66_2[1] = { {0, 2}, }; -static state states_62[3] = { - {1, arcs_62_0}, - {2, arcs_62_1}, - {1, arcs_62_2}, +static state states_66[3] = { + {1, arcs_66_0}, + {2, arcs_66_1}, + {1, arcs_66_2}, }; -static arc arcs_63_0[1] = { +static arc arcs_67_0[1] = { {81, 1}, }; -static arc arcs_63_1[2] = { +static arc arcs_67_1[2] = { {27, 2}, {0, 1}, }; -static arc arcs_63_2[2] = { +static arc arcs_67_2[2] = { {81, 1}, {0, 2}, }; -static state states_63[3] = { - {1, arcs_63_0}, - {2, arcs_63_1}, - {2, arcs_63_2}, +static state states_67[3] = { + {1, arcs_67_0}, + {2, arcs_67_1}, + {2, arcs_67_2}, }; -static arc arcs_64_0[1] = { +static arc arcs_68_0[1] = { {26, 1}, }; -static arc arcs_64_1[2] = { +static arc arcs_68_1[2] = { {27, 2}, {0, 1}, }; -static arc arcs_64_2[2] = { +static arc arcs_68_2[2] = { {26, 1}, {0, 2}, }; -static state states_64[3] = { - {1, arcs_64_0}, - {2, arcs_64_1}, - {2, arcs_64_2}, -}; -static arc arcs_65_0[1] = { - {26, 1}, -}; -static arc arcs_65_1[2] = { - {27, 2}, - {0, 1}, -}; -static arc arcs_65_2[1] = { - {26, 3}, -}; -static arc arcs_65_3[2] = { - {27, 4}, - {0, 3}, -}; -static arc arcs_65_4[2] = { - {26, 3}, - {0, 4}, -}; -static state states_65[5] = { - {1, arcs_65_0}, - {2, arcs_65_1}, - {1, arcs_65_2}, - {2, arcs_65_3}, - {2, arcs_65_4}, +static state states_68[3] = { + {1, arcs_68_0}, + {2, arcs_68_1}, + {2, arcs_68_2}, }; -static arc arcs_66_0[1] = { +static arc arcs_69_0[1] = { {26, 1}, }; -static arc arcs_66_1[1] = { +static arc arcs_69_1[1] = { {21, 2}, }; -static arc arcs_66_2[1] = { +static arc arcs_69_2[1] = { {26, 3}, }; -static arc arcs_66_3[2] = { +static arc arcs_69_3[2] = { {27, 4}, {0, 3}, }; -static arc arcs_66_4[2] = { +static arc arcs_69_4[2] = { {26, 1}, {0, 4}, }; -static state states_66[5] = { - {1, arcs_66_0}, - {1, arcs_66_1}, - {1, arcs_66_2}, - {2, arcs_66_3}, - {2, arcs_66_4}, +static state states_69[5] = { + {1, arcs_69_0}, + {1, arcs_69_1}, + {1, arcs_69_2}, + {2, arcs_69_3}, + {2, arcs_69_4}, }; -static arc arcs_67_0[1] = { - {153, 1}, +static arc arcs_70_0[1] = { + {156, 1}, }; -static arc arcs_67_1[1] = { +static arc arcs_70_1[1] = { {19, 2}, }; -static arc arcs_67_2[2] = { +static arc arcs_70_2[2] = { {13, 3}, {21, 4}, }; -static arc arcs_67_3[2] = { +static arc arcs_70_3[2] = { {9, 5}, {15, 6}, }; -static arc arcs_67_4[1] = { +static arc arcs_70_4[1] = { {22, 7}, }; -static arc arcs_67_5[1] = { +static arc arcs_70_5[1] = { {15, 6}, }; -static arc arcs_67_6[1] = { +static arc arcs_70_6[1] = { {21, 4}, }; -static arc arcs_67_7[1] = { +static arc arcs_70_7[1] = { {0, 7}, }; -static state states_67[8] = { - {1, arcs_67_0}, - {1, arcs_67_1}, - {2, arcs_67_2}, - {2, arcs_67_3}, - {1, arcs_67_4}, - {1, arcs_67_5}, - {1, arcs_67_6}, - {1, arcs_67_7}, -}; -static arc arcs_68_0[3] = { - {154, 1}, +static state states_70[8] = { + {1, arcs_70_0}, + {1, arcs_70_1}, + {2, arcs_70_2}, + {2, arcs_70_3}, + {1, arcs_70_4}, + {1, arcs_70_5}, + {1, arcs_70_6}, + {1, arcs_70_7}, +}; +static arc arcs_71_0[3] = { + {157, 1}, {28, 2}, {29, 3}, }; -static arc arcs_68_1[2] = { +static arc arcs_71_1[2] = { {27, 4}, {0, 1}, }; -static arc arcs_68_2[1] = { +static arc arcs_71_2[1] = { {26, 5}, }; -static arc arcs_68_3[1] = { +static arc arcs_71_3[1] = { {26, 6}, }; -static arc arcs_68_4[4] = { - {154, 1}, +static arc arcs_71_4[4] = { + {157, 1}, {28, 2}, {29, 3}, {0, 4}, }; -static arc arcs_68_5[2] = { +static arc arcs_71_5[2] = { {27, 7}, {0, 5}, }; -static arc arcs_68_6[1] = { +static arc arcs_71_6[1] = { {0, 6}, }; -static arc arcs_68_7[1] = { +static arc arcs_71_7[1] = { {29, 3}, }; -static state states_68[8] = { - {3, arcs_68_0}, - {2, arcs_68_1}, - {1, arcs_68_2}, - {1, arcs_68_3}, - {4, arcs_68_4}, - {2, arcs_68_5}, - {1, arcs_68_6}, - {1, arcs_68_7}, -}; -static arc arcs_69_0[1] = { - {26, 1}, -}; -static arc arcs_69_1[3] = { - {147, 2}, - {25, 3}, - {0, 1}, -}; -static arc arcs_69_2[1] = { - {0, 2}, -}; -static arc arcs_69_3[1] = { - {26, 2}, -}; -static state states_69[4] = { - {1, arcs_69_0}, - {3, arcs_69_1}, - {1, arcs_69_2}, - {1, arcs_69_3}, -}; -static arc arcs_70_0[2] = { - {146, 1}, - {156, 1}, -}; -static arc arcs_70_1[1] = { - {0, 1}, -}; -static state states_70[2] = { - {2, arcs_70_0}, - {1, arcs_70_1}, -}; -static arc arcs_71_0[1] = { - {93, 1}, -}; -static arc arcs_71_1[1] = { - {59, 2}, -}; -static arc arcs_71_2[1] = { - {82, 3}, -}; -static arc arcs_71_3[1] = { - {152, 4}, -}; -static arc arcs_71_4[2] = { - {155, 5}, - {0, 4}, -}; -static arc arcs_71_5[1] = { - {0, 5}, -}; -static state states_71[6] = { - {1, arcs_71_0}, - {1, arcs_71_1}, +static state states_71[8] = { + {3, arcs_71_0}, + {2, arcs_71_1}, {1, arcs_71_2}, {1, arcs_71_3}, - {2, arcs_71_4}, - {1, arcs_71_5}, + {4, arcs_71_4}, + {2, arcs_71_5}, + {1, arcs_71_6}, + {1, arcs_71_7}, }; static arc arcs_72_0[1] = { - {89, 1}, + {26, 1}, }; -static arc arcs_72_1[1] = { - {26, 2}, +static arc arcs_72_1[3] = { + {152, 2}, + {25, 3}, + {0, 1}, }; -static arc arcs_72_2[2] = { - {155, 3}, +static arc arcs_72_2[1] = { {0, 2}, }; static arc arcs_72_3[1] = { - {0, 3}, + {26, 2}, }; static state states_72[4] = { {1, arcs_72_0}, - {1, arcs_72_1}, - {2, arcs_72_2}, + {3, arcs_72_1}, + {1, arcs_72_2}, {1, arcs_72_3}, }; static arc arcs_73_0[2] = { - {147, 1}, - {158, 1}, + {151, 1}, + {159, 1}, }; static arc arcs_73_1[1] = { {0, 1}, @@ -1605,10 +1601,10 @@ static arc arcs_74_2[1] = { {82, 3}, }; static arc arcs_74_3[1] = { - {26, 4}, + {100, 4}, }; static arc arcs_74_4[2] = { - {157, 5}, + {158, 5}, {0, 4}, }; static arc arcs_74_5[1] = { @@ -1629,7 +1625,7 @@ static arc arcs_75_1[1] = { {26, 2}, }; static arc arcs_75_2[2] = { - {157, 3}, + {158, 3}, {0, 2}, }; static arc arcs_75_3[1] = { @@ -1641,49 +1637,106 @@ static state states_75[4] = { {2, arcs_75_2}, {1, arcs_75_3}, }; -static arc arcs_76_0[1] = { - {26, 1}, +static arc arcs_76_0[2] = { + {152, 1}, + {161, 1}, }; -static arc arcs_76_1[2] = { - {27, 0}, +static arc arcs_76_1[1] = { {0, 1}, }; static state states_76[2] = { - {1, arcs_76_0}, - {2, arcs_76_1}, + {2, arcs_76_0}, + {1, arcs_76_1}, }; static arc arcs_77_0[1] = { - {19, 1}, + {93, 1}, }; static arc arcs_77_1[1] = { - {0, 1}, + {59, 2}, +}; +static arc arcs_77_2[1] = { + {82, 3}, +}; +static arc arcs_77_3[1] = { + {102, 4}, +}; +static arc arcs_77_4[2] = { + {160, 5}, + {0, 4}, }; -static state states_77[2] = { +static arc arcs_77_5[1] = { + {0, 5}, +}; +static state states_77[6] = { {1, arcs_77_0}, {1, arcs_77_1}, + {1, arcs_77_2}, + {1, arcs_77_3}, + {2, arcs_77_4}, + {1, arcs_77_5}, }; static arc arcs_78_0[1] = { - {160, 1}, + {89, 1}, +}; +static arc arcs_78_1[1] = { + {26, 2}, +}; +static arc arcs_78_2[2] = { + {160, 3}, + {0, 2}, +}; +static arc arcs_78_3[1] = { + {0, 3}, +}; +static state states_78[4] = { + {1, arcs_78_0}, + {1, arcs_78_1}, + {2, arcs_78_2}, + {1, arcs_78_3}, +}; +static arc arcs_79_0[1] = { + {26, 1}, +}; +static arc arcs_79_1[2] = { + {27, 0}, + {0, 1}, +}; +static state states_79[2] = { + {1, arcs_79_0}, + {2, arcs_79_1}, +}; +static arc arcs_80_0[1] = { + {19, 1}, +}; +static arc arcs_80_1[1] = { + {0, 1}, +}; +static state states_80[2] = { + {1, arcs_80_0}, + {1, arcs_80_1}, }; -static arc arcs_78_1[2] = { +static arc arcs_81_0[1] = { + {163, 1}, +}; +static arc arcs_81_1[2] = { {9, 2}, {0, 1}, }; -static arc arcs_78_2[1] = { +static arc arcs_81_2[1] = { {0, 2}, }; -static state states_78[3] = { - {1, arcs_78_0}, - {2, arcs_78_1}, - {1, arcs_78_2}, +static state states_81[3] = { + {1, arcs_81_0}, + {2, arcs_81_1}, + {1, arcs_81_2}, }; -static dfa dfas[79] = { +static dfa dfas[82] = { {256, "single_input", 0, 3, states_0, - "\004\050\014\000\000\000\000\025\074\205\011\162\000\002\000\140\010\111\023\002\001"}, + "\004\050\014\000\000\000\000\025\074\205\011\162\000\101\000\000\014\041\151\020\010"}, {257, "file_input", 0, 2, states_1, - "\204\050\014\000\000\000\000\025\074\205\011\162\000\002\000\140\010\111\023\002\001"}, + "\204\050\014\000\000\000\000\025\074\205\011\162\000\101\000\000\014\041\151\020\010"}, {258, "eval_input", 0, 3, states_2, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, {259, "decorator", 0, 7, states_3, "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, @@ -1699,13 +1752,13 @@ static dfa dfas[79] = { {265, "fplist", 0, 3, states_9, "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {266, "stmt", 0, 2, states_10, - "\000\050\014\000\000\000\000\025\074\205\011\162\000\002\000\140\010\111\023\002\001"}, + "\000\050\014\000\000\000\000\025\074\205\011\162\000\101\000\000\014\041\151\020\010"}, {267, "simple_stmt", 0, 4, states_11, - "\000\040\010\000\000\000\000\025\074\205\011\000\000\002\000\140\010\111\023\000\001"}, + "\000\040\010\000\000\000\000\025\074\205\011\000\000\101\000\000\014\041\151\000\010"}, {268, "small_stmt", 0, 2, states_12, - "\000\040\010\000\000\000\000\025\074\205\011\000\000\002\000\140\010\111\023\000\001"}, + "\000\040\010\000\000\000\000\025\074\205\011\000\000\101\000\000\014\041\151\000\010"}, {269, "expr_stmt", 0, 6, states_13, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, {270, "augassign", 0, 2, states_14, "\000\000\000\000\000\360\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {271, "print_stmt", 0, 9, states_15, @@ -1715,7 +1768,7 @@ static dfa dfas[79] = { {273, "pass_stmt", 0, 2, states_17, "\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {274, "flow_stmt", 0, 2, states_18, - "\000\000\000\000\000\000\000\000\074\000\000\000\000\000\000\000\000\000\000\000\001"}, + "\000\000\000\000\000\000\000\000\074\000\000\000\000\000\000\000\000\000\000\000\010"}, {275, "break_stmt", 0, 2, states_19, "\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"}, {276, "continue_stmt", 0, 2, states_20, @@ -1723,7 +1776,7 @@ static dfa dfas[79] = { {277, "return_stmt", 0, 3, states_21, "\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"}, {278, "yield_stmt", 0, 2, states_22, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"}, {279, "raise_stmt", 0, 7, states_23, "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, {280, "import_stmt", 0, 2, states_24, @@ -1749,7 +1802,7 @@ static dfa dfas[79] = { {290, "assert_stmt", 0, 5, states_34, "\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000"}, {291, "compound_stmt", 0, 2, states_35, - "\000\010\004\000\000\000\000\000\000\000\000\162\000\000\000\000\000\000\000\002\000"}, + "\000\010\004\000\000\000\000\000\000\000\000\162\000\000\000\000\000\000\000\020\000"}, {292, "if_stmt", 0, 8, states_36, "\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, {293, "while_stmt", 0, 8, states_37, @@ -1761,83 +1814,89 @@ static dfa dfas[79] = { {296, "except_clause", 0, 5, states_40, "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"}, {297, "suite", 0, 5, states_41, - "\004\040\010\000\000\000\000\025\074\205\011\000\000\002\000\140\010\111\023\000\001"}, - {298, "test", 0, 4, states_42, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {299, "and_test", 0, 2, states_43, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\003\000\000"}, - {300, "not_test", 0, 3, states_44, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\003\000\000"}, - {301, "comparison", 0, 2, states_45, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {302, "comp_op", 0, 4, states_46, - "\000\000\000\000\000\000\000\000\000\000\004\000\000\362\017\000\000\000\000\000\000"}, - {303, "expr", 0, 2, states_47, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {304, "xor_expr", 0, 2, states_48, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {305, "and_expr", 0, 2, states_49, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {306, "shift_expr", 0, 2, states_50, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {307, "arith_expr", 0, 2, states_51, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {308, "term", 0, 2, states_52, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {309, "factor", 0, 3, states_53, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {310, "power", 0, 4, states_54, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\111\003\000\000"}, - {311, "atom", 0, 11, states_55, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\111\003\000\000"}, - {312, "listmaker", 0, 5, states_56, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {313, "testlist_gexp", 0, 5, states_57, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {314, "lambdef", 0, 5, states_58, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000"}, - {315, "trailer", 0, 7, states_59, - "\000\040\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\001\000\000\000"}, - {316, "subscriptlist", 0, 3, states_60, - "\000\040\050\000\000\000\000\000\000\010\000\000\000\002\000\140\010\111\023\000\000"}, - {317, "subscript", 0, 7, states_61, - "\000\040\050\000\000\000\000\000\000\010\000\000\000\002\000\140\010\111\023\000\000"}, - {318, "sliceop", 0, 3, states_62, + "\004\040\010\000\000\000\000\025\074\205\011\000\000\101\000\000\014\041\151\000\010"}, + {298, "testlist_safe", 0, 5, states_42, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {299, "old_test", 0, 2, states_43, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {300, "old_lambdef", 0, 5, states_44, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"}, + {301, "test", 0, 6, states_45, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {302, "or_test", 0, 2, states_46, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\100\000\000\014\041\151\000\000"}, + {303, "and_test", 0, 2, states_47, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\100\000\000\014\041\151\000\000"}, + {304, "not_test", 0, 3, states_48, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\100\000\000\014\041\151\000\000"}, + {305, "comparison", 0, 2, states_49, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {306, "comp_op", 0, 4, states_50, + "\000\000\000\000\000\000\000\000\000\000\004\000\000\100\376\001\000\000\000\000\000"}, + {307, "expr", 0, 2, states_51, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {308, "xor_expr", 0, 2, states_52, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {309, "and_expr", 0, 2, states_53, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {310, "shift_expr", 0, 2, states_54, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {311, "arith_expr", 0, 2, states_55, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {312, "term", 0, 2, states_56, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {313, "factor", 0, 3, states_57, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {314, "power", 0, 4, states_58, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\151\000\000"}, + {315, "atom", 0, 11, states_59, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\151\000\000"}, + {316, "listmaker", 0, 5, states_60, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {317, "testlist_gexp", 0, 5, states_61, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {318, "lambdef", 0, 5, states_62, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"}, + {319, "trailer", 0, 7, states_63, + "\000\040\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\040\000\000\000"}, + {320, "subscriptlist", 0, 3, states_64, + "\000\040\050\000\000\000\000\000\000\010\000\000\000\101\000\000\014\041\151\000\000"}, + {321, "subscript", 0, 7, states_65, + "\000\040\050\000\000\000\000\000\000\010\000\000\000\101\000\000\014\041\151\000\000"}, + {322, "sliceop", 0, 3, states_66, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {319, "exprlist", 0, 3, states_63, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000\000"}, - {320, "testlist", 0, 3, states_64, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {321, "testlist_safe", 0, 5, states_65, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {322, "dictmaker", 0, 5, states_66, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {323, "classdef", 0, 8, states_67, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000"}, - {324, "arglist", 0, 8, states_68, - "\000\040\010\060\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {325, "argument", 0, 4, states_69, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {326, "list_iter", 0, 2, states_70, + {323, "exprlist", 0, 3, states_67, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\014\041\151\000\000"}, + {324, "testlist", 0, 3, states_68, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {325, "dictmaker", 0, 5, states_69, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {326, "classdef", 0, 8, states_70, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000"}, + {327, "arglist", 0, 8, states_71, + "\000\040\010\060\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {328, "argument", 0, 4, states_72, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {329, "list_iter", 0, 2, states_73, "\000\000\000\000\000\000\000\000\000\000\000\042\000\000\000\000\000\000\000\000\000"}, - {327, "list_for", 0, 6, states_71, + {330, "list_for", 0, 6, states_74, "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, - {328, "list_if", 0, 4, states_72, + {331, "list_if", 0, 4, states_75, "\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, - {329, "gen_iter", 0, 2, states_73, + {332, "gen_iter", 0, 2, states_76, "\000\000\000\000\000\000\000\000\000\000\000\042\000\000\000\000\000\000\000\000\000"}, - {330, "gen_for", 0, 6, states_74, + {333, "gen_for", 0, 6, states_77, "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, - {331, "gen_if", 0, 4, states_75, + {334, "gen_if", 0, 4, states_78, "\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, - {332, "testlist1", 0, 2, states_76, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"}, - {333, "encoding_decl", 0, 2, states_77, + {335, "testlist1", 0, 2, states_79, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\101\000\000\014\041\151\000\000"}, + {336, "encoding_decl", 0, 2, states_80, "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {334, "yield_expr", 0, 3, states_78, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"}, + {337, "yield_expr", 0, 3, states_81, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"}, }; -static label labels[161] = { +static label labels[164] = { {0, "EMPTY"}, {256, 0}, {4, 0}, @@ -1847,12 +1906,12 @@ static label labels[161] = { {266, 0}, {0, 0}, {258, 0}, - {320, 0}, + {324, 0}, {259, 0}, {50, 0}, {287, 0}, {7, 0}, - {324, 0}, + {327, 0}, {8, 0}, {260, 0}, {261, 0}, @@ -1864,7 +1923,7 @@ static label labels[161] = { {263, 0}, {264, 0}, {22, 0}, - {298, 0}, + {301, 0}, {12, 0}, {16, 0}, {36, 0}, @@ -1881,7 +1940,7 @@ static label labels[161] = { {289, 0}, {290, 0}, {270, 0}, - {334, 0}, + {337, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -1897,7 +1956,7 @@ static label labels[161] = { {1, "print"}, {35, 0}, {1, "del"}, - {319, 0}, + {323, 0}, {1, "pass"}, {275, 0}, {276, 0}, @@ -1919,14 +1978,14 @@ static label labels[161] = { {284, 0}, {1, "global"}, {1, "exec"}, - {303, 0}, + {307, 0}, {1, "in"}, {1, "assert"}, {292, 0}, {293, 0}, {294, 0}, {295, 0}, - {323, 0}, + {326, 0}, {1, "if"}, {1, "elif"}, {1, "else"}, @@ -1938,14 +1997,19 @@ static label labels[161] = { {1, "except"}, {5, 0}, {6, 0}, + {298, 0}, {299, 0}, - {1, "or"}, - {314, 0}, + {302, 0}, {300, 0}, + {1, "lambda"}, + {318, 0}, + {303, 0}, + {1, "or"}, + {304, 0}, {1, "and"}, {1, "not"}, - {301, 0}, - {302, 0}, + {305, 0}, + {306, 0}, {20, 0}, {21, 0}, {28, 0}, @@ -1954,55 +2018,53 @@ static label labels[161] = { {29, 0}, {29, 0}, {1, "is"}, - {304, 0}, + {308, 0}, {18, 0}, - {305, 0}, + {309, 0}, {33, 0}, - {306, 0}, + {310, 0}, {19, 0}, - {307, 0}, + {311, 0}, {34, 0}, - {308, 0}, + {312, 0}, {14, 0}, {15, 0}, - {309, 0}, + {313, 0}, {17, 0}, {24, 0}, {48, 0}, {32, 0}, - {310, 0}, - {311, 0}, + {314, 0}, {315, 0}, - {313, 0}, + {319, 0}, + {317, 0}, {9, 0}, - {312, 0}, + {316, 0}, {10, 0}, {26, 0}, - {322, 0}, + {325, 0}, {27, 0}, {25, 0}, - {332, 0}, + {335, 0}, {2, 0}, {3, 0}, - {327, 0}, {330, 0}, - {1, "lambda"}, - {316, 0}, - {317, 0}, - {318, 0}, + {333, 0}, + {320, 0}, {321, 0}, + {322, 0}, {1, "class"}, - {325, 0}, - {326, 0}, {328, 0}, {329, 0}, {331, 0}, - {333, 0}, + {332, 0}, + {334, 0}, + {336, 0}, {1, "yield"}, }; grammar _PyParser_Grammar = { - 79, + 82, dfas, - {161, labels}, + {164, labels}, 256 }; diff --git a/Python/symtable.c b/Python/symtable.c index fd95bd5..b66abc9 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1084,6 +1084,11 @@ symtable_visit_expr(struct symtable *st, expr_ty e) return 0; break; } + case IfExp_kind: + VISIT(st, expr, e->v.IfExp.test); + VISIT(st, expr, e->v.IfExp.body); + VISIT(st, expr, e->v.IfExp.orelse); + break; case Dict_kind: VISIT_SEQ(st, expr, e->v.Dict.keys); VISIT_SEQ(st, expr, e->v.Dict.values); |