summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c18
-rw-r--r--Python/compile.c76
-rw-r--r--Python/exceptions.c5
-rw-r--r--Python/graminit.c239
4 files changed, 212 insertions, 126 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 1103dfc736..d311537c8e 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -499,7 +499,14 @@ PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals)
/* Interpreter main loop */
PyObject *
-PyEval_EvalFrame(PyFrameObject *f)
+PyEval_EvalFrame(PyFrameObject *f) {
+ /* This is for backward compatibility with extension modules that
+ used this API; core interpreter code should call PyEval_EvalFrameEx() */
+ return PyEval_EvalFrameEx(f, 0);
+}
+
+PyObject *
+PyEval_EvalFrameEx(PyFrameObject *f, int throw)
{
#ifdef DXPAIRS
int lastopcode = 0;
@@ -747,6 +754,11 @@ PyEval_EvalFrame(PyFrameObject *f)
x = Py_None; /* Not a reference, just anything non-NULL */
w = NULL;
+ if (throw) { /* support for generator.throw() */
+ why = WHY_EXCEPTION;
+ goto on_error;
+ }
+
for (;;) {
#ifdef WITH_TSC
if (inst1 == 0) {
@@ -2733,7 +2745,7 @@ PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals,
return PyGen_New(f);
}
- retval = PyEval_EvalFrame(f);
+ retval = PyEval_EvalFrameEx(f,0);
fail: /* Jump here from prelude on failure */
@@ -3636,7 +3648,7 @@ fast_function(PyObject *func, PyObject ***pp_stack, int n, int na, int nk)
Py_INCREF(*stack);
fastlocals[i] = *stack++;
}
- retval = PyEval_EvalFrame(f);
+ retval = PyEval_EvalFrameEx(f,0);
assert(tstate != NULL);
++tstate->recursion_depth;
Py_DECREF(f);
diff --git a/Python/compile.c b/Python/compile.c
index 476dbe6e56..56b3a3e592 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2145,6 +2145,7 @@ com_gen_for(struct compiling *c, node *n, node *t, int is_outmost)
else {
com_test(c, t);
com_addbyte(c, YIELD_VALUE);
+ com_addbyte(c, POP_TOP);
com_pop(c, 1);
}
@@ -2193,6 +2194,7 @@ com_gen_if(struct compiling *c, node *n, node *t)
else {
com_test(c, t);
com_addbyte(c, YIELD_VALUE);
+ com_addbyte(c, POP_TOP);
com_pop(c, 1);
}
com_addfwref(c, JUMP_FORWARD, &anchor);
@@ -2354,6 +2356,10 @@ com_dictmaker(struct compiling *c, node *n)
}
}
+
+/* forward reference */
+static void com_yield_expr(struct compiling *c, node *n);
+
static void
com_atom(struct compiling *c, node *n)
{
@@ -2369,7 +2375,10 @@ com_atom(struct compiling *c, node *n)
com_push(c, 1);
}
else
- com_testlist_gexp(c, CHILD(n, 1));
+ if (TYPE(CHILD(n, 1)) == yield_expr)
+ com_yield_expr(c, CHILD(n, 1));
+ else
+ com_testlist_gexp(c, CHILD(n, 1));
break;
case LSQB: /* '[' [listmaker] ']' */
if (TYPE(CHILD(n, 1)) == RSQB) {
@@ -3436,7 +3445,11 @@ com_assign(struct compiling *c, node *n, int assigning, node *augn)
}
n = CHILD(n, 0);
break;
-
+ case yield_expr:
+ com_error(c, PyExc_SyntaxError,
+ "assignment to yield expression not possible");
+ return;
+
case test:
case and_test:
case not_test:
@@ -3493,7 +3506,7 @@ com_assign(struct compiling *c, node *n, int assigning, node *augn)
}
if (assigning > OP_APPLY) {
com_error(c, PyExc_SyntaxError,
- "augmented assign to tuple literal or generator expression not possible");
+ "augmented assign to tuple literal, yield, or generator expression not possible");
return;
}
break;
@@ -3729,27 +3742,42 @@ com_return_stmt(struct compiling *c, node *n)
}
static void
-com_yield_stmt(struct compiling *c, node *n)
+com_yield_expr(struct compiling *c, node *n)
{
int i;
- REQ(n, yield_stmt); /* 'yield' testlist */
+ REQ(n, yield_expr); /* 'yield' testlist */
if (!c->c_infunction) {
com_error(c, PyExc_SyntaxError, "'yield' outside function");
}
- for (i = 0; i < c->c_nblocks; ++i) {
+ /* for (i = 0; i < c->c_nblocks; ++i) {
if (c->c_block[i] == SETUP_FINALLY) {
com_error(c, PyExc_SyntaxError,
"'yield' not allowed in a 'try' block "
"with a 'finally' clause");
return;
}
+ } */
+
+ if (NCH(n) < 2) {
+ com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None));
+ com_push(c, 1);
}
- com_node(c, CHILD(n, 1));
+ else
+ com_node(c, CHILD(n, 1));
com_addbyte(c, YIELD_VALUE);
+}
+
+static void
+com_yield_stmt(struct compiling *c, node *n)
+{
+ REQ(n, yield_stmt); /* yield_expr */
+ com_node(c, CHILD(n, 0));
+ com_addbyte(c, POP_TOP);
com_pop(c, 1);
}
+
static void
com_raise_stmt(struct compiling *c, node *n)
{
@@ -4768,6 +4796,10 @@ com_node(struct compiling *c, node *n)
/* Expression nodes */
+ case yield_expr:
+ com_yield_expr(c, n);
+ break;
+
case testlist:
case testlist1:
case testlist_safe:
@@ -5027,7 +5059,9 @@ compile_generator_expression(struct compiling *c, node *n)
REQ(CHILD(n, 1), gen_for);
c->c_name = "<generator expression>";
+ c->c_infunction = 1;
com_gen_for(c, CHILD(n, 1), CHILD(n, 0), 1);
+ c->c_infunction = 0;
com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None));
com_push(c, 1);
@@ -6115,7 +6149,7 @@ symtable_add_def_o(struct symtable *st, PyObject *dict,
#define symtable_add_use(ST, NAME) symtable_add_def((ST), (NAME), USE)
-/* Look for a yield stmt under n. Return 1 if found, else 0.
+/* Look for a yield stmt or expr under n. Return 1 if found, else 0.
This hack is used to look inside "if 0:" blocks (which are normally
ignored) in case those are the only places a yield occurs (so that this
function is a generator). */
@@ -6137,6 +6171,7 @@ look_for_yield(node *n)
return 0;
case yield_stmt:
+ case yield_expr:
return GENERATOR;
default:
@@ -6247,8 +6282,10 @@ symtable_node(struct symtable *st, node *n)
case del_stmt:
symtable_assign(st, CHILD(n, 1), 0);
break;
- case yield_stmt:
+ case yield_expr:
st->st_cur->ste_generator = 1;
+ if (NCH(n)==1)
+ break;
n = CHILD(n, 1);
goto loop;
case expr_stmt:
@@ -6341,9 +6378,15 @@ symtable_node(struct symtable *st, node *n)
/* fall through */
case atom:
- if (TYPE(n) == atom && TYPE(CHILD(n, 0)) == NAME) {
- symtable_add_use(st, STR(CHILD(n, 0)));
- break;
+ if (TYPE(n) == atom) {
+ if (TYPE(CHILD(n, 0)) == NAME) {
+ symtable_add_use(st, STR(CHILD(n, 0)));
+ break;
+ }
+ else if (TYPE(CHILD(n,0)) == LPAR) {
+ n = CHILD(n,1);
+ goto loop;
+ }
}
/* fall through */
default:
@@ -6739,6 +6782,15 @@ symtable_assign(struct symtable *st, node *n, int def_flag)
symtable_add_def(st, STR(tmp), DEF_LOCAL | def_flag);
}
return;
+
+ case yield_expr:
+ st->st_cur->ste_generator = 1;
+ if (NCH(n)==2) {
+ n = CHILD(n, 1);
+ goto loop;
+ }
+ return;
+
case dotted_as_name:
if (NCH(n) == 3)
symtable_add_def(st, STR(CHILD(n, 2)),
diff --git a/Python/exceptions.c b/Python/exceptions.c
index 2fd74bc76d..2e7c820bf1 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -57,6 +57,7 @@ Exception\n\
|\n\
+-- SystemExit\n\
+-- StopIteration\n\
+ +-- GeneratorExit\n\
+-- StandardError\n\
| |\n\
| +-- KeyboardInterrupt\n\
@@ -394,6 +395,7 @@ PyDoc_STRVAR(StandardError__doc__,
PyDoc_STRVAR(TypeError__doc__, "Inappropriate argument type.");
PyDoc_STRVAR(StopIteration__doc__, "Signal the end from iterator.next().");
+PyDoc_STRVAR(GeneratorExit__doc__, "Request that a generator exit.");
@@ -1583,6 +1585,7 @@ static PyMethodDef functions[] = {
PyObject *PyExc_Exception;
PyObject *PyExc_StopIteration;
+PyObject *PyExc_GeneratorExit;
PyObject *PyExc_StandardError;
PyObject *PyExc_ArithmeticError;
PyObject *PyExc_LookupError;
@@ -1657,6 +1660,8 @@ static struct {
{"Exception", &PyExc_Exception},
{"StopIteration", &PyExc_StopIteration, &PyExc_Exception,
StopIteration__doc__},
+ {"GeneratorExit", &PyExc_GeneratorExit, &PyExc_Exception,
+ GeneratorExit__doc__},
{"StandardError", &PyExc_StandardError, &PyExc_Exception,
StandardError__doc__},
{"TypeError", &PyExc_TypeError, 0, TypeError__doc__},
diff --git a/Python/graminit.c b/Python/graminit.c
index 464f0aeddd..91d20f2ad1 100644
--- a/Python/graminit.c
+++ b/Python/graminit.c
@@ -279,10 +279,12 @@ static arc arcs_13_1[3] = {
{25, 3},
{0, 1},
};
-static arc arcs_13_2[1] = {
+static arc arcs_13_2[2] = {
+ {43, 4},
{9, 4},
};
-static arc arcs_13_3[1] = {
+static arc arcs_13_3[2] = {
+ {43, 5},
{9, 5},
};
static arc arcs_13_4[1] = {
@@ -295,13 +297,12 @@ static arc arcs_13_5[2] = {
static state states_13[6] = {
{1, arcs_13_0},
{3, arcs_13_1},
- {1, arcs_13_2},
- {1, arcs_13_3},
+ {2, arcs_13_2},
+ {2, arcs_13_3},
{1, arcs_13_4},
{2, arcs_13_5},
};
static arc arcs_14_0[12] = {
- {43, 1},
{44, 1},
{45, 1},
{46, 1},
@@ -313,6 +314,7 @@ static arc arcs_14_0[12] = {
{52, 1},
{53, 1},
{54, 1},
+ {55, 1},
};
static arc arcs_14_1[1] = {
{0, 1},
@@ -322,11 +324,11 @@ static state states_14[2] = {
{1, arcs_14_1},
};
static arc arcs_15_0[1] = {
- {55, 1},
+ {56, 1},
};
static arc arcs_15_1[3] = {
{26, 2},
- {56, 3},
+ {57, 3},
{0, 1},
};
static arc arcs_15_2[2] = {
@@ -367,10 +369,10 @@ static state states_15[9] = {
{2, arcs_15_8},
};
static arc arcs_16_0[1] = {
- {57, 1},
+ {58, 1},
};
static arc arcs_16_1[1] = {
- {58, 2},
+ {59, 2},
};
static arc arcs_16_2[1] = {
{0, 2},
@@ -381,7 +383,7 @@ static state states_16[3] = {
{1, arcs_16_2},
};
static arc arcs_17_0[1] = {
- {59, 1},
+ {60, 1},
};
static arc arcs_17_1[1] = {
{0, 1},
@@ -391,11 +393,11 @@ static state states_17[2] = {
{1, arcs_17_1},
};
static arc arcs_18_0[5] = {
- {60, 1},
{61, 1},
{62, 1},
{63, 1},
{64, 1},
+ {65, 1},
};
static arc arcs_18_1[1] = {
{0, 1},
@@ -405,7 +407,7 @@ static state states_18[2] = {
{1, arcs_18_1},
};
static arc arcs_19_0[1] = {
- {65, 1},
+ {66, 1},
};
static arc arcs_19_1[1] = {
{0, 1},
@@ -415,7 +417,7 @@ static state states_19[2] = {
{1, arcs_19_1},
};
static arc arcs_20_0[1] = {
- {66, 1},
+ {67, 1},
};
static arc arcs_20_1[1] = {
{0, 1},
@@ -425,7 +427,7 @@ static state states_20[2] = {
{1, arcs_20_1},
};
static arc arcs_21_0[1] = {
- {67, 1},
+ {68, 1},
};
static arc arcs_21_1[2] = {
{9, 2},
@@ -440,18 +442,14 @@ static state states_21[3] = {
{1, arcs_21_2},
};
static arc arcs_22_0[1] = {
- {68, 1},
+ {43, 1},
};
static arc arcs_22_1[1] = {
- {9, 2},
-};
-static arc arcs_22_2[1] = {
- {0, 2},
+ {0, 1},
};
-static state states_22[3] = {
+static state states_22[2] = {
{1, arcs_22_0},
{1, arcs_22_1},
- {1, arcs_22_2},
};
static arc arcs_23_0[1] = {
{69, 1},
@@ -779,7 +777,7 @@ static arc arcs_38_0[1] = {
{93, 1},
};
static arc arcs_38_1[1] = {
- {58, 2},
+ {59, 2},
};
static arc arcs_38_2[1] = {
{82, 3},
@@ -1034,7 +1032,7 @@ static arc arcs_50_0[1] = {
};
static arc arcs_50_1[3] = {
{123, 0},
- {56, 0},
+ {57, 0},
{0, 1},
};
static state states_50[2] = {
@@ -1113,7 +1111,8 @@ static arc arcs_55_0[7] = {
{144, 5},
{145, 6},
};
-static arc arcs_55_1[2] = {
+static arc arcs_55_1[3] = {
+ {43, 7},
{135, 7},
{15, 5},
};
@@ -1149,7 +1148,7 @@ static arc arcs_55_10[1] = {
};
static state states_55[11] = {
{7, arcs_55_0},
- {2, arcs_55_1},
+ {3, arcs_55_1},
{2, arcs_55_2},
{2, arcs_55_3},
{1, arcs_55_4},
@@ -1533,7 +1532,7 @@ static arc arcs_71_0[1] = {
{93, 1},
};
static arc arcs_71_1[1] = {
- {58, 2},
+ {59, 2},
};
static arc arcs_71_2[1] = {
{82, 3},
@@ -1590,7 +1589,7 @@ static arc arcs_74_0[1] = {
{93, 1},
};
static arc arcs_74_1[1] = {
- {58, 2},
+ {59, 2},
};
static arc arcs_74_2[1] = {
{82, 3},
@@ -1653,165 +1652,182 @@ static state states_77[2] = {
{1, arcs_77_0},
{1, arcs_77_1},
};
-static dfa dfas[78] = {
+static arc arcs_78_0[1] = {
+ {160, 1},
+};
+static arc arcs_78_1[2] = {
+ {9, 2},
+ {0, 1},
+};
+static arc arcs_78_2[1] = {
+ {0, 2},
+};
+static state states_78[3] = {
+ {1, arcs_78_0},
+ {2, arcs_78_1},
+ {1, arcs_78_2},
+};
+static dfa dfas[79] = {
{256, "single_input", 0, 3, states_0,
- "\004\050\014\000\000\000\200\012\076\205\011\162\000\002\000\140\010\111\023\002"},
+ "\004\050\014\000\000\000\000\025\074\205\011\162\000\002\000\140\010\111\023\002\001"},
{257, "file_input", 0, 2, states_1,
- "\204\050\014\000\000\000\200\012\076\205\011\162\000\002\000\140\010\111\023\002"},
+ "\204\050\014\000\000\000\000\025\074\205\011\162\000\002\000\140\010\111\023\002\001"},
{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\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\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\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,
- "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{261, "funcdef", 0, 7, states_5,
- "\000\010\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\010\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{262, "parameters", 0, 4, states_6,
- "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{263, "varargslist", 0, 10, states_7,
- "\000\040\010\060\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\040\010\060\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{264, "fpdef", 0, 4, states_8,
- "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{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\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\200\012\076\205\011\162\000\002\000\140\010\111\023\002"},
+ "\000\050\014\000\000\000\000\025\074\205\011\162\000\002\000\140\010\111\023\002\001"},
{267, "simple_stmt", 0, 4, states_11,
- "\000\040\010\000\000\000\200\012\076\205\011\000\000\002\000\140\010\111\023\000"},
+ "\000\040\010\000\000\000\000\025\074\205\011\000\000\002\000\140\010\111\023\000\001"},
{268, "small_stmt", 0, 2, states_12,
- "\000\040\010\000\000\000\200\012\076\205\011\000\000\002\000\140\010\111\023\000"},
+ "\000\040\010\000\000\000\000\025\074\205\011\000\000\002\000\140\010\111\023\000\001"},
{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\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"},
{270, "augassign", 0, 2, states_14,
- "\000\000\000\000\000\370\177\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\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,
- "\000\000\000\000\000\000\200\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"},
{272, "del_stmt", 0, 3, states_16,
- "\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{273, "pass_stmt", 0, 2, states_17,
- "\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\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\076\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\074\000\000\000\000\000\000\000\000\000\000\000\001"},
{275, "break_stmt", 0, 2, states_19,
- "\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000"},
+ "\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,
- "\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000"},
{277, "return_stmt", 0, 3, states_21,
- "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000"},
- {278, "yield_stmt", 0, 3, states_22,
- "\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000"},
+ "\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"},
{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\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,
- "\000\000\000\000\000\000\000\000\000\005\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\000\005\000\000\000\000\000\000\000\000\000\000\000"},
{281, "import_name", 0, 3, states_25,
- "\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\001\000\000\000\000\000\000\000\000\000\000\000"},
{282, "import_from", 0, 7, states_26,
- "\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000"},
{283, "import_as_name", 0, 4, states_27,
- "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{284, "dotted_as_name", 0, 4, states_28,
- "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{285, "import_as_names", 0, 3, states_29,
- "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{286, "dotted_as_names", 0, 2, states_30,
- "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{287, "dotted_name", 0, 2, states_31,
- "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{288, "global_stmt", 0, 3, states_32,
- "\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000"},
{289, "exec_stmt", 0, 7, states_33,
- "\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\001\000\000\000\000\000\000\000\000\000\000"},
{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\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\010\004\000\000\000\000\000\000\000\000\162\000\000\000\000\000\000\000\002\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\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,
- "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000"},
{294, "for_stmt", 0, 10, states_38,
- "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"},
{295, "try_stmt", 0, 10, states_39,
- "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"},
{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\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\200\012\076\205\011\000\000\002\000\140\010\111\023\000"},
+ "\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\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\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\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\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\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\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\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\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\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\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\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\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\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\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\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\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\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\100\000\000\000\000\000\000\000\001\000\000"},
+ "\000\040\000\000\000\000\000\000\000\100\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\100\000\000\000\002\000\140\010\111\023\000"},
+ "\000\040\050\000\000\000\000\000\000\100\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\100\000\000\000\002\000\140\010\111\023\000"},
+ "\000\040\050\000\000\000\000\000\000\100\000\000\000\002\000\140\010\111\023\000\000"},
{318, "sliceop", 0, 3, states_62,
- "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\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\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\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\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\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\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\040\010\060\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000\000"},
{325, "argument", 0, 5, states_69,
- "\000\040\010\000\000\000\000\000\000\000\000\000\000\002\000\140\010\111\023\000"},
+ "\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,
- "\000\000\000\000\000\000\000\000\000\000\000\042\000\000\000\000\000\000\000\000"},
+ "\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,
- "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"},
+ "\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,
- "\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"},
+ "\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,
- "\000\000\000\000\000\000\000\000\000\000\000\042\000\000\000\000\000\000\000\000"},
+ "\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,
- "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"},
+ "\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,
- "\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"},
+ "\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\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,
- "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\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"},
};
-static label labels[160] = {
+static label labels[161] = {
{0, "EMPTY"},
{256, 0},
{4, 0},
@@ -1855,6 +1871,7 @@ static label labels[160] = {
{289, 0},
{290, 0},
{270, 0},
+ {334, 0},
{37, 0},
{38, 0},
{39, 0},
@@ -1880,7 +1897,6 @@ static label labels[160] = {
{1, "break"},
{1, "continue"},
{1, "return"},
- {1, "yield"},
{1, "raise"},
{281, 0},
{282, 0},
@@ -1972,10 +1988,11 @@ static label labels[160] = {
{329, 0},
{331, 0},
{333, 0},
+ {1, "yield"},
};
grammar _PyParser_Grammar = {
- 78,
+ 79,
dfas,
- {160, labels},
+ {161, labels},
256
};