cpython/Include/graminit.h
Guido van Rossum 1c917072ca Very subtle syntax change: in a list comprehension, the testlist in
"for <var> in <testlist> may no longer be a single test followed by
a comma.  This solves SF bug #431886.  Note that if the testlist
contains more than one test, a trailing comma is still allowed, for
maximum backward compatibility; but this example is not:

    [(x, y) for x in range(10), for y in range(10)]
                              ^

The fix involved creating a new nonterminal 'testlist_safe' whose
definition doesn't allow the trailing comma if there's only one test:

    testlist_safe: test [(',' test)+ [',']]
2001-10-15 15:44:05 +00:00

67 lines
1.4 KiB
C

#define single_input 256
#define file_input 257
#define eval_input 258
#define funcdef 259
#define parameters 260
#define varargslist 261
#define fpdef 262
#define fplist 263
#define stmt 264
#define simple_stmt 265
#define small_stmt 266
#define expr_stmt 267
#define augassign 268
#define print_stmt 269
#define del_stmt 270
#define pass_stmt 271
#define flow_stmt 272
#define break_stmt 273
#define continue_stmt 274
#define return_stmt 275
#define yield_stmt 276
#define raise_stmt 277
#define import_stmt 278
#define import_as_name 279
#define dotted_as_name 280
#define dotted_name 281
#define global_stmt 282
#define exec_stmt 283
#define assert_stmt 284
#define compound_stmt 285
#define if_stmt 286
#define while_stmt 287
#define for_stmt 288
#define try_stmt 289
#define except_clause 290
#define suite 291
#define test 292
#define and_test 293
#define not_test 294
#define comparison 295
#define comp_op 296
#define expr 297
#define xor_expr 298
#define and_expr 299
#define shift_expr 300
#define arith_expr 301
#define term 302
#define factor 303
#define power 304
#define atom 305
#define listmaker 306
#define lambdef 307
#define trailer 308
#define subscriptlist 309
#define subscript 310
#define sliceop 311
#define exprlist 312
#define testlist 313
#define testlist_safe 314
#define dictmaker 315
#define classdef 316
#define arglist 317
#define argument 318
#define list_iter 319
#define list_for 320
#define list_if 321