MCPcopy Index your code
hub / github.com/rocky/python-uncompyle6 / Python26Parser

Class Python26Parser

uncompyle6/parsers/parse26.py:19–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19class Python26Parser(Python2Parser):
20 def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):
21 super(Python26Parser, self).__init__(debug_parser)
22 self.customized = {}
23
24 def p_try_except26(self, args):
25 """
26 except_stmt ::= except_cond3 except_suite
27 except_cond1 ::= DUP_TOP expr COMPARE_OP
28 JUMP_IF_FALSE POP_TOP POP_TOP POP_TOP POP_TOP
29 except_cond3 ::= DUP_TOP expr COMPARE_OP
30 JUMP_IF_FALSE POP_TOP POP_TOP store POP_TOP
31
32 except_handler ::= JUMP_FORWARD COME_FROM except_stmts
33 come_froms_pop END_FINALLY come_froms
34
35 except_handler ::= JUMP_FORWARD COME_FROM except_stmts
36 END_FINALLY
37
38 except_handler ::= JUMP_FORWARD COME_FROM except_stmts
39 POP_TOP END_FINALLY
40 come_froms
41
42 except_handler ::= jmp_abs COME_FROM except_stmts
43 POP_TOP END_FINALLY
44
45 except_handler ::= jmp_abs COME_FROM except_stmts
46 END_FINALLY JUMP_FORWARD
47
48
49 # Sometimes we don't put in COME_FROM to the next statement
50 # like we do in 2.7. Perhaps we should?
51 try_except ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
52 except_handler
53
54 tryelsestmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
55 except_handler else_suite come_froms
56 tryelsestmtl ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
57 except_handler else_suitel
58 tryelsestmtc ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
59 except_handler else_suitec
60
61 _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD COME_FROM POP_TOP
62
63 except_suite ::= c_stmts_opt JUMP_FORWARD come_from_pop
64 except_suite ::= c_stmts_opt jf_pop
65 except_suite ::= c_stmts_opt jmp_abs come_from_pop
66
67 # This is what happens after a jump where
68 # we start a new block. For reasons that I don't fully
69 # understand, there is also a value on the top of the stack.
70 come_from_pop ::= COME_FROM POP_TOP
71 come_froms_pop ::= come_froms POP_TOP
72 """
73
74 # In contrast to Python 2.7, Python 2.6 has a lot of
75 # POP_TOP's which come right after various jumps.
76 # The COME_FROM instructions our scanner adds, here it is to assist

Callers 1

parse26.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected