MCPcopy
hub / github.com/rocky/python-uncompyle6 / Python30Parser

Class Python30Parser

uncompyle6/parsers/parse30.py:11–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class Python30Parser(Python31Parser):
12 def p_30(self, args):
13 """
14
15 pt_bp ::= POP_TOP POP_BLOCK
16
17 assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1
18 COME_FROM POP_TOP
19 assert2 ::= assert_expr jmp_true LOAD_ASSERT expr CALL_FUNCTION_1
20 RAISE_VARARGS_1 come_froms
21 call_stmt ::= expr _come_froms POP_TOP
22
23 return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM POP_TOP
24 compare_chained_right ::= expr COMPARE_OP RETURN_END_IF_LAMBDA
25
26 # FIXME: combine with parse3.2
27 whileTruestmt ::= SETUP_LOOP l_stmts_opt
28 jb_or_c COME_FROM_LOOP
29 whileTruestmt ::= SETUP_LOOP returns
30 COME_FROM_LOOP
31
32 # In many ways Python 3.0 code generation is more like Python 2.6 than
33 # it is 2.7 or 3.1. So we have a number of 2.6ish (and before) rules below
34 # Specifically POP_TOP is more prevalant since there is no POP_JUMP_IF_...
35 # instructions.
36
37 _ifstmts_jump ::= c_stmts JUMP_FORWARD _come_froms POP_TOP COME_FROM
38 _ifstmts_jump ::= c_stmts COME_FROM POP_TOP
39
40 # Used to keep index order the same in semantic actions
41 jb_pop_top ::= JUMP_BACK _come_froms POP_TOP
42
43 while1stmt ::= SETUP_LOOP l_stmts COME_FROM_LOOP
44 whileelsestmt ::= SETUP_LOOP testexpr l_stmts
45 jb_pop_top POP_BLOCK
46 else_suitel COME_FROM_LOOP
47 # while1elsestmt ::= SETUP_LOOP l_stmts
48 # jb_pop_top POP_BLOCK
49 # else_suitel COME_FROM_LOOP
50
51 else_suitel ::= l_stmts COME_FROM_LOOP JUMP_BACK
52
53 jump_absolute_else ::= COME_FROM JUMP_ABSOLUTE COME_FROM POP_TOP
54
55 jump_cf_pop ::= _come_froms _jump _come_froms POP_TOP
56
57 ifelsestmt ::= testexpr c_stmts_opt jump_cf_pop else_suite COME_FROM
58 ifelsestmtl ::= testexpr c_stmts_opt jump_cf_pop else_suitel
59 ifelsestmtc ::= testexpr c_stmts_opt jump_absolute_else else_suitec
60 ifelsestmtc ::= testexpr c_stmts_opt jump_cf_pop else_suitec
61
62 iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE COME_FROM
63 iflaststmtl ::= testexpr c_stmts_opt jb_pop_top
64 iflaststmtl ::= testexpr c_stmts_opt come_froms JUMP_BACK COME_FROM POP_TOP
65
66 iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE COME_FROM POP_TOP
67
68

Callers 1

parse30.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected