mirror of
https://github.com/python/cpython.git
synced 2025-10-18 12:48:57 +00:00

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.
88 lines
1.9 KiB
C
88 lines
1.9 KiB
C
#define single_input 256
|
|
#define file_input 257
|
|
#define eval_input 258
|
|
#define decorator 259
|
|
#define decorators 260
|
|
#define funcdef 261
|
|
#define parameters 262
|
|
#define typedargslist 263
|
|
#define tname 264
|
|
#define tfpdef 265
|
|
#define tfplist 266
|
|
#define varargslist 267
|
|
#define vname 268
|
|
#define vfpdef 269
|
|
#define vfplist 270
|
|
#define stmt 271
|
|
#define simple_stmt 272
|
|
#define small_stmt 273
|
|
#define expr_stmt 274
|
|
#define augassign 275
|
|
#define del_stmt 276
|
|
#define pass_stmt 277
|
|
#define flow_stmt 278
|
|
#define break_stmt 279
|
|
#define continue_stmt 280
|
|
#define return_stmt 281
|
|
#define yield_stmt 282
|
|
#define raise_stmt 283
|
|
#define import_stmt 284
|
|
#define import_name 285
|
|
#define import_from 286
|
|
#define import_as_name 287
|
|
#define dotted_as_name 288
|
|
#define import_as_names 289
|
|
#define dotted_as_names 290
|
|
#define dotted_name 291
|
|
#define global_stmt 292
|
|
#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
|