Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Grammar/Grammar
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
# For normal and annotated assignments, additional restrictions enforced by the interpreter
del_stmt: 'del' exprlist
pass_stmt: 'pass'
flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt | almog_stmt
flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt | almog_stmt | nope_stmt
break_stmt: 'break'
continue_stmt: 'continue'
return_stmt: 'return' [testlist_star_expr]
Expand All @@ -100,6 +100,7 @@ raise_stmt: 'raise' [test ['from' test]]
import_stmt: import_name | import_from
import_name: 'import' dotted_as_names
almog_stmt: 'almog'
nope_stmt: 'nope'
# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
'import' ('*' | '(' import_as_names ')' | import_as_names))
Expand Down
5 changes: 4 additions & 1 deletion Include/Python-ast.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 63 additions & 62 deletions Include/graminit.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Lib/keyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'is',
'lambda',
'nonlocal',
'nope',
'not',
'or',
'pass',
Expand Down
125 changes: 63 additions & 62 deletions Lib/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,68 +43,69 @@
import_stmt = 284
import_name = 285
almog_stmt = 286
import_from = 287
import_as_name = 288
dotted_as_name = 289
import_as_names = 290
dotted_as_names = 291
dotted_name = 292
global_stmt = 293
nonlocal_stmt = 294
assert_stmt = 295
compound_stmt = 296
async_stmt = 297
if_stmt = 298
while_stmt = 299
for_stmt = 300
try_stmt = 301
with_stmt = 302
with_item = 303
except_clause = 304
suite = 305
namedexpr_test = 306
test = 307
test_nocond = 308
lambdef = 309
lambdef_nocond = 310
or_test = 311
and_test = 312
not_test = 313
comparison = 314
comp_op = 315
star_expr = 316
expr = 317
xor_expr = 318
and_expr = 319
shift_expr = 320
arith_expr = 321
term = 322
factor = 323
power = 324
atom_expr = 325
atom = 326
testlist_comp = 327
trailer = 328
subscriptlist = 329
subscript = 330
sliceop = 331
exprlist = 332
testlist = 333
dictorsetmaker = 334
classdef = 335
arglist = 336
argument = 337
comp_iter = 338
sync_comp_for = 339
comp_for = 340
comp_if = 341
encoding_decl = 342
yield_expr = 343
yield_arg = 344
func_body_suite = 345
func_type_input = 346
func_type = 347
typelist = 348
nope_stmt = 287
import_from = 288
import_as_name = 289
dotted_as_name = 290
import_as_names = 291
dotted_as_names = 292
dotted_name = 293
global_stmt = 294
nonlocal_stmt = 295
assert_stmt = 296
compound_stmt = 297
async_stmt = 298
if_stmt = 299
while_stmt = 300
for_stmt = 301
try_stmt = 302
with_stmt = 303
with_item = 304
except_clause = 305
suite = 306
namedexpr_test = 307
test = 308
test_nocond = 309
lambdef = 310
lambdef_nocond = 311
or_test = 312
and_test = 313
not_test = 314
comparison = 315
comp_op = 316
star_expr = 317
expr = 318
xor_expr = 319
and_expr = 320
shift_expr = 321
arith_expr = 322
term = 323
factor = 324
power = 325
atom_expr = 326
atom = 327
testlist_comp = 328
trailer = 329
subscriptlist = 330
subscript = 331
sliceop = 332
exprlist = 333
testlist = 334
dictorsetmaker = 335
classdef = 336
arglist = 337
argument = 338
comp_iter = 339
sync_comp_for = 340
comp_for = 341
comp_if = 342
encoding_decl = 343
yield_expr = 344
yield_arg = 345
func_body_suite = 346
func_type_input = 347
func_type = 348
typelist = 349
#--end constants--

sym_name = {}
Expand Down
2 changes: 1 addition & 1 deletion Parser/Python.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module Python
| Global(identifier* names)
| Nonlocal(identifier* names)
| Expr(expr value)
| Pass | Break | Continue | Almog
| Pass | Break | Continue | Almog | Nope

-- XXX Jython will be different
-- col_offset is the byte offset in the utf8 string the parser uses
Expand Down
34 changes: 34 additions & 0 deletions Python/Python-ast.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -3553,6 +3553,9 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
case almog_stmt:
return Almog(LINENO(n), n->n_col_offset,
n->n_end_lineno, n->n_end_col_offset, c->c_arena);
case nope_stmt:
return Nope(LINENO(n), n->n_col_offset,
n->n_end_lineno, n->n_end_col_offset, c->c_arena);
case yield_stmt: { /* will reduce to yield_expr */
expr_ty exp = ast_for_expr(c, CHILD(ch, 0));
if (!exp)
Expand Down
Loading