You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Make parse 3.0 be its own thing
This commit is contained in:
@@ -622,10 +622,11 @@ def get_python_parser(
|
||||
else:
|
||||
import uncompyle6.parsers.parse3 as parse3
|
||||
if version == 3.0:
|
||||
import uncompyle6.parsers.parse30 as parse30
|
||||
if compile_mode == 'exec':
|
||||
p = parse3.Python30Parser(debug_parser)
|
||||
p = parse30.Python30Parser(debug_parser)
|
||||
else:
|
||||
p = parse3.Python30ParserSingle(debug_parser)
|
||||
p = parse30.Python30ParserSingle(debug_parser)
|
||||
elif version == 3.1:
|
||||
import uncompyle6.parsers.parse31 as parse31
|
||||
if compile_mode == 'exec':
|
||||
|
23
uncompyle6/parsers/parse30.py
Normal file
23
uncompyle6/parsers/parse30.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2016 Rocky Bernstein
|
||||
"""
|
||||
spark grammar differences over Python 3.1 for Python 3.0.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from uncompyle6.parser import PythonParserSingle
|
||||
from uncompyle6.parsers.parse31 import Python31Parser
|
||||
|
||||
class Python30Parser(Python31Parser):
|
||||
|
||||
def p_30(self, args):
|
||||
"""
|
||||
# Store locals is only in Python 3.0 to 3.3
|
||||
stmt ::= store_locals
|
||||
store_locals ::= LOAD_FAST STORE_LOCALS
|
||||
|
||||
jmp_true ::= JUMP_IF_TRUE_OR_POP POP_TOP
|
||||
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD POP_TOP COME_FROM
|
||||
"""
|
||||
|
||||
class Python31ParserSingle(Python31Parser, PythonParserSingle):
|
||||
pass
|
Reference in New Issue
Block a user