Make parse 3.0 be its own thing

This commit is contained in:
rocky
2016-11-05 21:01:59 -04:00
parent d2ac293cf6
commit a685c60606
2 changed files with 26 additions and 2 deletions

View File

@@ -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':

View 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