Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib64/python3..../lib2to3
File: Grammar.txt
# Grammar for 2to3. This grammar supports Python 2.x and 3.x.
[0] Fix | Delete
[1] Fix | Delete
# NOTE WELL: You should also follow all the steps listed at
[2] Fix | Delete
# https://devguide.python.org/grammar/
[3] Fix | Delete
[4] Fix | Delete
# Start symbols for the grammar:
[5] Fix | Delete
# file_input is a module or sequence of commands read from an input file;
[6] Fix | Delete
# single_input is a single interactive statement;
[7] Fix | Delete
# eval_input is the input for the eval() and input() functions.
[8] Fix | Delete
# NB: compound_stmt in single_input is followed by extra NEWLINE!
[9] Fix | Delete
file_input: (NEWLINE | stmt)* ENDMARKER
[10] Fix | Delete
single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
[11] Fix | Delete
eval_input: testlist NEWLINE* ENDMARKER
[12] Fix | Delete
[13] Fix | Delete
decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
[14] Fix | Delete
decorators: decorator+
[15] Fix | Delete
decorated: decorators (classdef | funcdef | async_funcdef)
[16] Fix | Delete
async_funcdef: ASYNC funcdef
[17] Fix | Delete
funcdef: 'def' NAME parameters ['->' test] ':' suite
[18] Fix | Delete
parameters: '(' [typedargslist] ')'
[19] Fix | Delete
[20] Fix | Delete
# The following definition for typedarglist is equivalent to this set of rules:
[21] Fix | Delete
#
[22] Fix | Delete
# arguments = argument (',' argument)*
[23] Fix | Delete
# argument = tfpdef ['=' test]
[24] Fix | Delete
# kwargs = '**' tname [',']
[25] Fix | Delete
# args = '*' [tname]
[26] Fix | Delete
# kwonly_kwargs = (',' argument)* [',' [kwargs]]
[27] Fix | Delete
# args_kwonly_kwargs = args kwonly_kwargs | kwargs
[28] Fix | Delete
# poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]]
[29] Fix | Delete
# typedargslist_no_posonly = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
[30] Fix | Delete
# typedarglist = arguments ',' '/' [',' [typedargslist_no_posonly]])|(typedargslist_no_posonly)"
[31] Fix | Delete
#
[32] Fix | Delete
# It needs to be fully expanded to allow our LL(1) parser to work on it.
[33] Fix | Delete
[34] Fix | Delete
typedargslist: tfpdef ['=' test] (',' tfpdef ['=' test])* ',' '/' [
[35] Fix | Delete
',' [((tfpdef ['=' test] ',')* ('*' [tname] (',' tname ['=' test])*
[36] Fix | Delete
[',' ['**' tname [',']]] | '**' tname [','])
[37] Fix | Delete
| tfpdef ['=' test] (',' tfpdef ['=' test])* [','])]
[38] Fix | Delete
] | ((tfpdef ['=' test] ',')* ('*' [tname] (',' tname ['=' test])*
[39] Fix | Delete
[',' ['**' tname [',']]] | '**' tname [','])
[40] Fix | Delete
| tfpdef ['=' test] (',' tfpdef ['=' test])* [','])
[41] Fix | Delete
[42] Fix | Delete
tname: NAME [':' test]
[43] Fix | Delete
tfpdef: tname | '(' tfplist ')'
[44] Fix | Delete
tfplist: tfpdef (',' tfpdef)* [',']
[45] Fix | Delete
[46] Fix | Delete
# The following definition for varargslist is equivalent to this set of rules:
[47] Fix | Delete
#
[48] Fix | Delete
# arguments = argument (',' argument )*
[49] Fix | Delete
# argument = vfpdef ['=' test]
[50] Fix | Delete
# kwargs = '**' vname [',']
[51] Fix | Delete
# args = '*' [vname]
[52] Fix | Delete
# kwonly_kwargs = (',' argument )* [',' [kwargs]]
[53] Fix | Delete
# args_kwonly_kwargs = args kwonly_kwargs | kwargs
[54] Fix | Delete
# poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]]
[55] Fix | Delete
# vararglist_no_posonly = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
[56] Fix | Delete
# varargslist = arguments ',' '/' [','[(vararglist_no_posonly)]] | (vararglist_no_posonly)
[57] Fix | Delete
#
[58] Fix | Delete
# It needs to be fully expanded to allow our LL(1) parser to work on it.
[59] Fix | Delete
[60] Fix | Delete
varargslist: vfpdef ['=' test ](',' vfpdef ['=' test])* ',' '/' [',' [
[61] Fix | Delete
((vfpdef ['=' test] ',')* ('*' [vname] (',' vname ['=' test])*
[62] Fix | Delete
[',' ['**' vname [',']]] | '**' vname [','])
[63] Fix | Delete
| vfpdef ['=' test] (',' vfpdef ['=' test])* [','])
[64] Fix | Delete
]] | ((vfpdef ['=' test] ',')*
[65] Fix | Delete
('*' [vname] (',' vname ['=' test])* [',' ['**' vname [',']]]| '**' vname [','])
[66] Fix | Delete
| vfpdef ['=' test] (',' vfpdef ['=' test])* [','])
[67] Fix | Delete
[68] Fix | Delete
vname: NAME
[69] Fix | Delete
vfpdef: vname | '(' vfplist ')'
[70] Fix | Delete
vfplist: vfpdef (',' vfpdef)* [',']
[71] Fix | Delete
[72] Fix | Delete
stmt: simple_stmt | compound_stmt
[73] Fix | Delete
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
[74] Fix | Delete
small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt |
[75] Fix | Delete
import_stmt | global_stmt | exec_stmt | assert_stmt)
[76] Fix | Delete
expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |
[77] Fix | Delete
('=' (yield_expr|testlist_star_expr))*)
[78] Fix | Delete
annassign: ':' test ['=' test]
[79] Fix | Delete
testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
[80] Fix | Delete
augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
[81] Fix | Delete
'<<=' | '>>=' | '**=' | '//=')
[82] Fix | Delete
# For normal and annotated assignments, additional restrictions enforced by the interpreter
[83] Fix | Delete
print_stmt: 'print' ( [ test (',' test)* [','] ] |
[84] Fix | Delete
'>>' test [ (',' test)+ [','] ] )
[85] Fix | Delete
del_stmt: 'del' exprlist
[86] Fix | Delete
pass_stmt: 'pass'
[87] Fix | Delete
flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt
[88] Fix | Delete
break_stmt: 'break'
[89] Fix | Delete
continue_stmt: 'continue'
[90] Fix | Delete
return_stmt: 'return' [testlist]
[91] Fix | Delete
yield_stmt: yield_expr
[92] Fix | Delete
raise_stmt: 'raise' [test ['from' test | ',' test [',' test]]]
[93] Fix | Delete
import_stmt: import_name | import_from
[94] Fix | Delete
import_name: 'import' dotted_as_names
[95] Fix | Delete
import_from: ('from' ('.'* dotted_name | '.'+)
[96] Fix | Delete
'import' ('*' | '(' import_as_names ')' | import_as_names))
[97] Fix | Delete
import_as_name: NAME ['as' NAME]
[98] Fix | Delete
dotted_as_name: dotted_name ['as' NAME]
[99] Fix | Delete
import_as_names: import_as_name (',' import_as_name)* [',']
[100] Fix | Delete
dotted_as_names: dotted_as_name (',' dotted_as_name)*
[101] Fix | Delete
dotted_name: NAME ('.' NAME)*
[102] Fix | Delete
global_stmt: ('global' | 'nonlocal') NAME (',' NAME)*
[103] Fix | Delete
exec_stmt: 'exec' expr ['in' test [',' test]]
[104] Fix | Delete
assert_stmt: 'assert' test [',' test]
[105] Fix | Delete
[106] Fix | Delete
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt
[107] Fix | Delete
async_stmt: ASYNC (funcdef | with_stmt | for_stmt)
[108] Fix | Delete
if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* ['else' ':' suite]
[109] Fix | Delete
while_stmt: 'while' namedexpr_test ':' suite ['else' ':' suite]
[110] Fix | Delete
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
[111] Fix | Delete
try_stmt: ('try' ':' suite
[112] Fix | Delete
((except_clause ':' suite)+
[113] Fix | Delete
['else' ':' suite]
[114] Fix | Delete
['finally' ':' suite] |
[115] Fix | Delete
'finally' ':' suite))
[116] Fix | Delete
with_stmt: 'with' with_item (',' with_item)* ':' suite
[117] Fix | Delete
with_item: test ['as' expr]
[118] Fix | Delete
with_var: 'as' expr
[119] Fix | Delete
# NB compile.c makes sure that the default except clause is last
[120] Fix | Delete
except_clause: 'except' [test [(',' | 'as') test]]
[121] Fix | Delete
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
[122] Fix | Delete
[123] Fix | Delete
# Backward compatibility cruft to support:
[124] Fix | Delete
# [ x for x in lambda: True, lambda: False if x() ]
[125] Fix | Delete
# even while also allowing:
[126] Fix | Delete
# lambda x: 5 if x else 2
[127] Fix | Delete
# (But not a mix of the two)
[128] Fix | Delete
testlist_safe: old_test [(',' old_test)+ [',']]
[129] Fix | Delete
old_test: or_test | old_lambdef
[130] Fix | Delete
old_lambdef: 'lambda' [varargslist] ':' old_test
[131] Fix | Delete
[132] Fix | Delete
namedexpr_test: test [':=' test]
[133] Fix | Delete
test: or_test ['if' or_test 'else' test] | lambdef
[134] Fix | Delete
or_test: and_test ('or' and_test)*
[135] Fix | Delete
and_test: not_test ('and' not_test)*
[136] Fix | Delete
not_test: 'not' not_test | comparison
[137] Fix | Delete
comparison: expr (comp_op expr)*
[138] Fix | Delete
comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'
[139] Fix | Delete
star_expr: '*' expr
[140] Fix | Delete
expr: xor_expr ('|' xor_expr)*
[141] Fix | Delete
xor_expr: and_expr ('^' and_expr)*
[142] Fix | Delete
and_expr: shift_expr ('&' shift_expr)*
[143] Fix | Delete
shift_expr: arith_expr (('<<'|'>>') arith_expr)*
[144] Fix | Delete
arith_expr: term (('+'|'-') term)*
[145] Fix | Delete
term: factor (('*'|'@'|'/'|'%'|'//') factor)*
[146] Fix | Delete
factor: ('+'|'-'|'~') factor | power
[147] Fix | Delete
power: [AWAIT] atom trailer* ['**' factor]
[148] Fix | Delete
atom: ('(' [yield_expr|testlist_gexp] ')' |
[149] Fix | Delete
'[' [listmaker] ']' |
[150] Fix | Delete
'{' [dictsetmaker] '}' |
[151] Fix | Delete
'`' testlist1 '`' |
[152] Fix | Delete
NAME | NUMBER | STRING+ | '.' '.' '.')
[153] Fix | Delete
listmaker: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
[154] Fix | Delete
testlist_gexp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
[155] Fix | Delete
lambdef: 'lambda' [varargslist] ':' test
[156] Fix | Delete
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
[157] Fix | Delete
subscriptlist: subscript (',' subscript)* [',']
[158] Fix | Delete
subscript: test | [test] ':' [test] [sliceop]
[159] Fix | Delete
sliceop: ':' [test]
[160] Fix | Delete
exprlist: (expr|star_expr) (',' (expr|star_expr))* [',']
[161] Fix | Delete
testlist: test (',' test)* [',']
[162] Fix | Delete
dictsetmaker: ( ((test ':' test | '**' expr)
[163] Fix | Delete
(comp_for | (',' (test ':' test | '**' expr))* [','])) |
[164] Fix | Delete
((test | star_expr)
[165] Fix | Delete
(comp_for | (',' (test | star_expr))* [','])) )
[166] Fix | Delete
[167] Fix | Delete
classdef: 'class' NAME ['(' [arglist] ')'] ':' suite
[168] Fix | Delete
[169] Fix | Delete
arglist: argument (',' argument)* [',']
[170] Fix | Delete
[171] Fix | Delete
# "test '=' test" is really "keyword '=' test", but we have no such token.
[172] Fix | Delete
# These need to be in a single rule to avoid grammar that is ambiguous
[173] Fix | Delete
# to our LL(1) parser. Even though 'test' includes '*expr' in star_expr,
[174] Fix | Delete
# we explicitly match '*' here, too, to give it proper precedence.
[175] Fix | Delete
# Illegal combinations and orderings are blocked in ast.c:
[176] Fix | Delete
# multiple (test comp_for) arguments are blocked; keyword unpackings
[177] Fix | Delete
# that precede iterable unpackings are blocked; etc.
[178] Fix | Delete
argument: ( test [comp_for] |
[179] Fix | Delete
test ':=' test |
[180] Fix | Delete
test '=' test |
[181] Fix | Delete
'**' test |
[182] Fix | Delete
'*' test )
[183] Fix | Delete
[184] Fix | Delete
comp_iter: comp_for | comp_if
[185] Fix | Delete
comp_for: [ASYNC] 'for' exprlist 'in' testlist_safe [comp_iter]
[186] Fix | Delete
comp_if: 'if' old_test [comp_iter]
[187] Fix | Delete
[188] Fix | Delete
testlist1: test (',' test)*
[189] Fix | Delete
[190] Fix | Delete
# not used in grammar, but may appear in "node" passed from Parser to Compiler
[191] Fix | Delete
encoding_decl: NAME
[192] Fix | Delete
[193] Fix | Delete
yield_expr: 'yield' [yield_arg]
[194] Fix | Delete
yield_arg: 'from' test | testlist
[195] Fix | Delete
[196] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function