single_input | ::= | ( <NEWLINE> )* ( ( simple_stmt | compound_stmt <NEWLINE> ) )? ( <NEWLINE> )* <EOF> |
file_input | ::= | ( <NEWLINE> | stmt )* <EOF> |
eval_input | ::= | ( <NEWLINE> )* SmartTestList ( <NEWLINE> )* <EOF> |
funcdef | ::= | decorators <DEF> AnyName parameters <COLON> suite |
decorators | ::= | ( begin_decorator ( <LPAREN> insidetuporcall <RPAREN> )* <NEWLINE> )* |
begin_decorator | ::= | <AT> dotted_name |
parameters | ::= | <LPAREN> ( varargslist )? <RPAREN> |
varargslist | ::= | defaultarg ( <COMMA> defaultarg )* ( <COMMA> ExtraArgList )? ( <COMMA> ExtraKeywordList )? ( <COMMA> )? |
| | ( ExtraArgList ( <COMMA> ExtraKeywordList )? | ExtraKeywordList ) | |
ExtraArgList | ::= | <MULTIPLY> Name |
ExtraKeywordList | ::= | ( <POWER> | <MULTIPLY> <MULTIPLY> ) Name |
defaultarg | ::= | fpdef ( <EQUAL> test )? |
fpdef | ::= | Name |
| | <LPAREN> fplist <RPAREN> | |
fplist | ::= | fpdef ( <COMMA> fpdef )* ( <COMMA> )? |
stmt | ::= | simple_stmt |
| | compound_stmt | |
simple_stmt | ::= | small_stmt ( <SEMICOLON> small_stmt )* ( <SEMICOLON> )? <NEWLINE> |
small_stmt | ::= | expr_stmt |
| | print_stmt | |
| | del_stmt | |
| | pass_stmt | |
| | flow_stmt | |
| | import_stmt | |
| | global_stmt | |
| | exec_stmt | |
| | assert_stmt | |
expr_stmt | ::= | SmartTestList ( <PLUSEQ> SmartTestList | <MINUSEQ> SmartTestList | <MULTIPLYEQ> SmartTestList | <DIVIDEEQ> SmartTestList | <FLOORDIVIDEEQ> SmartTestList | <MODULOEQ> SmartTestList | <ANDEQ> SmartTestList | <OREQ> SmartTestList | <XOREQ> SmartTestList | <LSHIFTEQ> SmartTestList | <RSHIFTEQ> SmartTestList | <POWEREQ> SmartTestList | ( <EQUAL> SmartTestList )* ) |
print_stmt | ::= | <PRINT> <RSHIFT> ( test ( ( <COMMA> test )+ ( Comma )? )? ) |
| | <PRINT> ( test ( <COMMA> test )* ( Comma )? ) | |
| | <PRINT> | |
del_stmt | ::= | begin_del_stmt exprlist |
begin_del_stmt | ::= | <DEL> |
pass_stmt | ::= | <PASS> |
flow_stmt | ::= | <BREAK> |
| | <CONTINUE> | |
| | return_stmt | |
| | yield_stmt | |
| | raise_stmt | |
return_stmt | ::= | begin_return_stmt ( SmartTestList )? |
begin_return_stmt | ::= | <RETURN> |
yield_stmt | ::= | <YIELD> SmartTestList |
raise_stmt | ::= | <RAISE> ( test ( <COMMA> test ( <COMMA> test )? )? )? |
import_stmt | ::= | <IMPORT> Import |
| | <FROM> ImportFrom | |
Import | ::= | dotted_as_name ( <COMMA> dotted_as_name )* |
ImportFrom | ::= | dotted_name <IMPORT> ( <MULTIPLY> | ( import_as_name ( <COMMA> import_as_name )* ) | <LPAREN> import_as_name ( ( <COMMA> ( import_as_name )? )* <RPAREN> ) ) |
dotted_as_name | ::= | dotted_name ( <AS> Name )? |
dotted_name | ::= | AnyName ( <DOT> AnyName )* |
import_as_name | ::= | AnyName ( <AS> Name )? |
global_stmt | ::= | <GLOBAL> Name ( <COMMA> Name )* |
exec_stmt | ::= | <EXEC> expr ( <IN> test ( <COMMA> test )? )? |
assert_stmt | ::= | <ASSERT> test ( <COMMA> test )? |
compound_stmt | ::= | if_stmt |
| | while_stmt | |
| | for_stmt | |
| | try_stmt | |
| | funcdef | |
| | classdef | |
if_stmt | ::= | begin_if_stmt test <COLON> suite ( begin_elif_stmt test <COLON> suite )* ( <ELSE> <COLON> suite )? |
begin_if_stmt | ::= | <IF> |
begin_elif_stmt | ::= | <ELIF> |
while_stmt | ::= | begin_while_stmt test <COLON> suite ( begin_else_stmt suite )? |
begin_while_stmt | ::= | <WHILE> |
begin_else_stmt | ::= | <ELSE> <COLON> |
for_stmt | ::= | begin_for_stmt exprlist <IN> SmartTestList <COLON> suite ( begin_for_else_stmt suite )? |
begin_for_stmt | ::= | <FOR> |
begin_for_else_stmt | ::= | <ELSE> <COLON> |
try_stmt | ::= | begin_try_stmt suite ( ( ( except_clause )+ ( begin_try_else_stmt suite )? ) | begin_finally_stmt suite ) |
begin_try_stmt | ::= | <TRY> <COLON> |
begin_try_else_stmt | ::= | <ELSE> <COLON> |
begin_finally_stmt | ::= | <FINALLY> <COLON> |
except_clause | ::= | begin_except_clause ( test ( <COMMA> test )? )? <COLON> suite |
begin_except_clause | ::= | <EXCEPT> |
suite | ::= | ( simple_stmt | <NEWLINE> <INDENT> ( stmt )+ <DEDENT> ) |
test | ::= | ( lambdef | and_test ( <OR_BOOL> and_test )* ) |
and_test | ::= | not_test ( <AND_BOOL> not_test )* |
not_test | ::= | <NOT_BOOL> not_test |
| | comparison | |
comparison | ::= | ( expr ( comp_op expr )* ) |
comp_op | ::= | <LESS> |
| | <GREATER> | |
| | <EQEQUAL> | |
| | <EQGREATER> | |
| | <EQLESS> | |
| | <LESSGREATER> | |
| | <NOTEQUAL> | |
| | <IN> | |
| | <NOT_BOOL> <IN> | |
| | <IS> <NOT_BOOL> | |
| | <IS> | |
expr | ::= | xor_expr ( <OR> xor_expr )* |
xor_expr | ::= | and_expr ( <XOR> and_expr )* |
and_expr | ::= | shift_expr ( <AND> shift_expr )* |
shift_expr | ::= | arith_expr ( <LSHIFT> arith_expr | <RSHIFT> arith_expr )* |
arith_expr | ::= | term ( <PLUS> term | <MINUS> term )* |
term | ::= | factor ( <MULTIPLY> factor | <DIVIDE> factor | <FLOORDIVIDE> factor | <MODULO> factor )* |
factor | ::= | <PLUS> factor |
| | <MINUS> factor | |
| | <NOT> factor | |
| | power | |
power | ::= | atomtrailer ( <POWER> factor )* |
atomtrailer | ::= | atom ( ( <LPAREN> <RPAREN> ) | ( <LPAREN> insidetuporcall <RPAREN> ) | <LBRACKET> subscriptlist <RBRACKET> | <DOT> AnyName )* |
atom | ::= | ( <LPAREN> <RPAREN> ) |
| | ( <LPAREN> insidetuporcall <RPAREN> ) | |
| | ( <LPAREN> ( SmartTestList )? <RPAREN> ) | |
| | ( <LBRACKET> ( listmaker )? <RBRACKET> ) | |
| | ( <LBRACE> ( dictmaker )? <RBRACE> ) | |
| | "`" SmartTestList "`" | |
| | Name | |
| | Number | |
| | String ( String )* | |
insidetuporcall | ::= | arglist ( list_for )* |
lambdef | ::= | <LAMBDA> ( varargslist )? <COLON> test |
subscriptlist | ::= | ( subscript ( <COMMA> subscript )* ( Comma )? ) |
subscript | ::= | <DOT> <DOT> <DOT> |
| | ( test ( slice )? ) | |
| | slice | |
slice | ::= | Colon ( test )? ( Colon ( test )? )? |
Colon | ::= | <COLON> |
Comma | ::= | <COMMA> |
exprlist | ::= | ( expr ( <COMMA> expr )* ( Comma )? ) |
SmartTestList | ::= | ( test ( <COMMA> test )* ( Comma )? ) |
testlist | ::= | test ( <COMMA> test )* ( <COMMA> )? |
dictmaker | ::= | test <COLON> test ( <COMMA> test <COLON> test )* ( <COMMA> )? |
listmaker | ::= | test ( ( list_for )+ | ( <COMMA> test )* ( Comma )? ) |
complistmaker | ::= | test list_for |
list_for | ::= | <FOR> exprlist <IN> SmartTestList ( <IF> test )* |
classdef | ::= | <CLASS> Name ( <LPAREN> testlist <RPAREN> )? <COLON> suite |
arglist | ::= | normalargs ( <COMMA> ( ExtraArgValueList ( <COMMA> ExtraKeywordValueList )? | ExtraKeywordValueList )? )? |
| | ( ExtraArgValueList ( <COMMA> ExtraKeywordValueList )? | ExtraKeywordValueList )? | |
normalargs | ::= | argument ( <COMMA> argument )* |
ExtraArgValueList | ::= | <MULTIPLY> test |
ExtraKeywordValueList | ::= | ( <POWER> | <MULTIPLY> <MULTIPLY> ) test |
argument | ::= | ( ( AnyName <EQUAL> )? test ) |
Number | ::= | ( ( <HEXNUMBER> ) | ( <OCTNUMBER> ) | ( <DECNUMBER> ) | ( <FLOAT> ) | ( <COMPLEX> ) ) |
Complex | ::= | <FLOAT> |
Name | ::= | ( <NAME> | <AS> ) |
String | ::= | ( <SINGLE_STRING> ) |
| | ( <SINGLE_STRING2> ) | |
| | ( <TRIPLE_STRING> ) | |
| | ( <TRIPLE_STRING2> ) | |
| | ( <SINGLE_USTRING> ) | |
| | ( <SINGLE_USTRING2> ) | |
| | ( <TRIPLE_USTRING> ) | |
| | ( <TRIPLE_USTRING2> ) | |
AnyName | ::= | ( <NAME> ) |
| | ( <OR_BOOL> ) | |
| | ( <AND_BOOL> ) | |
| | ( <NOT_BOOL> ) | |
| | ( <IS> ) | |
| | ( <IN> ) | |
| | ( <LAMBDA> ) | |
| | ( <IF> ) | |
| | ( <ELSE> ) | |
| | ( <ELIF> ) | |
| | ( <WHILE> ) | |
| | ( <FOR> ) | |
| | ( <TRY> ) | |
| | ( <EXCEPT> ) | |
| | ( <DEF> ) | |
| | ( <CLASS> ) | |
| | ( <FINALLY> ) | |
| | ( <PRINT> ) | |
| | ( <PASS> ) | |
| | ( <BREAK> ) | |
| | ( <CONTINUE> ) | |
| | ( <RETURN> ) | |
| | ( <YIELD> ) | |
| | ( <IMPORT> ) | |
| | ( <FROM> ) | |
| | ( <DEL> ) | |
| | ( <RAISE> ) | |
| | ( <GLOBAL> ) | |
| | ( <EXEC> ) | |
| | ( <ASSERT> ) | |
| | ( <AS> ) |