From 81e9502df69394821416309c7c4b5357af51f4d5 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Tue, 27 Feb 2007 06:50:52 +0000 Subject: [PATCH] Provisional implementation of PEP 3104. Add nonlocal_stmt to Grammar and Nonlocal node to AST. They both parallel the definitions for globals. The symbol table treats variables declared as nonlocal just like variables that are free implicitly. This change is missing the language spec changes, but makes some decisions about what the spec should say via the unittests. The PEP is silent on a number of decisions, so we should review those before claiming that nonlocal is complete. Thomas Wouters made the grammer and ast changes. Jeremy Hylton added the symbol table changes and the tests. Pete Shinners and Neal Norwitz helped review the code. --- Grammar/Grammar | 3 +- Include/Python-ast.h | 10 +- Include/graminit.h | 101 +-- Include/symtable.h | 21 +- Lib/test/test_scope.py | 84 ++ Lib/test/test_syntax.py | 40 + Parser/Python.asdl | 1 + Python/Python-ast.c | 31 + Python/ast.c | 27 +- Python/compile.c | 1 + Python/graminit.c | 1714 ++++++++++++++++++++------------------- Python/symtable.c | 77 +- 12 files changed, 1188 insertions(+), 922 deletions(-) diff --git a/Grammar/Grammar b/Grammar/Grammar index 7606d6e12ad..02777994bcb 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -39,7 +39,7 @@ vfplist: vfpdef (',' vfpdef)* [','] stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | - import_stmt | global_stmt | assert_stmt) + import_stmt | global_stmt | nonlocal_stmt | assert_stmt) expr_stmt: testlist (augassign (yield_expr|testlist) | ('=' (yield_expr|testlist))*) augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | @@ -63,6 +63,7 @@ import_as_names: import_as_name (',' import_as_name)* [','] dotted_as_names: dotted_as_name (',' dotted_as_name)* dotted_name: NAME ('.' NAME)* global_stmt: 'global' NAME (',' NAME)* +nonlocal_stmt: 'nonlocal' NAME (',' NAME)* assert_stmt: 'assert' test [',' test] compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef diff --git a/Include/Python-ast.h b/Include/Python-ast.h index 66d7b52580e..233a5764bd3 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -66,7 +66,8 @@ enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3, While_kind=8, If_kind=9, With_kind=10, Raise_kind=11, TryExcept_kind=12, TryFinally_kind=13, Assert_kind=14, Import_kind=15, ImportFrom_kind=16, Global_kind=17, - Expr_kind=18, Pass_kind=19, Break_kind=20, Continue_kind=21}; + Nonlocal_kind=18, Expr_kind=19, Pass_kind=20, Break_kind=21, + Continue_kind=22}; struct _stmt { enum _stmt_kind kind; union { @@ -164,6 +165,10 @@ struct _stmt { asdl_seq *names; } Global; + struct { + asdl_seq *names; + } Nonlocal; + struct { expr_ty value; } Expr; @@ -422,6 +427,9 @@ stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int #define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3) stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena); +#define Nonlocal(a0, a1, a2, a3) _Py_Nonlocal(a0, a1, a2, a3) +stmt_ty _Py_Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena + *arena); #define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3) stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2) diff --git a/Include/graminit.h b/Include/graminit.h index 7da9004b76d..79e40c43019 100644 --- a/Include/graminit.h +++ b/Include/graminit.h @@ -35,53 +35,54 @@ #define dotted_as_names 290 #define dotted_name 291 #define global_stmt 292 -#define assert_stmt 293 -#define compound_stmt 294 -#define if_stmt 295 -#define while_stmt 296 -#define for_stmt 297 -#define try_stmt 298 -#define with_stmt 299 -#define with_var 300 -#define except_clause 301 -#define suite 302 -#define testlist_safe 303 -#define old_test 304 -#define old_lambdef 305 -#define test 306 -#define or_test 307 -#define and_test 308 -#define not_test 309 -#define comparison 310 -#define comp_op 311 -#define expr 312 -#define xor_expr 313 -#define and_expr 314 -#define shift_expr 315 -#define arith_expr 316 -#define term 317 -#define factor 318 -#define power 319 -#define atom 320 -#define listmaker 321 -#define testlist_gexp 322 -#define lambdef 323 -#define trailer 324 -#define subscriptlist 325 -#define subscript 326 -#define sliceop 327 -#define exprlist 328 -#define testlist 329 -#define dictsetmaker 330 -#define classdef 331 -#define arglist 332 -#define argument 333 -#define list_iter 334 -#define list_for 335 -#define list_if 336 -#define gen_iter 337 -#define gen_for 338 -#define gen_if 339 -#define testlist1 340 -#define encoding_decl 341 -#define yield_expr 342 +#define nonlocal_stmt 293 +#define assert_stmt 294 +#define compound_stmt 295 +#define if_stmt 296 +#define while_stmt 297 +#define for_stmt 298 +#define try_stmt 299 +#define with_stmt 300 +#define with_var 301 +#define except_clause 302 +#define suite 303 +#define testlist_safe 304 +#define old_test 305 +#define old_lambdef 306 +#define test 307 +#define or_test 308 +#define and_test 309 +#define not_test 310 +#define comparison 311 +#define comp_op 312 +#define expr 313 +#define xor_expr 314 +#define and_expr 315 +#define shift_expr 316 +#define arith_expr 317 +#define term 318 +#define factor 319 +#define power 320 +#define atom 321 +#define listmaker 322 +#define testlist_gexp 323 +#define lambdef 324 +#define trailer 325 +#define subscriptlist 326 +#define subscript 327 +#define sliceop 328 +#define exprlist 329 +#define testlist 330 +#define dictsetmaker 331 +#define classdef 332 +#define arglist 333 +#define argument 334 +#define list_iter 335 +#define list_for 336 +#define list_if 337 +#define gen_iter 338 +#define gen_for 339 +#define gen_if 340 +#define testlist1 341 +#define encoding_decl 342 +#define yield_expr 343 diff --git a/Include/symtable.h b/Include/symtable.h index f40bfa46662..5f50105b2b0 100644 --- a/Include/symtable.h +++ b/Include/symtable.h @@ -64,23 +64,24 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *); #define DEF_GLOBAL 1 /* global stmt */ #define DEF_LOCAL 2 /* assignment in code block */ #define DEF_PARAM 2<<1 /* formal parameter */ -#define USE 2<<2 /* name is used */ -#define DEF_STAR 2<<3 /* parameter is star arg */ -#define DEF_DOUBLESTAR 2<<4 /* parameter is star-star arg */ -#define DEF_INTUPLE 2<<5 /* name defined in tuple in parameters */ -#define DEF_FREE 2<<6 /* name used but not defined in nested block */ -#define DEF_FREE_GLOBAL 2<<7 /* free variable is actually implicit global */ -#define DEF_FREE_CLASS 2<<8 /* free variable from class's method */ -#define DEF_IMPORT 2<<9 /* assignment occurred via import */ +#define DEF_NONLOCAL 2<<2 /* nonlocal stmt */ +#define USE 2<<3 /* name is used */ +#define DEF_STAR 2<<4 /* parameter is star arg */ +#define DEF_DOUBLESTAR 2<<5 /* parameter is star-star arg */ +#define DEF_INTUPLE 2<<6 /* name defined in tuple in parameters */ +#define DEF_FREE 2<<7 /* name used but not defined in nested block */ +#define DEF_FREE_GLOBAL 2<<8 /* free variable is actually implicit global */ +#define DEF_FREE_CLASS 2<<9 /* free variable from class's method */ +#define DEF_IMPORT 2<<10 /* assignment occurred via import */ #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol table. GLOBAL is returned from PyST_GetScope() for either of them. - It is stored in ste_symbols at bits 12-14. + It is stored in ste_symbols at bits 12-15. */ #define SCOPE_OFF 11 -#define SCOPE_MASK 7 +#define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL) #define LOCAL 1 #define GLOBAL_EXPLICIT 2 diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index b9dc711ae3d..5fe1bc7c026 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -555,6 +555,90 @@ self.assert_(X.passed) f(4)() + def testNonLocalFunction(self): + + def f(x): + def inc(): + nonlocal x + x += 1 + return x + def dec(): + nonlocal x + x -= 1 + return x + return inc, dec + + inc, dec = f(0) + self.assertEqual(inc(), 1) + self.assertEqual(inc(), 2) + self.assertEqual(dec(), 1) + self.assertEqual(dec(), 0) + + def testNonLocalMethod(self): + + def f(x): + class c: + def inc(self): + nonlocal x + x += 1 + return x + def dec(self): + nonlocal x + x -= 1 + return x + return c() + + c = f(0) + self.assertEqual(c.inc(), 1) + self.assertEqual(c.inc(), 2) + self.assertEqual(c.dec(), 1) + self.assertEqual(c.dec(), 0) + + def testNonLocalClass(self): + + def f(x): + class c: + nonlocal x + x += 1 + def get(self): + return x + return c() + + c = f(0) + self.assertEqual(c.get(), 1) + self.assert_("x" not in c.__class__.__dict__) + + + def testNonLocalGenerator(self): + + def f(x): + def g(y): + nonlocal x + for i in range(y): + x += 1 + yield x + return g + + g = f(0) + self.assertEqual(list(g(5)), [1, 2, 3, 4, 5]) + + def testNestedNonLocal(self): + + def f(x): + def g(): + nonlocal x + x -= 2 + def h(): + nonlocal x + x += 4 + return x + return h + return g + + g = f(1) + h = g() + self.assertEqual(h(), 3) + def test_main(): run_unittest(ScopeTests) diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 8999e3a24b2..f37b666676f 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -367,6 +367,46 @@ build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514 ... SystemError: too many statically nested blocks +Misuse of the nonlocal statement can lead to a few unique syntax errors. + + >>> def f(x): + ... nonlocal x + Traceback (most recent call last): + ... + SyntaxError: name 'x' is local and nonlocal + + >>> def f(): + ... global x + ... nonlocal x + Traceback (most recent call last): + ... + SyntaxError: name 'x' is nonlocal and global + + >>> def f(): + ... nonlocal x + Traceback (most recent call last): + ... + SyntaxError: no binding for nonlocal 'x' found + +TODO(jhylton): Figure out how to test SyntaxWarning with doctest. + +## >>> def f(x): +## ... def f(): +## ... print(x) +## ... nonlocal x +## Traceback (most recent call last): +## ... +## SyntaxWarning: name 'x' is assigned to before nonlocal declaration + +## >>> def f(): +## ... x = 1 +## ... nonlocal x +## Traceback (most recent call last): +## ... +## SyntaxWarning: name 'x' is assigned to before nonlocal declaration + + + """ import re diff --git a/Parser/Python.asdl b/Parser/Python.asdl index c5b64a99232..3dc3c6005c1 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -34,6 +34,7 @@ module Python version "$Revision$" | ImportFrom(identifier module, alias* names, int? level) | Global(identifier* names) + | Nonlocal(identifier* names) | Expr(expr value) | Pass | Break | Continue diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 5aefbacf653..7f1640f57b1 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -131,6 +131,10 @@ static PyTypeObject *Global_type; static char *Global_fields[]={ "names", }; +static PyTypeObject *Nonlocal_type; +static char *Nonlocal_fields[]={ + "names", +}; static PyTypeObject *Expr_type; static char *Expr_fields[]={ "value", @@ -507,6 +511,8 @@ static int init_types(void) if (!ImportFrom_type) return 0; Global_type = make_type("Global", stmt_type, Global_fields, 1); if (!Global_type) return 0; + Nonlocal_type = make_type("Nonlocal", stmt_type, Nonlocal_fields, 1); + if (!Nonlocal_type) return 0; Expr_type = make_type("Expr", stmt_type, Expr_fields, 1); if (!Expr_type) return 0; Pass_type = make_type("Pass", stmt_type, NULL, 0); @@ -1145,6 +1151,20 @@ Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena) return p; } +stmt_ty +Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena *arena) +{ + stmt_ty p; + p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->kind = Nonlocal_kind; + p->v.Nonlocal.names = names; + p->lineno = lineno; + p->col_offset = col_offset; + return p; +} + stmt_ty Expr(expr_ty value, int lineno, int col_offset, PyArena *arena) { @@ -2197,6 +2217,15 @@ ast2obj_stmt(void* _o) goto failed; Py_DECREF(value); break; + case Nonlocal_kind: + result = PyType_GenericNew(Nonlocal_type, NULL, NULL); + if (!result) goto failed; + value = ast2obj_list(o->v.Nonlocal.names, ast2obj_identifier); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "names", value) == -1) + goto failed; + Py_DECREF(value); + break; case Expr_kind: result = PyType_GenericNew(Expr_type, NULL, NULL); if (!result) goto failed; @@ -3049,6 +3078,8 @@ init_ast(void) 0) return; if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0) return; + if (PyDict_SetItemString(d, "Nonlocal", (PyObject*)Nonlocal_type) < 0) + return; if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return; if (PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return; if (PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return; diff --git a/Python/ast.c b/Python/ast.c index 92b02f0522d..c8357b1b856 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2556,6 +2556,27 @@ ast_for_global_stmt(struct compiling *c, const node *n) return Global(s, LINENO(n), n->n_col_offset, c->c_arena); } +static stmt_ty +ast_for_nonlocal_stmt(struct compiling *c, const node *n) +{ + /* nonlocal_stmt: 'nonlocal' NAME (',' NAME)* */ + identifier name; + asdl_seq *s; + int i; + + REQ(n, nonlocal_stmt); + s = asdl_seq_new(NCH(n) / 2, c->c_arena); + if (!s) + return NULL; + for (i = 1; i < NCH(n); i += 2) { + name = NEW_IDENTIFIER(CHILD(n, i)); + if (!name) + return NULL; + asdl_seq_SET(s, i / 2, name); + } + return Nonlocal(s, LINENO(n), n->n_col_offset, c->c_arena); +} + static stmt_ty ast_for_assert_stmt(struct compiling *c, const node *n) { @@ -3063,8 +3084,8 @@ ast_for_stmt(struct compiling *c, const node *n) if (TYPE(n) == small_stmt) { REQ(n, small_stmt); n = CHILD(n, 0); - /* small_stmt: expr_stmt | del_stmt | pass_stmt - | flow_stmt | import_stmt | global_stmt | assert_stmt + /* small_stmt: expr_stmt | del_stmt | pass_stmt | flow_stmt + | import_stmt | global_stmt | nonlocal_stmt | assert_stmt */ switch (TYPE(n)) { case expr_stmt: @@ -3079,6 +3100,8 @@ ast_for_stmt(struct compiling *c, const node *n) return ast_for_import_stmt(c, n); case global_stmt: return ast_for_global_stmt(c, n); + case nonlocal_stmt: + return ast_for_nonlocal_stmt(c, n); case assert_stmt: return ast_for_assert_stmt(c, n); default: diff --git a/Python/compile.c b/Python/compile.c index 7f0fc503bb4..1e4dddf891b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2239,6 +2239,7 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s) case ImportFrom_kind: return compiler_from_import(c, s); case Global_kind: + case Nonlocal_kind: break; case Expr_kind: if (c->c_interactive && c->c_nestlevel <= 1) { diff --git a/Python/graminit.c b/Python/graminit.c index 72f5e0852a4..5c7fb6a5e2f 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -403,7 +403,7 @@ static state states_16[4] = { {2, arcs_16_2}, {1, arcs_16_3}, }; -static arc arcs_17_0[7] = { +static arc arcs_17_0[8] = { {39, 1}, {40, 1}, {41, 1}, @@ -411,28 +411,29 @@ static arc arcs_17_0[7] = { {43, 1}, {44, 1}, {45, 1}, + {46, 1}, }; static arc arcs_17_1[1] = { {0, 1}, }; static state states_17[2] = { - {7, arcs_17_0}, + {8, arcs_17_0}, {1, arcs_17_1}, }; static arc arcs_18_0[1] = { {9, 1}, }; static arc arcs_18_1[3] = { - {46, 2}, + {47, 2}, {27, 3}, {0, 1}, }; static arc arcs_18_2[2] = { - {47, 4}, + {48, 4}, {9, 4}, }; static arc arcs_18_3[2] = { - {47, 5}, + {48, 5}, {9, 5}, }; static arc arcs_18_4[1] = { @@ -451,7 +452,6 @@ static state states_18[6] = { {2, arcs_18_5}, }; static arc arcs_19_0[12] = { - {48, 1}, {49, 1}, {50, 1}, {51, 1}, @@ -463,6 +463,7 @@ static arc arcs_19_0[12] = { {57, 1}, {58, 1}, {59, 1}, + {60, 1}, }; static arc arcs_19_1[1] = { {0, 1}, @@ -472,10 +473,10 @@ static state states_19[2] = { {1, arcs_19_1}, }; static arc arcs_20_0[1] = { - {60, 1}, + {61, 1}, }; static arc arcs_20_1[1] = { - {61, 2}, + {62, 2}, }; static arc arcs_20_2[1] = { {0, 2}, @@ -486,7 +487,7 @@ static state states_20[3] = { {1, arcs_20_2}, }; static arc arcs_21_0[1] = { - {62, 1}, + {63, 1}, }; static arc arcs_21_1[1] = { {0, 1}, @@ -496,11 +497,11 @@ static state states_21[2] = { {1, arcs_21_1}, }; static arc arcs_22_0[5] = { - {63, 1}, {64, 1}, {65, 1}, {66, 1}, {67, 1}, + {68, 1}, }; static arc arcs_22_1[1] = { {0, 1}, @@ -510,7 +511,7 @@ static state states_22[2] = { {1, arcs_22_1}, }; static arc arcs_23_0[1] = { - {68, 1}, + {69, 1}, }; static arc arcs_23_1[1] = { {0, 1}, @@ -520,7 +521,7 @@ static state states_23[2] = { {1, arcs_23_1}, }; static arc arcs_24_0[1] = { - {69, 1}, + {70, 1}, }; static arc arcs_24_1[1] = { {0, 1}, @@ -530,7 +531,7 @@ static state states_24[2] = { {1, arcs_24_1}, }; static arc arcs_25_0[1] = { - {70, 1}, + {71, 1}, }; static arc arcs_25_1[2] = { {9, 2}, @@ -545,7 +546,7 @@ static state states_25[3] = { {1, arcs_25_2}, }; static arc arcs_26_0[1] = { - {47, 1}, + {48, 1}, }; static arc arcs_26_1[1] = { {0, 1}, @@ -555,7 +556,7 @@ static state states_26[2] = { {1, arcs_26_1}, }; static arc arcs_27_0[1] = { - {71, 1}, + {72, 1}, }; static arc arcs_27_1[2] = { {22, 2}, @@ -588,8 +589,8 @@ static state states_27[7] = { {1, arcs_27_6}, }; static arc arcs_28_0[2] = { - {72, 1}, {73, 1}, + {74, 1}, }; static arc arcs_28_1[1] = { {0, 1}, @@ -599,10 +600,10 @@ static state states_28[2] = { {1, arcs_28_1}, }; static arc arcs_29_0[1] = { - {74, 1}, + {75, 1}, }; static arc arcs_29_1[1] = { - {75, 2}, + {76, 2}, }; static arc arcs_29_2[1] = { {0, 2}, @@ -613,30 +614,30 @@ static state states_29[3] = { {1, arcs_29_2}, }; static arc arcs_30_0[1] = { - {76, 1}, + {77, 1}, }; static arc arcs_30_1[2] = { - {77, 2}, + {78, 2}, {12, 3}, }; static arc arcs_30_2[3] = { - {77, 2}, + {78, 2}, {12, 3}, - {74, 4}, + {75, 4}, }; static arc arcs_30_3[1] = { - {74, 4}, + {75, 4}, }; static arc arcs_30_4[3] = { {29, 5}, {13, 6}, - {78, 5}, + {79, 5}, }; static arc arcs_30_5[1] = { {0, 5}, }; static arc arcs_30_6[1] = { - {78, 7}, + {79, 7}, }; static arc arcs_30_7[1] = { {15, 5}, @@ -655,7 +656,7 @@ static arc arcs_31_0[1] = { {19, 1}, }; static arc arcs_31_1[2] = { - {80, 2}, + {81, 2}, {0, 1}, }; static arc arcs_31_2[1] = { @@ -674,7 +675,7 @@ static arc arcs_32_0[1] = { {12, 1}, }; static arc arcs_32_1[2] = { - {80, 2}, + {81, 2}, {0, 1}, }; static arc arcs_32_2[1] = { @@ -690,14 +691,14 @@ static state states_32[4] = { {1, arcs_32_3}, }; static arc arcs_33_0[1] = { - {79, 1}, + {80, 1}, }; static arc arcs_33_1[2] = { {28, 2}, {0, 1}, }; static arc arcs_33_2[2] = { - {79, 1}, + {80, 1}, {0, 2}, }; static state states_33[3] = { @@ -706,7 +707,7 @@ static state states_33[3] = { {2, arcs_33_2}, }; static arc arcs_34_0[1] = { - {81, 1}, + {82, 1}, }; static arc arcs_34_1[2] = { {28, 0}, @@ -720,7 +721,7 @@ static arc arcs_35_0[1] = { {19, 1}, }; static arc arcs_35_1[2] = { - {77, 0}, + {78, 0}, {0, 1}, }; static state states_35[2] = { @@ -728,7 +729,7 @@ static state states_35[2] = { {2, arcs_35_1}, }; static arc arcs_36_0[1] = { - {82, 1}, + {83, 1}, }; static arc arcs_36_1[1] = { {19, 2}, @@ -743,82 +744,61 @@ static state states_36[3] = { {2, arcs_36_2}, }; static arc arcs_37_0[1] = { - {83, 1}, + {84, 1}, }; static arc arcs_37_1[1] = { - {22, 2}, + {19, 2}, }; static arc arcs_37_2[2] = { - {28, 3}, + {28, 1}, {0, 2}, }; -static arc arcs_37_3[1] = { - {22, 4}, -}; -static arc arcs_37_4[1] = { - {0, 4}, -}; -static state states_37[5] = { +static state states_37[3] = { {1, arcs_37_0}, {1, arcs_37_1}, {2, arcs_37_2}, - {1, arcs_37_3}, - {1, arcs_37_4}, }; -static arc arcs_38_0[7] = { - {84, 1}, +static arc arcs_38_0[1] = { {85, 1}, +}; +static arc arcs_38_1[1] = { + {22, 2}, +}; +static arc arcs_38_2[2] = { + {28, 3}, + {0, 2}, +}; +static arc arcs_38_3[1] = { + {22, 4}, +}; +static arc arcs_38_4[1] = { + {0, 4}, +}; +static state states_38[5] = { + {1, arcs_38_0}, + {1, arcs_38_1}, + {2, arcs_38_2}, + {1, arcs_38_3}, + {1, arcs_38_4}, +}; +static arc arcs_39_0[7] = { {86, 1}, {87, 1}, {88, 1}, - {17, 1}, {89, 1}, -}; -static arc arcs_38_1[1] = { - {0, 1}, -}; -static state states_38[2] = { - {7, arcs_38_0}, - {1, arcs_38_1}, -}; -static arc arcs_39_0[1] = { {90, 1}, + {17, 1}, + {91, 1}, }; static arc arcs_39_1[1] = { - {22, 2}, + {0, 1}, }; -static arc arcs_39_2[1] = { - {23, 3}, -}; -static arc arcs_39_3[1] = { - {24, 4}, -}; -static arc arcs_39_4[3] = { - {91, 1}, - {92, 5}, - {0, 4}, -}; -static arc arcs_39_5[1] = { - {23, 6}, -}; -static arc arcs_39_6[1] = { - {24, 7}, -}; -static arc arcs_39_7[1] = { - {0, 7}, -}; -static state states_39[8] = { - {1, arcs_39_0}, +static state states_39[2] = { + {7, arcs_39_0}, {1, arcs_39_1}, - {1, arcs_39_2}, - {1, arcs_39_3}, - {3, arcs_39_4}, - {1, arcs_39_5}, - {1, arcs_39_6}, - {1, arcs_39_7}, }; static arc arcs_40_0[1] = { - {93, 1}, + {92, 1}, }; static arc arcs_40_1[1] = { {22, 2}, @@ -829,8 +809,9 @@ static arc arcs_40_2[1] = { static arc arcs_40_3[1] = { {24, 4}, }; -static arc arcs_40_4[2] = { - {92, 5}, +static arc arcs_40_4[3] = { + {93, 1}, + {94, 5}, {0, 4}, }; static arc arcs_40_5[1] = { @@ -847,299 +828,323 @@ static state states_40[8] = { {1, arcs_40_1}, {1, arcs_40_2}, {1, arcs_40_3}, - {2, arcs_40_4}, + {3, arcs_40_4}, {1, arcs_40_5}, {1, arcs_40_6}, {1, arcs_40_7}, }; static arc arcs_41_0[1] = { - {94, 1}, + {95, 1}, }; static arc arcs_41_1[1] = { - {61, 2}, + {22, 2}, }; static arc arcs_41_2[1] = { - {95, 3}, + {23, 3}, }; static arc arcs_41_3[1] = { - {9, 4}, + {24, 4}, }; -static arc arcs_41_4[1] = { - {23, 5}, +static arc arcs_41_4[2] = { + {94, 5}, + {0, 4}, }; static arc arcs_41_5[1] = { - {24, 6}, + {23, 6}, }; -static arc arcs_41_6[2] = { - {92, 7}, - {0, 6}, +static arc arcs_41_6[1] = { + {24, 7}, }; static arc arcs_41_7[1] = { - {23, 8}, + {0, 7}, }; -static arc arcs_41_8[1] = { - {24, 9}, -}; -static arc arcs_41_9[1] = { - {0, 9}, -}; -static state states_41[10] = { +static state states_41[8] = { {1, arcs_41_0}, {1, arcs_41_1}, {1, arcs_41_2}, {1, arcs_41_3}, - {1, arcs_41_4}, + {2, arcs_41_4}, {1, arcs_41_5}, - {2, arcs_41_6}, + {1, arcs_41_6}, {1, arcs_41_7}, - {1, arcs_41_8}, - {1, arcs_41_9}, }; static arc arcs_42_0[1] = { {96, 1}, }; static arc arcs_42_1[1] = { - {23, 2}, + {62, 2}, }; static arc arcs_42_2[1] = { - {24, 3}, + {97, 3}, }; -static arc arcs_42_3[2] = { - {97, 4}, - {98, 5}, +static arc arcs_42_3[1] = { + {9, 4}, }; static arc arcs_42_4[1] = { - {23, 6}, + {23, 5}, }; static arc arcs_42_5[1] = { - {23, 7}, + {24, 6}, }; -static arc arcs_42_6[1] = { - {24, 8}, +static arc arcs_42_6[2] = { + {94, 7}, + {0, 6}, }; static arc arcs_42_7[1] = { - {24, 9}, + {23, 8}, }; -static arc arcs_42_8[4] = { - {97, 4}, - {92, 10}, - {98, 5}, - {0, 8}, +static arc arcs_42_8[1] = { + {24, 9}, }; static arc arcs_42_9[1] = { {0, 9}, }; -static arc arcs_42_10[1] = { - {23, 11}, -}; -static arc arcs_42_11[1] = { - {24, 12}, -}; -static arc arcs_42_12[2] = { - {98, 5}, - {0, 12}, -}; -static state states_42[13] = { +static state states_42[10] = { {1, arcs_42_0}, {1, arcs_42_1}, {1, arcs_42_2}, - {2, arcs_42_3}, + {1, arcs_42_3}, {1, arcs_42_4}, {1, arcs_42_5}, - {1, arcs_42_6}, + {2, arcs_42_6}, {1, arcs_42_7}, - {4, arcs_42_8}, + {1, arcs_42_8}, {1, arcs_42_9}, - {1, arcs_42_10}, - {1, arcs_42_11}, - {2, arcs_42_12}, }; static arc arcs_43_0[1] = { - {99, 1}, + {98, 1}, }; static arc arcs_43_1[1] = { - {22, 2}, + {23, 2}, }; -static arc arcs_43_2[2] = { - {100, 3}, - {23, 4}, +static arc arcs_43_2[1] = { + {24, 3}, }; -static arc arcs_43_3[1] = { - {23, 4}, +static arc arcs_43_3[2] = { + {99, 4}, + {100, 5}, }; static arc arcs_43_4[1] = { - {24, 5}, + {23, 6}, }; static arc arcs_43_5[1] = { - {0, 5}, + {23, 7}, }; -static state states_43[6] = { +static arc arcs_43_6[1] = { + {24, 8}, +}; +static arc arcs_43_7[1] = { + {24, 9}, +}; +static arc arcs_43_8[4] = { + {99, 4}, + {94, 10}, + {100, 5}, + {0, 8}, +}; +static arc arcs_43_9[1] = { + {0, 9}, +}; +static arc arcs_43_10[1] = { + {23, 11}, +}; +static arc arcs_43_11[1] = { + {24, 12}, +}; +static arc arcs_43_12[2] = { + {100, 5}, + {0, 12}, +}; +static state states_43[13] = { {1, arcs_43_0}, {1, arcs_43_1}, - {2, arcs_43_2}, - {1, arcs_43_3}, + {1, arcs_43_2}, + {2, arcs_43_3}, {1, arcs_43_4}, {1, arcs_43_5}, + {1, arcs_43_6}, + {1, arcs_43_7}, + {4, arcs_43_8}, + {1, arcs_43_9}, + {1, arcs_43_10}, + {1, arcs_43_11}, + {2, arcs_43_12}, }; static arc arcs_44_0[1] = { - {80, 1}, + {101, 1}, }; static arc arcs_44_1[1] = { - {101, 2}, + {22, 2}, }; -static arc arcs_44_2[1] = { - {0, 2}, +static arc arcs_44_2[2] = { + {102, 3}, + {23, 4}, }; -static state states_44[3] = { +static arc arcs_44_3[1] = { + {23, 4}, +}; +static arc arcs_44_4[1] = { + {24, 5}, +}; +static arc arcs_44_5[1] = { + {0, 5}, +}; +static state states_44[6] = { {1, arcs_44_0}, {1, arcs_44_1}, - {1, arcs_44_2}, + {2, arcs_44_2}, + {1, arcs_44_3}, + {1, arcs_44_4}, + {1, arcs_44_5}, }; static arc arcs_45_0[1] = { - {102, 1}, + {81, 1}, }; -static arc arcs_45_1[2] = { +static arc arcs_45_1[1] = { + {103, 2}, +}; +static arc arcs_45_2[1] = { + {0, 2}, +}; +static state states_45[3] = { + {1, arcs_45_0}, + {1, arcs_45_1}, + {1, arcs_45_2}, +}; +static arc arcs_46_0[1] = { + {104, 1}, +}; +static arc arcs_46_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_45_2[2] = { - {80, 3}, +static arc arcs_46_2[2] = { + {81, 3}, {0, 2}, }; -static arc arcs_45_3[1] = { +static arc arcs_46_3[1] = { {19, 4}, }; -static arc arcs_45_4[1] = { +static arc arcs_46_4[1] = { {0, 4}, }; -static state states_45[5] = { - {1, arcs_45_0}, - {2, arcs_45_1}, - {2, arcs_45_2}, - {1, arcs_45_3}, - {1, arcs_45_4}, +static state states_46[5] = { + {1, arcs_46_0}, + {2, arcs_46_1}, + {2, arcs_46_2}, + {1, arcs_46_3}, + {1, arcs_46_4}, }; -static arc arcs_46_0[2] = { +static arc arcs_47_0[2] = { {3, 1}, {2, 2}, }; -static arc arcs_46_1[1] = { - {0, 1}, -}; -static arc arcs_46_2[1] = { - {103, 3}, -}; -static arc arcs_46_3[1] = { - {6, 4}, -}; -static arc arcs_46_4[2] = { - {6, 4}, - {104, 1}, -}; -static state states_46[5] = { - {2, arcs_46_0}, - {1, arcs_46_1}, - {1, arcs_46_2}, - {1, arcs_46_3}, - {2, arcs_46_4}, -}; -static arc arcs_47_0[1] = { - {106, 1}, -}; -static arc arcs_47_1[2] = { - {28, 2}, +static arc arcs_47_1[1] = { {0, 1}, }; static arc arcs_47_2[1] = { - {106, 3}, + {105, 3}, }; -static arc arcs_47_3[2] = { +static arc arcs_47_3[1] = { + {6, 4}, +}; +static arc arcs_47_4[2] = { + {6, 4}, + {106, 1}, +}; +static state states_47[5] = { + {2, arcs_47_0}, + {1, arcs_47_1}, + {1, arcs_47_2}, + {1, arcs_47_3}, + {2, arcs_47_4}, +}; +static arc arcs_48_0[1] = { + {108, 1}, +}; +static arc arcs_48_1[2] = { + {28, 2}, + {0, 1}, +}; +static arc arcs_48_2[1] = { + {108, 3}, +}; +static arc arcs_48_3[2] = { {28, 4}, {0, 3}, }; -static arc arcs_47_4[2] = { - {106, 3}, +static arc arcs_48_4[2] = { + {108, 3}, {0, 4}, }; -static state states_47[5] = { - {1, arcs_47_0}, - {2, arcs_47_1}, - {1, arcs_47_2}, - {2, arcs_47_3}, - {2, arcs_47_4}, +static state states_48[5] = { + {1, arcs_48_0}, + {2, arcs_48_1}, + {1, arcs_48_2}, + {2, arcs_48_3}, + {2, arcs_48_4}, }; -static arc arcs_48_0[2] = { - {107, 1}, - {108, 1}, +static arc arcs_49_0[2] = { + {109, 1}, + {110, 1}, }; -static arc arcs_48_1[1] = { +static arc arcs_49_1[1] = { {0, 1}, }; -static state states_48[2] = { - {2, arcs_48_0}, - {1, arcs_48_1}, +static state states_49[2] = { + {2, arcs_49_0}, + {1, arcs_49_1}, }; -static arc arcs_49_0[1] = { - {109, 1}, +static arc arcs_50_0[1] = { + {111, 1}, }; -static arc arcs_49_1[2] = { +static arc arcs_50_1[2] = { {33, 2}, {23, 3}, }; -static arc arcs_49_2[1] = { +static arc arcs_50_2[1] = { {23, 3}, }; -static arc arcs_49_3[1] = { - {106, 4}, -}; -static arc arcs_49_4[1] = { - {0, 4}, -}; -static state states_49[5] = { - {1, arcs_49_0}, - {2, arcs_49_1}, - {1, arcs_49_2}, - {1, arcs_49_3}, - {1, arcs_49_4}, -}; -static arc arcs_50_0[2] = { - {107, 1}, - {110, 2}, -}; -static arc arcs_50_1[2] = { - {90, 3}, - {0, 1}, -}; -static arc arcs_50_2[1] = { - {0, 2}, -}; static arc arcs_50_3[1] = { - {107, 4}, + {108, 4}, }; static arc arcs_50_4[1] = { - {92, 5}, + {0, 4}, }; -static arc arcs_50_5[1] = { - {22, 2}, -}; -static state states_50[6] = { - {2, arcs_50_0}, +static state states_50[5] = { + {1, arcs_50_0}, {2, arcs_50_1}, {1, arcs_50_2}, {1, arcs_50_3}, {1, arcs_50_4}, - {1, arcs_50_5}, }; -static arc arcs_51_0[1] = { - {111, 1}, +static arc arcs_51_0[2] = { + {109, 1}, + {112, 2}, }; static arc arcs_51_1[2] = { - {112, 0}, + {92, 3}, {0, 1}, }; -static state states_51[2] = { - {1, arcs_51_0}, +static arc arcs_51_2[1] = { + {0, 2}, +}; +static arc arcs_51_3[1] = { + {109, 4}, +}; +static arc arcs_51_4[1] = { + {94, 5}, +}; +static arc arcs_51_5[1] = { + {22, 2}, +}; +static state states_51[6] = { + {2, arcs_51_0}, {2, arcs_51_1}, + {1, arcs_51_2}, + {1, arcs_51_3}, + {1, arcs_51_4}, + {1, arcs_51_5}, }; static arc arcs_52_0[1] = { {113, 1}, @@ -1152,69 +1157,69 @@ static state states_52[2] = { {1, arcs_52_0}, {2, arcs_52_1}, }; -static arc arcs_53_0[2] = { +static arc arcs_53_0[1] = { {115, 1}, - {116, 2}, }; -static arc arcs_53_1[1] = { - {113, 2}, -}; -static arc arcs_53_2[1] = { - {0, 2}, -}; -static state states_53[3] = { - {2, arcs_53_0}, - {1, arcs_53_1}, - {1, arcs_53_2}, -}; -static arc arcs_54_0[1] = { - {101, 1}, -}; -static arc arcs_54_1[2] = { - {117, 0}, +static arc arcs_53_1[2] = { + {116, 0}, {0, 1}, }; -static state states_54[2] = { - {1, arcs_54_0}, - {2, arcs_54_1}, +static state states_53[2] = { + {1, arcs_53_0}, + {2, arcs_53_1}, }; -static arc arcs_55_0[9] = { - {118, 1}, - {119, 1}, +static arc arcs_54_0[2] = { + {117, 1}, + {118, 2}, +}; +static arc arcs_54_1[1] = { + {115, 2}, +}; +static arc arcs_54_2[1] = { + {0, 2}, +}; +static state states_54[3] = { + {2, arcs_54_0}, + {1, arcs_54_1}, + {1, arcs_54_2}, +}; +static arc arcs_55_0[1] = { + {103, 1}, +}; +static arc arcs_55_1[2] = { + {119, 0}, + {0, 1}, +}; +static state states_55[2] = { + {1, arcs_55_0}, + {2, arcs_55_1}, +}; +static arc arcs_56_0[9] = { {120, 1}, {121, 1}, {122, 1}, {123, 1}, - {95, 1}, - {115, 2}, - {124, 3}, + {124, 1}, + {125, 1}, + {97, 1}, + {117, 2}, + {126, 3}, }; -static arc arcs_55_1[1] = { +static arc arcs_56_1[1] = { {0, 1}, }; -static arc arcs_55_2[1] = { - {95, 1}, +static arc arcs_56_2[1] = { + {97, 1}, }; -static arc arcs_55_3[2] = { - {115, 1}, +static arc arcs_56_3[2] = { + {117, 1}, {0, 3}, }; -static state states_55[4] = { - {9, arcs_55_0}, - {1, arcs_55_1}, - {1, arcs_55_2}, - {2, arcs_55_3}, -}; -static arc arcs_56_0[1] = { - {125, 1}, -}; -static arc arcs_56_1[2] = { - {126, 0}, - {0, 1}, -}; -static state states_56[2] = { - {1, arcs_56_0}, - {2, arcs_56_1}, +static state states_56[4] = { + {9, arcs_56_0}, + {1, arcs_56_1}, + {1, arcs_56_2}, + {2, arcs_56_3}, }; static arc arcs_57_0[1] = { {127, 1}, @@ -1241,21 +1246,20 @@ static state states_58[2] = { static arc arcs_59_0[1] = { {131, 1}, }; -static arc arcs_59_1[3] = { +static arc arcs_59_1[2] = { {132, 0}, - {133, 0}, {0, 1}, }; static state states_59[2] = { {1, arcs_59_0}, - {3, arcs_59_1}, + {2, arcs_59_1}, }; static arc arcs_60_0[1] = { - {134, 1}, + {133, 1}, }; static arc arcs_60_1[3] = { + {134, 0}, {135, 0}, - {136, 0}, {0, 1}, }; static state states_60[2] = { @@ -1263,144 +1267,130 @@ static state states_60[2] = { {3, arcs_60_1}, }; static arc arcs_61_0[1] = { - {137, 1}, + {136, 1}, }; -static arc arcs_61_1[5] = { - {29, 0}, +static arc arcs_61_1[3] = { + {137, 0}, {138, 0}, - {139, 0}, - {140, 0}, {0, 1}, }; static state states_61[2] = { {1, arcs_61_0}, - {5, arcs_61_1}, + {3, arcs_61_1}, }; -static arc arcs_62_0[4] = { - {135, 1}, - {136, 1}, - {141, 1}, - {142, 2}, +static arc arcs_62_0[1] = { + {139, 1}, }; -static arc arcs_62_1[1] = { - {137, 2}, +static arc arcs_62_1[5] = { + {29, 0}, + {140, 0}, + {141, 0}, + {142, 0}, + {0, 1}, }; -static arc arcs_62_2[1] = { +static state states_62[2] = { + {1, arcs_62_0}, + {5, arcs_62_1}, +}; +static arc arcs_63_0[4] = { + {137, 1}, + {138, 1}, + {143, 1}, + {144, 2}, +}; +static arc arcs_63_1[1] = { + {139, 2}, +}; +static arc arcs_63_2[1] = { {0, 2}, }; -static state states_62[3] = { - {4, arcs_62_0}, - {1, arcs_62_1}, - {1, arcs_62_2}, +static state states_63[3] = { + {4, arcs_63_0}, + {1, arcs_63_1}, + {1, arcs_63_2}, }; -static arc arcs_63_0[1] = { - {143, 1}, +static arc arcs_64_0[1] = { + {145, 1}, }; -static arc arcs_63_1[3] = { - {144, 1}, +static arc arcs_64_1[3] = { + {146, 1}, {31, 2}, {0, 1}, }; -static arc arcs_63_2[1] = { - {137, 3}, +static arc arcs_64_2[1] = { + {139, 3}, }; -static arc arcs_63_3[1] = { +static arc arcs_64_3[1] = { {0, 3}, }; -static state states_63[4] = { - {1, arcs_63_0}, - {3, arcs_63_1}, - {1, arcs_63_2}, - {1, arcs_63_3}, -}; -static arc arcs_64_0[7] = { - {13, 1}, - {146, 2}, - {149, 3}, - {19, 4}, - {152, 4}, - {153, 5}, - {77, 6}, -}; -static arc arcs_64_1[3] = { - {47, 7}, - {145, 7}, - {15, 4}, -}; -static arc arcs_64_2[2] = { - {147, 8}, - {148, 4}, -}; -static arc arcs_64_3[2] = { - {150, 9}, - {151, 4}, -}; -static arc arcs_64_4[1] = { - {0, 4}, -}; -static arc arcs_64_5[2] = { - {153, 5}, - {0, 5}, -}; -static arc arcs_64_6[1] = { - {77, 10}, -}; -static arc arcs_64_7[1] = { - {15, 4}, -}; -static arc arcs_64_8[1] = { - {148, 4}, -}; -static arc arcs_64_9[1] = { - {151, 4}, -}; -static arc arcs_64_10[1] = { - {77, 4}, -}; -static state states_64[11] = { - {7, arcs_64_0}, +static state states_64[4] = { + {1, arcs_64_0}, {3, arcs_64_1}, - {2, arcs_64_2}, - {2, arcs_64_3}, - {1, arcs_64_4}, - {2, arcs_64_5}, - {1, arcs_64_6}, - {1, arcs_64_7}, - {1, arcs_64_8}, - {1, arcs_64_9}, - {1, arcs_64_10}, + {1, arcs_64_2}, + {1, arcs_64_3}, }; -static arc arcs_65_0[1] = { - {22, 1}, +static arc arcs_65_0[7] = { + {13, 1}, + {148, 2}, + {151, 3}, + {19, 4}, + {154, 4}, + {155, 5}, + {78, 6}, }; static arc arcs_65_1[3] = { - {154, 2}, - {28, 3}, - {0, 1}, + {48, 7}, + {147, 7}, + {15, 4}, }; -static arc arcs_65_2[1] = { - {0, 2}, +static arc arcs_65_2[2] = { + {149, 8}, + {150, 4}, }; static arc arcs_65_3[2] = { - {22, 4}, - {0, 3}, + {152, 9}, + {153, 4}, }; -static arc arcs_65_4[2] = { - {28, 3}, +static arc arcs_65_4[1] = { {0, 4}, }; -static state states_65[5] = { - {1, arcs_65_0}, +static arc arcs_65_5[2] = { + {155, 5}, + {0, 5}, +}; +static arc arcs_65_6[1] = { + {78, 10}, +}; +static arc arcs_65_7[1] = { + {15, 4}, +}; +static arc arcs_65_8[1] = { + {150, 4}, +}; +static arc arcs_65_9[1] = { + {153, 4}, +}; +static arc arcs_65_10[1] = { + {78, 4}, +}; +static state states_65[11] = { + {7, arcs_65_0}, {3, arcs_65_1}, - {1, arcs_65_2}, + {2, arcs_65_2}, {2, arcs_65_3}, - {2, arcs_65_4}, + {1, arcs_65_4}, + {2, arcs_65_5}, + {1, arcs_65_6}, + {1, arcs_65_7}, + {1, arcs_65_8}, + {1, arcs_65_9}, + {1, arcs_65_10}, }; static arc arcs_66_0[1] = { {22, 1}, }; static arc arcs_66_1[3] = { - {155, 2}, + {156, 2}, {28, 3}, {0, 1}, }; @@ -1423,144 +1413,154 @@ static state states_66[5] = { {2, arcs_66_4}, }; static arc arcs_67_0[1] = { - {109, 1}, + {22, 1}, }; -static arc arcs_67_1[2] = { - {33, 2}, - {23, 3}, +static arc arcs_67_1[3] = { + {157, 2}, + {28, 3}, + {0, 1}, }; static arc arcs_67_2[1] = { - {23, 3}, + {0, 2}, }; -static arc arcs_67_3[1] = { +static arc arcs_67_3[2] = { {22, 4}, + {0, 3}, }; -static arc arcs_67_4[1] = { +static arc arcs_67_4[2] = { + {28, 3}, {0, 4}, }; static state states_67[5] = { {1, arcs_67_0}, - {2, arcs_67_1}, + {3, arcs_67_1}, {1, arcs_67_2}, - {1, arcs_67_3}, - {1, arcs_67_4}, + {2, arcs_67_3}, + {2, arcs_67_4}, }; -static arc arcs_68_0[3] = { - {13, 1}, - {146, 2}, - {77, 3}, +static arc arcs_68_0[1] = { + {111, 1}, }; static arc arcs_68_1[2] = { - {14, 4}, - {15, 5}, + {33, 2}, + {23, 3}, }; static arc arcs_68_2[1] = { - {156, 6}, + {23, 3}, }; static arc arcs_68_3[1] = { - {19, 5}, + {22, 4}, }; static arc arcs_68_4[1] = { - {15, 5}, + {0, 4}, }; -static arc arcs_68_5[1] = { - {0, 5}, -}; -static arc arcs_68_6[1] = { - {148, 5}, -}; -static state states_68[7] = { - {3, arcs_68_0}, +static state states_68[5] = { + {1, arcs_68_0}, {2, arcs_68_1}, {1, arcs_68_2}, {1, arcs_68_3}, {1, arcs_68_4}, - {1, arcs_68_5}, - {1, arcs_68_6}, }; -static arc arcs_69_0[1] = { - {157, 1}, +static arc arcs_69_0[3] = { + {13, 1}, + {148, 2}, + {78, 3}, }; static arc arcs_69_1[2] = { + {14, 4}, + {15, 5}, +}; +static arc arcs_69_2[1] = { + {158, 6}, +}; +static arc arcs_69_3[1] = { + {19, 5}, +}; +static arc arcs_69_4[1] = { + {15, 5}, +}; +static arc arcs_69_5[1] = { + {0, 5}, +}; +static arc arcs_69_6[1] = { + {150, 5}, +}; +static state states_69[7] = { + {3, arcs_69_0}, + {2, arcs_69_1}, + {1, arcs_69_2}, + {1, arcs_69_3}, + {1, arcs_69_4}, + {1, arcs_69_5}, + {1, arcs_69_6}, +}; +static arc arcs_70_0[1] = { + {159, 1}, +}; +static arc arcs_70_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_69_2[2] = { - {157, 1}, +static arc arcs_70_2[2] = { + {159, 1}, {0, 2}, }; -static state states_69[3] = { - {1, arcs_69_0}, - {2, arcs_69_1}, - {2, arcs_69_2}, +static state states_70[3] = { + {1, arcs_70_0}, + {2, arcs_70_1}, + {2, arcs_70_2}, }; -static arc arcs_70_0[2] = { +static arc arcs_71_0[2] = { {22, 1}, {23, 2}, }; -static arc arcs_70_1[2] = { +static arc arcs_71_1[2] = { {23, 2}, {0, 1}, }; -static arc arcs_70_2[3] = { +static arc arcs_71_2[3] = { {22, 3}, - {158, 4}, + {160, 4}, {0, 2}, }; -static arc arcs_70_3[2] = { - {158, 4}, +static arc arcs_71_3[2] = { + {160, 4}, {0, 3}, }; -static arc arcs_70_4[1] = { +static arc arcs_71_4[1] = { {0, 4}, }; -static state states_70[5] = { - {2, arcs_70_0}, - {2, arcs_70_1}, - {3, arcs_70_2}, - {2, arcs_70_3}, - {1, arcs_70_4}, +static state states_71[5] = { + {2, arcs_71_0}, + {2, arcs_71_1}, + {3, arcs_71_2}, + {2, arcs_71_3}, + {1, arcs_71_4}, }; -static arc arcs_71_0[1] = { +static arc arcs_72_0[1] = { {23, 1}, }; -static arc arcs_71_1[2] = { +static arc arcs_72_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_71_2[1] = { - {0, 2}, -}; -static state states_71[3] = { - {1, arcs_71_0}, - {2, arcs_71_1}, - {1, arcs_71_2}, -}; -static arc arcs_72_0[1] = { - {101, 1}, -}; -static arc arcs_72_1[2] = { - {28, 2}, - {0, 1}, -}; -static arc arcs_72_2[2] = { - {101, 1}, +static arc arcs_72_2[1] = { {0, 2}, }; static state states_72[3] = { {1, arcs_72_0}, {2, arcs_72_1}, - {2, arcs_72_2}, + {1, arcs_72_2}, }; static arc arcs_73_0[1] = { - {22, 1}, + {103, 1}, }; static arc arcs_73_1[2] = { {28, 2}, {0, 1}, }; static arc arcs_73_2[2] = { - {22, 1}, + {103, 1}, {0, 2}, }; static state states_73[3] = { @@ -1571,482 +1571,500 @@ static state states_73[3] = { static arc arcs_74_0[1] = { {22, 1}, }; -static arc arcs_74_1[3] = { +static arc arcs_74_1[2] = { + {28, 2}, + {0, 1}, +}; +static arc arcs_74_2[2] = { + {22, 1}, + {0, 2}, +}; +static state states_74[3] = { + {1, arcs_74_0}, + {2, arcs_74_1}, + {2, arcs_74_2}, +}; +static arc arcs_75_0[1] = { + {22, 1}, +}; +static arc arcs_75_1[3] = { {23, 2}, {28, 3}, {0, 1}, }; -static arc arcs_74_2[1] = { +static arc arcs_75_2[1] = { {22, 4}, }; -static arc arcs_74_3[2] = { +static arc arcs_75_3[2] = { {22, 5}, {0, 3}, }; -static arc arcs_74_4[2] = { +static arc arcs_75_4[2] = { {28, 6}, {0, 4}, }; -static arc arcs_74_5[2] = { +static arc arcs_75_5[2] = { {28, 3}, {0, 5}, }; -static arc arcs_74_6[2] = { +static arc arcs_75_6[2] = { {22, 7}, {0, 6}, }; -static arc arcs_74_7[1] = { - {23, 2}, -}; -static state states_74[8] = { - {1, arcs_74_0}, - {3, arcs_74_1}, - {1, arcs_74_2}, - {2, arcs_74_3}, - {2, arcs_74_4}, - {2, arcs_74_5}, - {2, arcs_74_6}, - {1, arcs_74_7}, -}; -static arc arcs_75_0[1] = { - {159, 1}, -}; -static arc arcs_75_1[1] = { - {19, 2}, -}; -static arc arcs_75_2[2] = { - {13, 3}, - {23, 4}, -}; -static arc arcs_75_3[2] = { - {9, 5}, - {15, 6}, -}; -static arc arcs_75_4[1] = { - {24, 7}, -}; -static arc arcs_75_5[1] = { - {15, 6}, -}; -static arc arcs_75_6[1] = { - {23, 4}, -}; static arc arcs_75_7[1] = { - {0, 7}, + {23, 2}, }; static state states_75[8] = { {1, arcs_75_0}, - {1, arcs_75_1}, - {2, arcs_75_2}, + {3, arcs_75_1}, + {1, arcs_75_2}, {2, arcs_75_3}, - {1, arcs_75_4}, - {1, arcs_75_5}, - {1, arcs_75_6}, + {2, arcs_75_4}, + {2, arcs_75_5}, + {2, arcs_75_6}, {1, arcs_75_7}, }; -static arc arcs_76_0[3] = { - {160, 1}, - {29, 2}, - {31, 3}, +static arc arcs_76_0[1] = { + {161, 1}, }; -static arc arcs_76_1[2] = { - {28, 4}, - {0, 1}, +static arc arcs_76_1[1] = { + {19, 2}, }; -static arc arcs_76_2[1] = { - {22, 5}, +static arc arcs_76_2[2] = { + {13, 3}, + {23, 4}, }; -static arc arcs_76_3[1] = { - {22, 6}, +static arc arcs_76_3[2] = { + {9, 5}, + {15, 6}, }; -static arc arcs_76_4[4] = { - {160, 1}, - {29, 2}, - {31, 3}, - {0, 4}, +static arc arcs_76_4[1] = { + {24, 7}, }; -static arc arcs_76_5[2] = { - {28, 7}, - {0, 5}, +static arc arcs_76_5[1] = { + {15, 6}, }; static arc arcs_76_6[1] = { - {0, 6}, + {23, 4}, }; static arc arcs_76_7[1] = { - {31, 3}, + {0, 7}, }; static state states_76[8] = { - {3, arcs_76_0}, - {2, arcs_76_1}, - {1, arcs_76_2}, - {1, arcs_76_3}, - {4, arcs_76_4}, - {2, arcs_76_5}, + {1, arcs_76_0}, + {1, arcs_76_1}, + {2, arcs_76_2}, + {2, arcs_76_3}, + {1, arcs_76_4}, + {1, arcs_76_5}, {1, arcs_76_6}, {1, arcs_76_7}, }; -static arc arcs_77_0[1] = { - {22, 1}, +static arc arcs_77_0[3] = { + {162, 1}, + {29, 2}, + {31, 3}, }; -static arc arcs_77_1[3] = { - {155, 2}, - {27, 3}, +static arc arcs_77_1[2] = { + {28, 4}, {0, 1}, }; static arc arcs_77_2[1] = { - {0, 2}, + {22, 5}, }; static arc arcs_77_3[1] = { - {22, 2}, + {22, 6}, }; -static state states_77[4] = { - {1, arcs_77_0}, - {3, arcs_77_1}, - {1, arcs_77_2}, - {1, arcs_77_3}, -}; -static arc arcs_78_0[2] = { - {154, 1}, +static arc arcs_77_4[4] = { {162, 1}, -}; -static arc arcs_78_1[1] = { - {0, 1}, -}; -static state states_78[2] = { - {2, arcs_78_0}, - {1, arcs_78_1}, -}; -static arc arcs_79_0[1] = { - {94, 1}, -}; -static arc arcs_79_1[1] = { - {61, 2}, -}; -static arc arcs_79_2[1] = { - {95, 3}, -}; -static arc arcs_79_3[1] = { - {105, 4}, -}; -static arc arcs_79_4[2] = { - {161, 5}, + {29, 2}, + {31, 3}, {0, 4}, }; -static arc arcs_79_5[1] = { +static arc arcs_77_5[2] = { + {28, 7}, {0, 5}, }; -static state states_79[6] = { - {1, arcs_79_0}, - {1, arcs_79_1}, - {1, arcs_79_2}, - {1, arcs_79_3}, - {2, arcs_79_4}, - {1, arcs_79_5}, +static arc arcs_77_6[1] = { + {0, 6}, }; -static arc arcs_80_0[1] = { - {90, 1}, +static arc arcs_77_7[1] = { + {31, 3}, }; -static arc arcs_80_1[1] = { - {106, 2}, +static state states_77[8] = { + {3, arcs_77_0}, + {2, arcs_77_1}, + {1, arcs_77_2}, + {1, arcs_77_3}, + {4, arcs_77_4}, + {2, arcs_77_5}, + {1, arcs_77_6}, + {1, arcs_77_7}, }; -static arc arcs_80_2[2] = { - {161, 3}, - {0, 2}, +static arc arcs_78_0[1] = { + {22, 1}, }; -static arc arcs_80_3[1] = { - {0, 3}, -}; -static state states_80[4] = { - {1, arcs_80_0}, - {1, arcs_80_1}, - {2, arcs_80_2}, - {1, arcs_80_3}, -}; -static arc arcs_81_0[2] = { - {155, 1}, - {164, 1}, -}; -static arc arcs_81_1[1] = { +static arc arcs_78_1[3] = { + {157, 2}, + {27, 3}, {0, 1}, }; -static state states_81[2] = { - {2, arcs_81_0}, - {1, arcs_81_1}, +static arc arcs_78_2[1] = { + {0, 2}, }; -static arc arcs_82_0[1] = { - {94, 1}, +static arc arcs_78_3[1] = { + {22, 2}, }; -static arc arcs_82_1[1] = { - {61, 2}, +static state states_78[4] = { + {1, arcs_78_0}, + {3, arcs_78_1}, + {1, arcs_78_2}, + {1, arcs_78_3}, }; -static arc arcs_82_2[1] = { - {95, 3}, +static arc arcs_79_0[2] = { + {156, 1}, + {164, 1}, }; -static arc arcs_82_3[1] = { +static arc arcs_79_1[1] = { + {0, 1}, +}; +static state states_79[2] = { + {2, arcs_79_0}, + {1, arcs_79_1}, +}; +static arc arcs_80_0[1] = { + {96, 1}, +}; +static arc arcs_80_1[1] = { + {62, 2}, +}; +static arc arcs_80_2[1] = { + {97, 3}, +}; +static arc arcs_80_3[1] = { {107, 4}, }; -static arc arcs_82_4[2] = { +static arc arcs_80_4[2] = { {163, 5}, {0, 4}, }; -static arc arcs_82_5[1] = { +static arc arcs_80_5[1] = { {0, 5}, }; -static state states_82[6] = { - {1, arcs_82_0}, - {1, arcs_82_1}, - {1, arcs_82_2}, - {1, arcs_82_3}, - {2, arcs_82_4}, - {1, arcs_82_5}, +static state states_80[6] = { + {1, arcs_80_0}, + {1, arcs_80_1}, + {1, arcs_80_2}, + {1, arcs_80_3}, + {2, arcs_80_4}, + {1, arcs_80_5}, }; -static arc arcs_83_0[1] = { - {90, 1}, +static arc arcs_81_0[1] = { + {92, 1}, }; -static arc arcs_83_1[1] = { - {106, 2}, +static arc arcs_81_1[1] = { + {108, 2}, }; -static arc arcs_83_2[2] = { +static arc arcs_81_2[2] = { {163, 3}, {0, 2}, }; -static arc arcs_83_3[1] = { +static arc arcs_81_3[1] = { {0, 3}, }; -static state states_83[4] = { - {1, arcs_83_0}, - {1, arcs_83_1}, - {2, arcs_83_2}, - {1, arcs_83_3}, +static state states_81[4] = { + {1, arcs_81_0}, + {1, arcs_81_1}, + {2, arcs_81_2}, + {1, arcs_81_3}, }; -static arc arcs_84_0[1] = { - {22, 1}, +static arc arcs_82_0[2] = { + {157, 1}, + {166, 1}, }; -static arc arcs_84_1[2] = { - {28, 0}, +static arc arcs_82_1[1] = { {0, 1}, }; -static state states_84[2] = { +static state states_82[2] = { + {2, arcs_82_0}, + {1, arcs_82_1}, +}; +static arc arcs_83_0[1] = { + {96, 1}, +}; +static arc arcs_83_1[1] = { + {62, 2}, +}; +static arc arcs_83_2[1] = { + {97, 3}, +}; +static arc arcs_83_3[1] = { + {109, 4}, +}; +static arc arcs_83_4[2] = { + {165, 5}, + {0, 4}, +}; +static arc arcs_83_5[1] = { + {0, 5}, +}; +static state states_83[6] = { + {1, arcs_83_0}, + {1, arcs_83_1}, + {1, arcs_83_2}, + {1, arcs_83_3}, + {2, arcs_83_4}, + {1, arcs_83_5}, +}; +static arc arcs_84_0[1] = { + {92, 1}, +}; +static arc arcs_84_1[1] = { + {108, 2}, +}; +static arc arcs_84_2[2] = { + {165, 3}, + {0, 2}, +}; +static arc arcs_84_3[1] = { + {0, 3}, +}; +static state states_84[4] = { {1, arcs_84_0}, - {2, arcs_84_1}, + {1, arcs_84_1}, + {2, arcs_84_2}, + {1, arcs_84_3}, }; static arc arcs_85_0[1] = { - {19, 1}, + {22, 1}, }; -static arc arcs_85_1[1] = { +static arc arcs_85_1[2] = { + {28, 0}, {0, 1}, }; static state states_85[2] = { {1, arcs_85_0}, - {1, arcs_85_1}, + {2, arcs_85_1}, }; static arc arcs_86_0[1] = { - {167, 1}, + {19, 1}, }; -static arc arcs_86_1[2] = { +static arc arcs_86_1[1] = { + {0, 1}, +}; +static state states_86[2] = { + {1, arcs_86_0}, + {1, arcs_86_1}, +}; +static arc arcs_87_0[1] = { + {169, 1}, +}; +static arc arcs_87_1[2] = { {9, 2}, {0, 1}, }; -static arc arcs_86_2[1] = { +static arc arcs_87_2[1] = { {0, 2}, }; -static state states_86[3] = { - {1, arcs_86_0}, - {2, arcs_86_1}, - {1, arcs_86_2}, +static state states_87[3] = { + {1, arcs_87_0}, + {2, arcs_87_1}, + {1, arcs_87_2}, }; -static dfa dfas[87] = { +static dfa dfas[88] = { {256, "single_input", 0, 3, states_0, - "\004\050\014\000\000\000\000\120\360\064\014\144\011\040\010\000\200\041\044\203\200"}, + "\004\050\014\000\000\000\000\240\340\151\070\220\045\200\040\000\000\206\220\014\002\002"}, {257, "file_input", 0, 2, states_1, - "\204\050\014\000\000\000\000\120\360\064\014\144\011\040\010\000\200\041\044\203\200"}, + "\204\050\014\000\000\000\000\240\340\151\070\220\045\200\040\000\000\206\220\014\002\002"}, {258, "eval_input", 0, 3, states_2, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\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"}, + "\000\010\000\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"}, + "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {261, "funcdef", 0, 9, states_5, - "\000\010\004\000\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\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"}, + "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {263, "typedargslist", 0, 12, states_7, - "\000\040\010\240\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\040\010\240\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {264, "tname", 0, 4, states_8, - "\000\000\010\000\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"}, {265, "tfpdef", 0, 4, states_9, - "\000\040\010\000\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\000"}, {266, "tfplist", 0, 3, states_10, - "\000\040\010\000\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\000"}, {267, "varargslist", 0, 12, states_11, - "\000\040\010\240\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\040\010\240\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {268, "vname", 0, 2, states_12, - "\000\000\010\000\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"}, {269, "vfpdef", 0, 4, states_13, - "\000\040\010\000\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\000"}, {270, "vfplist", 0, 3, states_14, - "\000\040\010\000\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\000"}, {271, "stmt", 0, 2, states_15, - "\000\050\014\000\000\000\000\120\360\064\014\144\011\040\010\000\200\041\044\203\200"}, + "\000\050\014\000\000\000\000\240\340\151\070\220\045\200\040\000\000\206\220\014\002\002"}, {272, "simple_stmt", 0, 4, states_16, - "\000\040\010\000\000\000\000\120\360\064\014\000\000\040\010\000\200\041\044\003\200"}, + "\000\040\010\000\000\000\000\240\340\151\070\000\000\200\040\000\000\206\220\014\000\002"}, {273, "small_stmt", 0, 2, states_17, - "\000\040\010\000\000\000\000\120\360\064\014\000\000\040\010\000\200\041\044\003\200"}, + "\000\040\010\000\000\000\000\240\340\151\070\000\000\200\040\000\000\206\220\014\000\002"}, {274, "expr_stmt", 0, 6, states_18, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, {275, "augassign", 0, 2, states_19, - "\000\000\000\000\000\000\377\017\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\376\037\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {276, "del_stmt", 0, 3, states_20, - "\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\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {277, "pass_stmt", 0, 2, states_21, - "\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\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {278, "flow_stmt", 0, 2, states_22, - "\000\000\000\000\000\000\000\000\360\000\000\000\000\000\000\000\000\000\000\000\200"}, + "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\000\002"}, {279, "break_stmt", 0, 2, states_23, - "\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\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {280, "continue_stmt", 0, 2, states_24, - "\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\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {281, "return_stmt", 0, 3, states_25, - "\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\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {282, "yield_stmt", 0, 2, states_26, - "\000\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\000\000\000\000\000\000\000\000\000\000\002"}, {283, "raise_stmt", 0, 7, states_27, - "\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\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"}, {284, "import_stmt", 0, 2, states_28, - "\000\000\000\000\000\000\000\000\000\024\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\050\000\000\000\000\000\000\000\000\000\000\000\000"}, {285, "import_name", 0, 3, states_29, - "\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\000\010\000\000\000\000\000\000\000\000\000\000\000\000"}, {286, "import_from", 0, 8, states_30, - "\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\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, {287, "import_as_name", 0, 4, states_31, - "\000\000\010\000\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"}, {288, "dotted_as_name", 0, 4, states_32, - "\000\000\010\000\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"}, {289, "import_as_names", 0, 3, states_33, - "\000\000\010\000\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"}, {290, "dotted_as_names", 0, 2, states_34, - "\000\000\010\000\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"}, {291, "dotted_name", 0, 2, states_35, - "\000\000\010\000\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"}, {292, "global_stmt", 0, 3, states_36, - "\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000"}, - {293, "assert_stmt", 0, 5, states_37, - "\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000"}, - {294, "compound_stmt", 0, 2, states_38, - "\000\010\004\000\000\000\000\000\000\000\000\144\011\000\000\000\000\000\000\200\000"}, - {295, "if_stmt", 0, 8, states_39, - "\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, - {296, "while_stmt", 0, 8, states_40, - "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, - {297, "for_stmt", 0, 10, states_41, - "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"}, - {298, "try_stmt", 0, 13, states_42, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, - {299, "with_stmt", 0, 6, states_43, - "\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000"}, - {300, "with_var", 0, 3, states_44, - "\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000"}, - {301, "except_clause", 0, 5, states_45, - "\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000"}, - {302, "suite", 0, 5, states_46, - "\004\040\010\000\000\000\000\120\360\064\014\000\000\040\010\000\200\041\044\003\200"}, - {303, "testlist_safe", 0, 5, states_47, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {304, "old_test", 0, 2, states_48, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {305, "old_lambdef", 0, 5, states_49, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000"}, - {306, "test", 0, 6, states_50, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {307, "or_test", 0, 2, states_51, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\010\000\200\041\044\003\000"}, - {308, "and_test", 0, 2, states_52, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\010\000\200\041\044\003\000"}, - {309, "not_test", 0, 3, states_53, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\010\000\200\041\044\003\000"}, - {310, "comparison", 0, 2, states_54, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {311, "comp_op", 0, 4, states_55, - "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\310\037\000\000\000\000\000"}, - {312, "expr", 0, 2, states_56, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {313, "xor_expr", 0, 2, states_57, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {314, "and_expr", 0, 2, states_58, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {315, "shift_expr", 0, 2, states_59, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {316, "arith_expr", 0, 2, states_60, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {317, "term", 0, 2, states_61, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {318, "factor", 0, 3, states_62, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {319, "power", 0, 4, states_63, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\044\003\000"}, - {320, "atom", 0, 11, states_64, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\044\003\000"}, - {321, "listmaker", 0, 5, states_65, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {322, "testlist_gexp", 0, 5, states_66, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {323, "lambdef", 0, 5, states_67, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000"}, - {324, "trailer", 0, 7, states_68, - "\000\040\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\004\000\000"}, - {325, "subscriptlist", 0, 3, states_69, - "\000\040\210\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {326, "subscript", 0, 5, states_70, - "\000\040\210\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {327, "sliceop", 0, 3, states_71, - "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {328, "exprlist", 0, 3, states_72, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\044\003\000"}, - {329, "testlist", 0, 3, states_73, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {330, "dictsetmaker", 0, 8, states_74, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {331, "classdef", 0, 8, states_75, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, - {332, "arglist", 0, 8, states_76, - "\000\040\010\240\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {333, "argument", 0, 4, states_77, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {334, "list_iter", 0, 2, states_78, - "\000\000\000\000\000\000\000\000\000\000\000\104\000\000\000\000\000\000\000\000\000"}, - {335, "list_for", 0, 6, states_79, - "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"}, - {336, "list_if", 0, 4, states_80, - "\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, - {337, "gen_iter", 0, 2, states_81, - "\000\000\000\000\000\000\000\000\000\000\000\104\000\000\000\000\000\000\000\000\000"}, - {338, "gen_for", 0, 6, states_82, - "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"}, - {339, "gen_if", 0, 4, states_83, - "\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, - {340, "testlist1", 0, 2, states_84, - "\000\040\010\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\003\000"}, - {341, "encoding_decl", 0, 2, states_85, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {342, "yield_expr", 0, 3, states_86, - "\000\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\010\000\000\000\000\000\000\000\000\000\000\000"}, + {293, "nonlocal_stmt", 0, 3, states_37, + "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000"}, + {294, "assert_stmt", 0, 5, states_38, + "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, + {295, "compound_stmt", 0, 2, states_39, + "\000\010\004\000\000\000\000\000\000\000\000\220\045\000\000\000\000\000\000\000\002\000"}, + {296, "if_stmt", 0, 8, states_40, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, + {297, "while_stmt", 0, 8, states_41, + "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"}, + {298, "for_stmt", 0, 10, states_42, + "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + {299, "try_stmt", 0, 13, states_43, + "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, + {300, "with_stmt", 0, 6, states_44, + "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, + {301, "with_var", 0, 3, states_45, + "\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000"}, + {302, "except_clause", 0, 5, states_46, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, + {303, "suite", 0, 5, states_47, + "\004\040\010\000\000\000\000\240\340\151\070\000\000\200\040\000\000\206\220\014\000\002"}, + {304, "testlist_safe", 0, 5, states_48, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {305, "old_test", 0, 2, states_49, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {306, "old_lambdef", 0, 5, states_50, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, + {307, "test", 0, 6, states_51, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {308, "or_test", 0, 2, states_52, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\040\000\000\206\220\014\000\000"}, + {309, "and_test", 0, 2, states_53, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\040\000\000\206\220\014\000\000"}, + {310, "not_test", 0, 3, states_54, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\040\000\000\206\220\014\000\000"}, + {311, "comparison", 0, 2, states_55, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {312, "comp_op", 0, 4, states_56, + "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\040\177\000\000\000\000\000\000"}, + {313, "expr", 0, 2, states_57, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {314, "xor_expr", 0, 2, states_58, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {315, "and_expr", 0, 2, states_59, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {316, "shift_expr", 0, 2, states_60, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {317, "arith_expr", 0, 2, states_61, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {318, "term", 0, 2, states_62, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {319, "factor", 0, 3, states_63, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {320, "power", 0, 4, states_64, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\220\014\000\000"}, + {321, "atom", 0, 11, states_65, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\220\014\000\000"}, + {322, "listmaker", 0, 5, states_66, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {323, "testlist_gexp", 0, 5, states_67, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {324, "lambdef", 0, 5, states_68, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, + {325, "trailer", 0, 7, states_69, + "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\020\000\000\000"}, + {326, "subscriptlist", 0, 3, states_70, + "\000\040\210\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {327, "subscript", 0, 5, states_71, + "\000\040\210\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {328, "sliceop", 0, 3, states_72, + "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {329, "exprlist", 0, 3, states_73, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, + {330, "testlist", 0, 3, states_74, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {331, "dictsetmaker", 0, 8, states_75, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {332, "classdef", 0, 8, states_76, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000"}, + {333, "arglist", 0, 8, states_77, + "\000\040\010\240\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {334, "argument", 0, 4, states_78, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {335, "list_iter", 0, 2, states_79, + "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, + {336, "list_for", 0, 6, states_80, + "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + {337, "list_if", 0, 4, states_81, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, + {338, "gen_iter", 0, 2, states_82, + "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, + {339, "gen_for", 0, 6, states_83, + "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + {340, "gen_if", 0, 4, states_84, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, + {341, "testlist1", 0, 2, states_85, + "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + {342, "encoding_decl", 0, 2, states_86, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {343, "yield_expr", 0, 3, states_87, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002"}, }; -static label labels[168] = { +static label labels[170] = { {0, "EMPTY"}, {256, 0}, {4, 0}, {272, 0}, - {294, 0}, + {295, 0}, {257, 0}, {271, 0}, {0, 0}, {258, 0}, - {329, 0}, + {330, 0}, {259, 0}, {50, 0}, {291, 0}, {7, 0}, - {332, 0}, + {333, 0}, {8, 0}, {260, 0}, {261, 0}, @@ -2054,9 +2072,9 @@ static label labels[168] = { {1, 0}, {262, 0}, {51, 0}, - {306, 0}, + {307, 0}, {11, 0}, - {302, 0}, + {303, 0}, {263, 0}, {265, 0}, {22, 0}, @@ -2078,8 +2096,9 @@ static label labels[168] = { {284, 0}, {292, 0}, {293, 0}, + {294, 0}, {275, 0}, - {342, 0}, + {343, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -2093,7 +2112,7 @@ static label labels[168] = { {47, 0}, {49, 0}, {1, "del"}, - {328, 0}, + {329, 0}, {1, "pass"}, {279, 0}, {280, 0}, @@ -2115,13 +2134,14 @@ static label labels[168] = { {1, "as"}, {288, 0}, {1, "global"}, + {1, "nonlocal"}, {1, "assert"}, - {295, 0}, {296, 0}, {297, 0}, {298, 0}, {299, 0}, - {331, 0}, + {300, 0}, + {332, 0}, {1, "if"}, {1, "elif"}, {1, "else"}, @@ -2129,27 +2149,27 @@ static label labels[168] = { {1, "for"}, {1, "in"}, {1, "try"}, - {301, 0}, + {302, 0}, {1, "finally"}, {1, "with"}, - {300, 0}, - {312, 0}, + {301, 0}, + {313, 0}, {1, "except"}, {5, 0}, {6, 0}, - {303, 0}, {304, 0}, - {307, 0}, {305, 0}, - {1, "lambda"}, - {323, 0}, {308, 0}, - {1, "or"}, + {306, 0}, + {1, "lambda"}, + {324, 0}, {309, 0}, + {1, "or"}, + {310, 0}, {1, "and"}, {1, "not"}, - {310, 0}, {311, 0}, + {312, 0}, {20, 0}, {21, 0}, {28, 0}, @@ -2157,53 +2177,53 @@ static label labels[168] = { {30, 0}, {29, 0}, {1, "is"}, - {313, 0}, - {18, 0}, {314, 0}, - {33, 0}, + {18, 0}, {315, 0}, - {19, 0}, + {33, 0}, {316, 0}, + {19, 0}, + {317, 0}, {34, 0}, {35, 0}, - {317, 0}, + {318, 0}, {14, 0}, {15, 0}, - {318, 0}, + {319, 0}, {17, 0}, {24, 0}, {48, 0}, {32, 0}, - {319, 0}, {320, 0}, - {324, 0}, - {322, 0}, - {9, 0}, {321, 0}, + {325, 0}, + {323, 0}, + {9, 0}, + {322, 0}, {10, 0}, {26, 0}, - {330, 0}, + {331, 0}, {27, 0}, {2, 0}, {3, 0}, - {335, 0}, - {338, 0}, - {325, 0}, + {336, 0}, + {339, 0}, {326, 0}, {327, 0}, + {328, 0}, {1, "class"}, - {333, 0}, {334, 0}, - {336, 0}, + {335, 0}, {337, 0}, - {339, 0}, + {338, 0}, {340, 0}, {341, 0}, + {342, 0}, {1, "yield"}, }; grammar _PyParser_Grammar = { - 87, + 88, dfas, - {168, labels}, + {170, labels}, 256 }; diff --git a/Python/symtable.c b/Python/symtable.c index 1d76e0d025d..5bac2a2c9e9 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -8,9 +8,15 @@ #define GLOBAL_AFTER_ASSIGN \ "name '%.400s' is assigned to before global declaration" +#define NONLOCAL_AFTER_ASSIGN \ +"name '%.400s' is assigned to before nonlocal declaration" + #define GLOBAL_AFTER_USE \ "name '%.400s' is used prior to global declaration" +#define NONLOCAL_AFTER_USE \ +"name '%.400s' is used prior to nonlocal declaration" + #define IMPORT_STAR_WARNING "import * only allowed at module level" #define RETURN_VAL_IN_GENERATOR \ @@ -328,6 +334,8 @@ PyST_GetScope(PySTEntryObject *ste, PyObject *name) block, the name is treated as global until it is assigned to; then it is treated as a local. + TODO(jhylton): Discuss nonlocal + The symbol table requires two passes to determine the scope of each name. The first pass collects raw facts from the AST: the name is a parameter here, the name is used by not defined here, etc. The second pass analyzes @@ -378,6 +386,12 @@ analyze_name(PySTEntryObject *ste, PyObject *dict, PyObject *name, long flags, PyString_AS_STRING(name)); return 0; } + if (flags & DEF_NONLOCAL) { + PyErr_Format(PyExc_SyntaxError, + "name '%s' is nonlocal and global", + PyString_AS_STRING(name)); + return 0; + } SET_SCOPE(dict, name, GLOBAL_EXPLICIT); if (PyDict_SetItem(global, name, Py_None) < 0) return 0; @@ -387,6 +401,24 @@ analyze_name(PySTEntryObject *ste, PyObject *dict, PyObject *name, long flags, } return 1; } + if (flags & DEF_NONLOCAL) { + if (flags & DEF_PARAM) { + PyErr_Format(PyExc_SyntaxError, + "name '%s' is local and nonlocal", + PyString_AS_STRING(name)); + return 0; + } + if (!PyDict_GetItem(bound, name)) { + PyErr_Format(PyExc_SyntaxError, + "no binding for nonlocal '%s' found", + PyString_AS_STRING(name)); + + return 0; + } + SET_SCOPE(dict, name, FREE); + ste->ste_free = 1; + return PyDict_SetItem(free, name, Py_None) >= 0; + } if (flags & DEF_BOUND) { SET_SCOPE(dict, name, LOCAL); if (PyDict_SetItem(local, name, Py_None) < 0) @@ -405,24 +437,19 @@ analyze_name(PySTEntryObject *ste, PyObject *dict, PyObject *name, long flags, if (bound && PyDict_GetItem(bound, name)) { SET_SCOPE(dict, name, FREE); ste->ste_free = 1; - if (PyDict_SetItem(free, name, Py_None) < 0) - return 0; - return 1; + return PyDict_SetItem(free, name, Py_None) >= 0; } /* If a parent has a global statement, then call it global explicit? It could also be global implicit. */ - else if (global && PyDict_GetItem(global, name)) { + if (global && PyDict_GetItem(global, name)) { SET_SCOPE(dict, name, GLOBAL_EXPLICIT); return 1; } - else { - if (ste->ste_nested) - ste->ste_free = 1; - SET_SCOPE(dict, name, GLOBAL_IMPLICIT); - return 1; - } - return 0; /* Can't get here */ + if (ste->ste_nested) + ste->ste_free = 1; + SET_SCOPE(dict, name, GLOBAL_IMPLICIT); + return 1; } #undef SET_SCOPE @@ -782,6 +809,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) long val; PyObject *mangled = _Py_Mangle(st->st_private, name); + if (!mangled) return 0; dict = st->st_cur->ste_symbols; @@ -1075,6 +1103,33 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) } break; } + case Nonlocal_kind: { + int i; + asdl_seq *seq = s->v.Nonlocal.names; + for (i = 0; i < asdl_seq_LEN(seq); i++) { + identifier name = (identifier)asdl_seq_GET(seq, i); + char *c_name = PyString_AS_STRING(name); + long cur = symtable_lookup(st, name); + if (cur < 0) + return 0; + if (cur & (DEF_LOCAL | USE)) { + char buf[256]; + if (cur & DEF_LOCAL) + PyOS_snprintf(buf, sizeof(buf), + NONLOCAL_AFTER_ASSIGN, + c_name); + else + PyOS_snprintf(buf, sizeof(buf), + NONLOCAL_AFTER_USE, + c_name); + if (!symtable_warn(st, buf, s->lineno)) + return 0; + } + if (!symtable_add_def(st, name, DEF_NONLOCAL)) + return 0; + } + break; + } case Expr_kind: VISIT(st, expr, s->v.Expr.value); break;