You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
36 lines
882 B
Python
36 lines
882 B
Python
# Copyright (c) 2016 Rocky Bernstein
|
|
"""
|
|
spark grammar differences over Python3 for Python 3.4.2.
|
|
"""
|
|
|
|
from uncompyle6.parser import PythonParserSingle
|
|
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
|
from uncompyle6.parsers.parse3 import Python3Parser
|
|
|
|
class Python34Parser(Python3Parser):
|
|
|
|
def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):
|
|
super(Python34Parser, self).__init__(debug_parser)
|
|
self.customized = {}
|
|
|
|
def p_misc34(self, args):
|
|
"""
|
|
# Python 3.5+ optimizes the trailing two JUMPS away
|
|
for_block ::= l_stmts_opt JUMP_ABSOLUTE
|
|
"""
|
|
|
|
class Python34ParserSingle(Python34Parser, PythonParserSingle):
|
|
pass
|
|
|
|
|
|
def info(args):
|
|
# Check grammar
|
|
# Should also add a way to dump grammar
|
|
p = Python34Parser()
|
|
p.checkGrammar()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
import sys
|
|
info(sys.argv)
|