Added __assert__ statement (later to be renamed)

This commit is contained in:
Guido van Rossum 1997-04-02 05:22:18 +00:00
parent 659a3b5881
commit 556440d278
1 changed files with 2 additions and 1 deletions

View File

@ -30,7 +30,7 @@ fplist: fpdef (',' fpdef)* [',']
stmt: simple_stmt | compound_stmt stmt: simple_stmt | compound_stmt
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
#small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt #small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt
small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
expr_stmt: testlist ('=' testlist)* expr_stmt: testlist ('=' testlist)*
# For assignments, additional restrictions enforced by the interpreter # For assignments, additional restrictions enforced by the interpreter
print_stmt: 'print' (test ',')* [test] print_stmt: 'print' (test ',')* [test]
@ -49,6 +49,7 @@ global_stmt: 'global' NAME (',' NAME)*
## accesstype should be ('public' | 'protected' | 'private') ['read'] ['write'] ## accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']
## but can't be because that would create undesirable reserved words! ## but can't be because that would create undesirable reserved words!
exec_stmt: 'exec' expr ['in' test [',' test]] exec_stmt: 'exec' expr ['in' test [',' test]]
assert_stmt: '__assert__' test [',' test]
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]