diff options
author | Skip Montanaro <skip@pobox.com> | 2000-08-12 18:09:51 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2000-08-12 18:09:51 (GMT) |
commit | 803d6e5451cbf0416bfb252eedba36ff2e354fac (patch) | |
tree | e37c0cf52e141c341e6b8a64a5d7e7691313df41 /Python | |
parent | b16b83534d008d45a2917bd2c4fd65010909dff2 (diff) | |
download | cpython-803d6e5451cbf0416bfb252eedba36ff2e354fac.zip cpython-803d6e5451cbf0416bfb252eedba36ff2e354fac.tar.gz cpython-803d6e5451cbf0416bfb252eedba36ff2e354fac.tar.bz2 |
list comprehensions. see
http://sourceforge.net/patch/?func=detailpatch&patch_id=100654&group_id=5470
for details.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 143 | ||||
-rw-r--r-- | Python/graminit.c | 497 |
2 files changed, 425 insertions, 215 deletions
diff --git a/Python/compile.c b/Python/compile.c index 395bd1e..6e4c548 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -294,6 +294,7 @@ struct compiling { #ifdef PRIVATE_NAME_MANGLING char *c_private; /* for private name mangling */ #endif + int c_tmpname; /* temporary local name counter */ }; @@ -368,8 +369,10 @@ static int com_addconst(struct compiling *, PyObject *); static int com_addname(struct compiling *, PyObject *); static void com_addopname(struct compiling *, int, node *); static void com_list(struct compiling *, node *, int); +static void com_list_iter(struct compiling *, node *, node *, char *); static int com_argdefs(struct compiling *, node *); static int com_newlocal(struct compiling *, char *); +static void com_assign(struct compiling *, node *, int); static PyCodeObject *icompile(struct _node *, struct compiling *); static PyCodeObject *jcompile(struct _node *, char *, struct compiling *); @@ -419,6 +422,7 @@ com_init(struct compiling *c, char *filename) c->c_last_addr = 0; c->c_last_line = 0; c-> c_lnotab_next = 0; + c->c_tmpname = 0; return 1; fail: @@ -941,18 +945,116 @@ parsestrplus(node *n) } static void -com_list_constructor(struct compiling *c, node *n) +com_list_for(struct compiling *c, node *n, node *e, char *t) { - int len; - int i; - if (TYPE(n) != testlist) - REQ(n, exprlist); - /* exprlist: expr (',' expr)* [',']; likewise for testlist */ - len = (NCH(n) + 1) / 2; - for (i = 0; i < NCH(n); i += 2) - com_node(c, CHILD(n, i)); - com_addoparg(c, BUILD_LIST, len); - com_pop(c, len-1); + PyObject *v; + int anchor = 0; + int save_begin = c->c_begin; + + /* list_iter: for v in expr [list_iter] */ + com_node(c, CHILD(n, 3)); /* expr */ + v = PyInt_FromLong(0L); + if (v == NULL) + c->c_errors++; + com_addoparg(c, LOAD_CONST, com_addconst(c, v)); + com_push(c, 1); + Py_XDECREF(v); + c->c_begin = c->c_nexti; + com_addoparg(c, SET_LINENO, n->n_lineno); + com_addfwref(c, FOR_LOOP, &anchor); + com_push(c, 1); + com_assign(c, CHILD(n, 1), OP_ASSIGN); + c->c_loops++; + com_list_iter(c, n, e, t); + c->c_loops--; + com_addoparg(c, JUMP_ABSOLUTE, c->c_begin); + c->c_begin = save_begin; + com_backpatch(c, anchor); + com_pop(c, 2); /* FOR_LOOP has popped these */ +} + +static void +com_list_if(struct compiling *c, node *n, node *e, char *t) +{ + int anchor = 0; + int a = 0; + /* list_iter: 'if' test [list_iter] */ + com_addoparg(c, SET_LINENO, n->n_lineno); + com_node(c, CHILD(n, 1)); + com_addfwref(c, JUMP_IF_FALSE, &a); + com_addbyte(c, POP_TOP); + com_pop(c, 1); + com_list_iter(c, n, e, t); + com_addfwref(c, JUMP_FORWARD, &anchor); + com_backpatch(c, a); + /* We jump here with an extra entry which we now pop */ + com_addbyte(c, POP_TOP); + com_backpatch(c, anchor); +} + +static void +com_list_iter(struct compiling *c, + node *p, /* parent of list_iter node */ + node *e, /* element expression node */ + char *t /* name of result list temp local */) +{ + /* list_iter is the last child in a listmaker, list_for, or list_if */ + node *n = CHILD(p, NCH(p)-1); + if (TYPE(n) == list_iter) { + n = CHILD(n, 0); + switch (TYPE(n)) { + case list_for: + com_list_for(c, n, e, t); + break; + case list_if: + com_list_if(c, n, e, t); + break; + default: + com_error(c, PyExc_SystemError, + "invalid list_iter node type"); + } + } + else { + com_addopnamestr(c, LOAD_NAME, t); + com_push(c, 1); + com_node(c, e); + com_addoparg(c, CALL_FUNCTION, 1); + com_addbyte(c, POP_TOP); + com_pop(c, 2); + } +} + +static void +com_list_comprehension(struct compiling *c, node *n) +{ + /* listmaker: test list_iter */ + char tmpname[12]; + sprintf(tmpname, "__%d__", ++c->c_tmpname); + com_addoparg(c, BUILD_LIST, 0); + com_addbyte(c, DUP_TOP); /* leave the result on the stack */ + com_push(c, 2); + com_addopnamestr(c, LOAD_ATTR, "append"); + com_addopnamestr(c, STORE_NAME, tmpname); + com_pop(c, 1); + com_list_iter(c, n, CHILD(n, 0), tmpname); + com_addopnamestr(c, DELETE_NAME, tmpname); + --c->c_tmpname; +} + +static void +com_listmaker(struct compiling *c, node *n) +{ + /* listmaker: test ( list_iter | (',' test)* [','] ) */ + if (TYPE(CHILD(n, 1)) == list_iter) + com_list_comprehension(c, n); + else { + int len = 0; + int i; + for (i = 0; i < NCH(n); i += 2, len++) + com_node(c, CHILD(n, i)); + com_addoparg(c, BUILD_LIST, len); + com_pop(c, len-1); + } } static void @@ -990,18 +1092,18 @@ com_atom(struct compiling *c, node *n) else com_node(c, CHILD(n, 1)); break; - case LSQB: + case LSQB: /* '[' [listmaker] ']' */ if (TYPE(CHILD(n, 1)) == RSQB) { com_addoparg(c, BUILD_LIST, 0); com_push(c, 1); } else - com_list_constructor(c, CHILD(n, 1)); + com_listmaker(c, CHILD(n, 1)); break; case LBRACE: /* '{' [dictmaker] '}' */ com_addoparg(c, BUILD_MAP, 0); com_push(c, 1); - if (TYPE(CHILD(n, 1)) != RBRACE) + if (TYPE(CHILD(n, 1)) == dictmaker) com_dictmaker(c, CHILD(n, 1)); break; case BACKQUOTE: @@ -1744,6 +1846,19 @@ com_assign_sequence(struct compiling *c, node *n, int assigning) } static void +com_assign_list(struct compiling *c, node *n, int assigning) +{ + int i; + if (assigning) { + i = (NCH(n)+1)/2; + com_addoparg(c, UNPACK_SEQUENCE, i); + com_push(c, i-1); + } + for (i = 0; i < NCH(n); i += 2) + com_assign(c, CHILD(n, i), assigning); +} + +static void com_assign_name(struct compiling *c, node *n, int assigning) { REQ(n, NAME); diff --git a/Python/graminit.c b/Python/graminit.c index 35d8de4..82b01bc 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -896,23 +896,23 @@ static state states_44[4] = { static arc arcs_45_0[7] = { {16, 1}, {109, 2}, - {111, 3}, - {114, 4}, + {112, 3}, + {115, 4}, {12, 5}, - {115, 5}, - {116, 6}, + {116, 5}, + {117, 6}, }; static arc arcs_45_1[2] = { {9, 7}, {18, 5}, }; static arc arcs_45_2[2] = { - {9, 8}, - {110, 5}, + {110, 8}, + {111, 5}, }; static arc arcs_45_3[2] = { - {112, 9}, - {113, 5}, + {113, 9}, + {114, 5}, }; static arc arcs_45_4[1] = { {9, 10}, @@ -921,20 +921,20 @@ static arc arcs_45_5[1] = { {0, 5}, }; static arc arcs_45_6[2] = { - {116, 6}, + {117, 6}, {0, 6}, }; static arc arcs_45_7[1] = { {18, 5}, }; static arc arcs_45_8[1] = { - {110, 5}, + {111, 5}, }; static arc arcs_45_9[1] = { - {113, 5}, + {114, 5}, }; static arc arcs_45_10[1] = { - {114, 5}, + {115, 5}, }; static state states_45[11] = { {7, arcs_45_0}, @@ -950,153 +950,163 @@ static state states_45[11] = { {1, arcs_45_10}, }; static arc arcs_46_0[1] = { - {117, 1}, + {21, 1}, }; -static arc arcs_46_1[2] = { - {17, 2}, - {14, 3}, +static arc arcs_46_1[3] = { + {118, 2}, + {22, 3}, + {0, 1}, }; static arc arcs_46_2[1] = { - {14, 3}, + {0, 2}, }; -static arc arcs_46_3[1] = { +static arc arcs_46_3[2] = { {21, 4}, + {0, 3}, }; -static arc arcs_46_4[1] = { +static arc arcs_46_4[2] = { + {22, 3}, {0, 4}, }; static state states_46[5] = { {1, arcs_46_0}, - {2, arcs_46_1}, + {3, arcs_46_1}, {1, arcs_46_2}, - {1, arcs_46_3}, - {1, arcs_46_4}, + {2, arcs_46_3}, + {2, arcs_46_4}, }; -static arc arcs_47_0[3] = { - {16, 1}, - {109, 2}, - {52, 3}, +static arc arcs_47_0[1] = { + {119, 1}, }; static arc arcs_47_1[2] = { - {118, 4}, - {18, 5}, + {17, 2}, + {14, 3}, }; static arc arcs_47_2[1] = { - {119, 6}, + {14, 3}, }; static arc arcs_47_3[1] = { - {12, 5}, + {21, 4}, }; static arc arcs_47_4[1] = { - {18, 5}, -}; -static arc arcs_47_5[1] = { - {0, 5}, -}; -static arc arcs_47_6[1] = { - {110, 5}, + {0, 4}, }; -static state states_47[7] = { - {3, arcs_47_0}, +static state states_47[5] = { + {1, arcs_47_0}, {2, arcs_47_1}, {1, arcs_47_2}, {1, arcs_47_3}, {1, arcs_47_4}, - {1, arcs_47_5}, - {1, arcs_47_6}, }; -static arc arcs_48_0[1] = { - {120, 1}, +static arc arcs_48_0[3] = { + {16, 1}, + {109, 2}, + {52, 3}, }; static arc arcs_48_1[2] = { + {120, 4}, + {18, 5}, +}; +static arc arcs_48_2[1] = { + {121, 6}, +}; +static arc arcs_48_3[1] = { + {12, 5}, +}; +static arc arcs_48_4[1] = { + {18, 5}, +}; +static arc arcs_48_5[1] = { + {0, 5}, +}; +static arc arcs_48_6[1] = { + {111, 5}, +}; +static state states_48[7] = { + {3, arcs_48_0}, + {2, arcs_48_1}, + {1, arcs_48_2}, + {1, arcs_48_3}, + {1, arcs_48_4}, + {1, arcs_48_5}, + {1, arcs_48_6}, +}; +static arc arcs_49_0[1] = { + {122, 1}, +}; +static arc arcs_49_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_48_2[2] = { - {120, 1}, +static arc arcs_49_2[2] = { + {122, 1}, {0, 2}, }; -static state states_48[3] = { - {1, arcs_48_0}, - {2, arcs_48_1}, - {2, arcs_48_2}, +static state states_49[3] = { + {1, arcs_49_0}, + {2, arcs_49_1}, + {2, arcs_49_2}, }; -static arc arcs_49_0[3] = { +static arc arcs_50_0[3] = { {52, 1}, {21, 2}, {14, 3}, }; -static arc arcs_49_1[1] = { +static arc arcs_50_1[1] = { {52, 4}, }; -static arc arcs_49_2[2] = { +static arc arcs_50_2[2] = { {14, 3}, {0, 2}, }; -static arc arcs_49_3[3] = { +static arc arcs_50_3[3] = { {21, 5}, - {121, 6}, + {123, 6}, {0, 3}, }; -static arc arcs_49_4[1] = { +static arc arcs_50_4[1] = { {52, 6}, }; -static arc arcs_49_5[2] = { - {121, 6}, +static arc arcs_50_5[2] = { + {123, 6}, {0, 5}, }; -static arc arcs_49_6[1] = { +static arc arcs_50_6[1] = { {0, 6}, }; -static state states_49[7] = { - {3, arcs_49_0}, - {1, arcs_49_1}, - {2, arcs_49_2}, - {3, arcs_49_3}, - {1, arcs_49_4}, - {2, arcs_49_5}, - {1, arcs_49_6}, -}; -static arc arcs_50_0[1] = { - {14, 1}, -}; -static arc arcs_50_1[2] = { - {21, 2}, - {0, 1}, -}; -static arc arcs_50_2[1] = { - {0, 2}, -}; -static state states_50[3] = { - {1, arcs_50_0}, - {2, arcs_50_1}, - {1, arcs_50_2}, +static state states_50[7] = { + {3, arcs_50_0}, + {1, arcs_50_1}, + {2, arcs_50_2}, + {3, arcs_50_3}, + {1, arcs_50_4}, + {2, arcs_50_5}, + {1, arcs_50_6}, }; static arc arcs_51_0[1] = { - {55, 1}, + {14, 1}, }; static arc arcs_51_1[2] = { - {22, 2}, + {21, 2}, {0, 1}, }; -static arc arcs_51_2[2] = { - {55, 1}, +static arc arcs_51_2[1] = { {0, 2}, }; static state states_51[3] = { {1, arcs_51_0}, {2, arcs_51_1}, - {2, arcs_51_2}, + {1, arcs_51_2}, }; static arc arcs_52_0[1] = { - {21, 1}, + {55, 1}, }; static arc arcs_52_1[2] = { {22, 2}, {0, 1}, }; static arc arcs_52_2[2] = { - {21, 1}, + {55, 1}, {0, 2}, }; static state states_52[3] = { @@ -1107,129 +1117,202 @@ static state states_52[3] = { static arc arcs_53_0[1] = { {21, 1}, }; -static arc arcs_53_1[1] = { +static arc arcs_53_1[2] = { + {22, 2}, + {0, 1}, +}; +static arc arcs_53_2[2] = { + {21, 1}, + {0, 2}, +}; +static state states_53[3] = { + {1, arcs_53_0}, + {2, arcs_53_1}, + {2, arcs_53_2}, +}; +static arc arcs_54_0[1] = { + {21, 1}, +}; +static arc arcs_54_1[1] = { {14, 2}, }; -static arc arcs_53_2[1] = { +static arc arcs_54_2[1] = { {21, 3}, }; -static arc arcs_53_3[2] = { +static arc arcs_54_3[2] = { {22, 4}, {0, 3}, }; -static arc arcs_53_4[2] = { +static arc arcs_54_4[2] = { {21, 1}, {0, 4}, }; -static state states_53[5] = { - {1, arcs_53_0}, - {1, arcs_53_1}, - {1, arcs_53_2}, - {2, arcs_53_3}, - {2, arcs_53_4}, +static state states_54[5] = { + {1, arcs_54_0}, + {1, arcs_54_1}, + {1, arcs_54_2}, + {2, arcs_54_3}, + {2, arcs_54_4}, }; -static arc arcs_54_0[1] = { - {122, 1}, +static arc arcs_55_0[1] = { + {124, 1}, }; -static arc arcs_54_1[1] = { +static arc arcs_55_1[1] = { {12, 2}, }; -static arc arcs_54_2[2] = { +static arc arcs_55_2[2] = { {16, 3}, {14, 4}, }; -static arc arcs_54_3[1] = { +static arc arcs_55_3[1] = { {9, 5}, }; -static arc arcs_54_4[1] = { +static arc arcs_55_4[1] = { {15, 6}, }; -static arc arcs_54_5[1] = { +static arc arcs_55_5[1] = { {18, 7}, }; -static arc arcs_54_6[1] = { +static arc arcs_55_6[1] = { {0, 6}, }; -static arc arcs_54_7[1] = { +static arc arcs_55_7[1] = { {14, 4}, }; -static state states_54[8] = { - {1, arcs_54_0}, - {1, arcs_54_1}, - {2, arcs_54_2}, - {1, arcs_54_3}, - {1, arcs_54_4}, - {1, arcs_54_5}, - {1, arcs_54_6}, - {1, arcs_54_7}, -}; -static arc arcs_55_0[3] = { - {123, 1}, +static state states_55[8] = { + {1, arcs_55_0}, + {1, arcs_55_1}, + {2, arcs_55_2}, + {1, arcs_55_3}, + {1, arcs_55_4}, + {1, arcs_55_5}, + {1, arcs_55_6}, + {1, arcs_55_7}, +}; +static arc arcs_56_0[3] = { + {125, 1}, {23, 2}, {24, 3}, }; -static arc arcs_55_1[2] = { +static arc arcs_56_1[2] = { {22, 4}, {0, 1}, }; -static arc arcs_55_2[1] = { +static arc arcs_56_2[1] = { {21, 5}, }; -static arc arcs_55_3[1] = { +static arc arcs_56_3[1] = { {21, 6}, }; -static arc arcs_55_4[4] = { - {123, 1}, +static arc arcs_56_4[4] = { + {125, 1}, {23, 2}, {24, 3}, {0, 4}, }; -static arc arcs_55_5[2] = { +static arc arcs_56_5[2] = { {22, 7}, {0, 5}, }; -static arc arcs_55_6[1] = { +static arc arcs_56_6[1] = { {0, 6}, }; -static arc arcs_55_7[1] = { +static arc arcs_56_7[1] = { {24, 3}, }; -static state states_55[8] = { - {3, arcs_55_0}, - {2, arcs_55_1}, - {1, arcs_55_2}, - {1, arcs_55_3}, - {4, arcs_55_4}, - {2, arcs_55_5}, - {1, arcs_55_6}, - {1, arcs_55_7}, +static state states_56[8] = { + {3, arcs_56_0}, + {2, arcs_56_1}, + {1, arcs_56_2}, + {1, arcs_56_3}, + {4, arcs_56_4}, + {2, arcs_56_5}, + {1, arcs_56_6}, + {1, arcs_56_7}, }; -static arc arcs_56_0[1] = { +static arc arcs_57_0[1] = { {21, 1}, }; -static arc arcs_56_1[2] = { +static arc arcs_57_1[2] = { {20, 2}, {0, 1}, }; -static arc arcs_56_2[1] = { +static arc arcs_57_2[1] = { {21, 3}, }; -static arc arcs_56_3[1] = { +static arc arcs_57_3[1] = { {0, 3}, }; -static state states_56[4] = { - {1, arcs_56_0}, - {2, arcs_56_1}, - {1, arcs_56_2}, - {1, arcs_56_3}, +static state states_57[4] = { + {1, arcs_57_0}, + {2, arcs_57_1}, + {1, arcs_57_2}, + {1, arcs_57_3}, +}; +static arc arcs_58_0[2] = { + {126, 1}, + {127, 1}, +}; +static arc arcs_58_1[1] = { + {0, 1}, +}; +static state states_58[2] = { + {2, arcs_58_0}, + {1, arcs_58_1}, +}; +static arc arcs_59_0[1] = { + {67, 1}, }; -static dfa dfas[57] = { +static arc arcs_59_1[1] = { + {39, 2}, +}; +static arc arcs_59_2[1] = { + {56, 3}, +}; +static arc arcs_59_3[1] = { + {9, 4}, +}; +static arc arcs_59_4[2] = { + {118, 5}, + {0, 4}, +}; +static arc arcs_59_5[1] = { + {0, 5}, +}; +static state states_59[6] = { + {1, arcs_59_0}, + {1, arcs_59_1}, + {1, arcs_59_2}, + {1, arcs_59_3}, + {2, arcs_59_4}, + {1, arcs_59_5}, +}; +static arc arcs_60_0[1] = { + {63, 1}, +}; +static arc arcs_60_1[1] = { + {21, 2}, +}; +static arc arcs_60_2[2] = { + {118, 3}, + {0, 2}, +}; +static arc arcs_60_3[1] = { + {0, 3}, +}; +static state states_60[4] = { + {1, arcs_60_0}, + {1, arcs_60_1}, + {2, arcs_60_2}, + {1, arcs_60_3}, +}; +static dfa dfas[61] = { {256, "single_input", 0, 3, states_0, - "\004\030\001\000\140\341\153\202\034\200\000\000\060\242\074\004"}, + "\004\030\001\000\140\341\153\202\034\200\000\000\060\042\271\020"}, {257, "file_input", 0, 2, states_1, - "\204\030\001\000\140\341\153\202\034\200\000\000\060\242\074\004"}, + "\204\030\001\000\140\341\153\202\034\200\000\000\060\042\271\020"}, {258, "eval_input", 0, 3, states_2, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\074\000"}, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\271\000"}, {259, "funcdef", 0, 6, states_3, "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "parameters", 0, 4, states_4, @@ -1241,13 +1324,13 @@ static dfa dfas[57] = { {263, "fplist", 0, 3, states_7, "\000\020\001\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {264, "stmt", 0, 2, states_8, - "\000\030\001\000\140\341\153\202\034\200\000\000\060\242\074\004"}, + "\000\030\001\000\140\341\153\202\034\200\000\000\060\042\271\020"}, {265, "simple_stmt", 0, 4, states_9, - "\000\020\001\000\140\341\153\002\000\200\000\000\060\242\074\000"}, + "\000\020\001\000\140\341\153\002\000\200\000\000\060\042\271\000"}, {266, "small_stmt", 0, 2, states_10, - "\000\020\001\000\140\341\153\002\000\200\000\000\060\242\074\000"}, + "\000\020\001\000\140\341\153\002\000\200\000\000\060\042\271\000"}, {267, "expr_stmt", 0, 2, states_11, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\074\000"}, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\271\000"}, {268, "print_stmt", 0, 3, states_12, "\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, {269, "del_stmt", 0, 3, states_13, @@ -1275,7 +1358,7 @@ static dfa dfas[57] = { {280, "assert_stmt", 0, 5, states_24, "\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"}, {281, "compound_stmt", 0, 2, states_25, - "\000\010\000\000\000\000\000\200\034\000\000\000\000\000\000\004"}, + "\000\010\000\000\000\000\000\200\034\000\000\000\000\000\000\020"}, {282, "if_stmt", 0, 8, states_26, "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, {283, "while_stmt", 0, 8, states_27, @@ -1287,59 +1370,67 @@ static dfa dfas[57] = { {286, "except_clause", 0, 5, states_30, "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000"}, {287, "suite", 0, 5, states_31, - "\004\020\001\000\140\341\153\002\000\200\000\000\060\242\074\000"}, + "\004\020\001\000\140\341\153\002\000\200\000\000\060\042\271\000"}, {288, "test", 0, 4, states_32, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\074\000"}, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\271\000"}, {289, "and_test", 0, 2, states_33, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\071\000"}, {290, "not_test", 0, 3, states_34, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\071\000"}, {291, "comparison", 0, 2, states_35, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {292, "comp_op", 0, 4, states_36, "\000\000\000\000\000\000\000\001\000\200\374\003\000\000\000\000"}, {293, "expr", 0, 2, states_37, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {294, "xor_expr", 0, 2, states_38, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {295, "and_expr", 0, 2, states_39, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {296, "shift_expr", 0, 2, states_40, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {297, "arith_expr", 0, 2, states_41, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {298, "term", 0, 2, states_42, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {299, "factor", 0, 3, states_43, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, {300, "power", 0, 4, states_44, - "\000\020\001\000\000\000\000\000\000\000\000\000\000\240\034\000"}, + "\000\020\001\000\000\000\000\000\000\000\000\000\000\040\071\000"}, {301, "atom", 0, 11, states_45, - "\000\020\001\000\000\000\000\000\000\000\000\000\000\240\034\000"}, - {302, "lambdef", 0, 5, states_46, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000"}, - {303, "trailer", 0, 7, states_47, + "\000\020\001\000\000\000\000\000\000\000\000\000\000\040\071\000"}, + {302, "listmaker", 0, 5, states_46, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\271\000"}, + {303, "lambdef", 0, 5, states_47, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, + {304, "trailer", 0, 7, states_48, "\000\000\001\000\000\000\020\000\000\000\000\000\000\040\000\000"}, - {304, "subscriptlist", 0, 3, states_48, - "\000\120\001\000\000\000\020\000\000\200\000\000\060\242\074\000"}, - {305, "subscript", 0, 7, states_49, - "\000\120\001\000\000\000\020\000\000\200\000\000\060\242\074\000"}, - {306, "sliceop", 0, 3, states_50, + {305, "subscriptlist", 0, 3, states_49, + "\000\120\001\000\000\000\020\000\000\200\000\000\060\042\271\000"}, + {306, "subscript", 0, 7, states_50, + "\000\120\001\000\000\000\020\000\000\200\000\000\060\042\271\000"}, + {307, "sliceop", 0, 3, states_51, "\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {307, "exprlist", 0, 3, states_51, - "\000\020\001\000\000\000\000\000\000\000\000\000\060\242\034\000"}, - {308, "testlist", 0, 3, states_52, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\074\000"}, - {309, "dictmaker", 0, 5, states_53, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\074\000"}, - {310, "classdef", 0, 8, states_54, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004"}, - {311, "arglist", 0, 8, states_55, - "\000\020\201\001\000\000\000\000\000\200\000\000\060\242\074\000"}, - {312, "argument", 0, 4, states_56, - "\000\020\001\000\000\000\000\000\000\200\000\000\060\242\074\000"}, -}; -static label labels[124] = { + {308, "exprlist", 0, 3, states_52, + "\000\020\001\000\000\000\000\000\000\000\000\000\060\042\071\000"}, + {309, "testlist", 0, 3, states_53, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\271\000"}, + {310, "dictmaker", 0, 5, states_54, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\271\000"}, + {311, "classdef", 0, 8, states_55, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\020"}, + {312, "arglist", 0, 8, states_56, + "\000\020\201\001\000\000\000\000\000\200\000\000\060\042\271\000"}, + {313, "argument", 0, 4, states_57, + "\000\020\001\000\000\000\000\000\000\200\000\000\060\042\271\000"}, + {314, "list_iter", 0, 2, states_58, + "\000\000\000\000\000\000\000\200\010\000\000\000\000\000\000\000"}, + {315, "list_for", 0, 6, states_59, + "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000"}, + {316, "list_if", 0, 4, states_60, + "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, +}; +static label labels[128] = { {0, "EMPTY"}, {256, 0}, {4, 0}, @@ -1349,7 +1440,7 @@ static label labels[124] = { {264, 0}, {0, 0}, {258, 0}, - {308, 0}, + {309, 0}, {259, 0}, {1, "def"}, {1, 0}, @@ -1379,7 +1470,7 @@ static label labels[124] = { {280, 0}, {1, "print"}, {1, "del"}, - {307, 0}, + {308, 0}, {1, "pass"}, {272, 0}, {273, 0}, @@ -1402,7 +1493,7 @@ static label labels[124] = { {283, 0}, {284, 0}, {285, 0}, - {310, 0}, + {311, 0}, {1, "if"}, {1, "elif"}, {1, "else"}, @@ -1416,7 +1507,7 @@ static label labels[124] = { {6, 0}, {289, 0}, {1, "or"}, - {302, 0}, + {303, 0}, {290, 0}, {1, "and"}, {1, "not"}, @@ -1448,26 +1539,30 @@ static label labels[124] = { {32, 0}, {300, 0}, {301, 0}, - {303, 0}, + {304, 0}, {9, 0}, + {302, 0}, {10, 0}, {26, 0}, - {309, 0}, + {310, 0}, {27, 0}, {25, 0}, {2, 0}, {3, 0}, + {314, 0}, {1, "lambda"}, - {311, 0}, - {304, 0}, + {312, 0}, {305, 0}, {306, 0}, + {307, 0}, {1, "class"}, - {312, 0}, + {313, 0}, + {315, 0}, + {316, 0}, }; grammar _PyParser_Grammar = { - 57, + 61, dfas, - {124, labels}, + {128, labels}, 256 }; |