Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 556440d

Browse files
committed
Added __assert__ statement (later to be renamed)
1 parent 659a3b5 commit 556440d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Grammar/Grammar

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fplist: fpdef (',' fpdef)* [',']
3030
stmt: simple_stmt | compound_stmt
3131
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
3232
#small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt
33-
small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt
33+
small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
3434
expr_stmt: testlist ('=' testlist)*
3535
# For assignments, additional restrictions enforced by the interpreter
3636
print_stmt: 'print' (test ',')* [test]
@@ -49,6 +49,7 @@ global_stmt: 'global' NAME (',' NAME)*
4949
## accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']
5050
## but can't be because that would create undesirable reserved words!
5151
exec_stmt: 'exec' expr ['in' test [',' test]]
52+
assert_stmt: '__assert__' test [',' test]
5253

5354
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
5455
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]

0 commit comments

Comments
 (0)