Skip to content

Commit cd19ec1

Browse files
author
nweinb
committed
Added ALMOG keyword with continue functionality
1 parent 580fbb0 commit cd19ec1

File tree

10 files changed

+1432
-1355
lines changed

10 files changed

+1432
-1355
lines changed

Grammar/Grammar

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
9191
# For normal and annotated assignments, additional restrictions enforced by the interpreter
9292
del_stmt: 'del' exprlist
9393
pass_stmt: 'pass'
94-
flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt
94+
flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt | almog_stmt
9595
break_stmt: 'break'
9696
continue_stmt: 'continue'
9797
return_stmt: 'return' [testlist_star_expr]
9898
yield_stmt: yield_expr
9999
raise_stmt: 'raise' [test ['from' test]]
100100
import_stmt: import_name | import_from
101101
import_name: 'import' dotted_as_names
102+
almog_stmt: 'almog'
102103
# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
103104
import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
104105
'import' ('*' | '(' import_as_names ')' | import_as_names))

Include/Python-ast.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/graminit.h

Lines changed: 63 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/keyword.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'False',
1919
'None',
2020
'True',
21+
'almog',
2122
'and',
2223
'as',
2324
'assert',

Lib/symbol.py

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -42,68 +42,69 @@
4242
raise_stmt = 283
4343
import_stmt = 284
4444
import_name = 285
45-
import_from = 286
46-
import_as_name = 287
47-
dotted_as_name = 288
48-
import_as_names = 289
49-
dotted_as_names = 290
50-
dotted_name = 291
51-
global_stmt = 292
52-
nonlocal_stmt = 293
53-
assert_stmt = 294
54-
compound_stmt = 295
55-
async_stmt = 296
56-
if_stmt = 297
57-
while_stmt = 298
58-
for_stmt = 299
59-
try_stmt = 300
60-
with_stmt = 301
61-
with_item = 302
62-
except_clause = 303
63-
suite = 304
64-
namedexpr_test = 305
65-
test = 306
66-
test_nocond = 307
67-
lambdef = 308
68-
lambdef_nocond = 309
69-
or_test = 310
70-
and_test = 311
71-
not_test = 312
72-
comparison = 313
73-
comp_op = 314
74-
star_expr = 315
75-
expr = 316
76-
xor_expr = 317
77-
and_expr = 318
78-
shift_expr = 319
79-
arith_expr = 320
80-
term = 321
81-
factor = 322
82-
power = 323
83-
atom_expr = 324
84-
atom = 325
85-
testlist_comp = 326
86-
trailer = 327
87-
subscriptlist = 328
88-
subscript = 329
89-
sliceop = 330
90-
exprlist = 331
91-
testlist = 332
92-
dictorsetmaker = 333
93-
classdef = 334
94-
arglist = 335
95-
argument = 336
96-
comp_iter = 337
97-
sync_comp_for = 338
98-
comp_for = 339
99-
comp_if = 340
100-
encoding_decl = 341
101-
yield_expr = 342
102-
yield_arg = 343
103-
func_body_suite = 344
104-
func_type_input = 345
105-
func_type = 346
106-
typelist = 347
45+
almog_stmt = 286
46+
import_from = 287
47+
import_as_name = 288
48+
dotted_as_name = 289
49+
import_as_names = 290
50+
dotted_as_names = 291
51+
dotted_name = 292
52+
global_stmt = 293
53+
nonlocal_stmt = 294
54+
assert_stmt = 295
55+
compound_stmt = 296
56+
async_stmt = 297
57+
if_stmt = 298
58+
while_stmt = 299
59+
for_stmt = 300
60+
try_stmt = 301
61+
with_stmt = 302
62+
with_item = 303
63+
except_clause = 304
64+
suite = 305
65+
namedexpr_test = 306
66+
test = 307
67+
test_nocond = 308
68+
lambdef = 309
69+
lambdef_nocond = 310
70+
or_test = 311
71+
and_test = 312
72+
not_test = 313
73+
comparison = 314
74+
comp_op = 315
75+
star_expr = 316
76+
expr = 317
77+
xor_expr = 318
78+
and_expr = 319
79+
shift_expr = 320
80+
arith_expr = 321
81+
term = 322
82+
factor = 323
83+
power = 324
84+
atom_expr = 325
85+
atom = 326
86+
testlist_comp = 327
87+
trailer = 328
88+
subscriptlist = 329
89+
subscript = 330
90+
sliceop = 331
91+
exprlist = 332
92+
testlist = 333
93+
dictorsetmaker = 334
94+
classdef = 335
95+
arglist = 336
96+
argument = 337
97+
comp_iter = 338
98+
sync_comp_for = 339
99+
comp_for = 340
100+
comp_if = 341
101+
encoding_decl = 342
102+
yield_expr = 343
103+
yield_arg = 344
104+
func_body_suite = 345
105+
func_type_input = 346
106+
func_type = 347
107+
typelist = 348
107108
#--end constants--
108109

109110
sym_name = {}

Parser/Python.asdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module Python
4949
| Global(identifier* names)
5050
| Nonlocal(identifier* names)
5151
| Expr(expr value)
52-
| Pass | Break | Continue
52+
| Pass | Break | Continue | Almog
5353

5454
-- XXX Jython will be different
5555
-- col_offset is the byte offset in the utf8 string the parser uses

Python/Python-ast.c

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)