How to use the uncompyle6.parsers.parse23.Python23Parser function in uncompyle6

To help you get started, we’ve selected a few uncompyle6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rocky / python-decompile3 / uncompyle6 / parsers / parse23.py View on Github external
def reduce_is_invalid(self, rule, ast, tokens, first, last):
        invalid = super(Python24Parser,
                        self).reduce_is_invalid(rule, ast,
                                                tokens, first, last)
        if invalid:
            return invalid

        # FiXME: this code never gets called...
        lhs = rule[0]
        if lhs == 'nop_stmt':
            return not int(tokens[first].pattr) == tokens[last].offset

        return False

class Python23ParserSingle(Python23Parser, PythonParserSingle):
    pass

if __name__ == '__main__':
    # Check grammar
    p = Python23Parser()
    p.check_grammar()
    p.dump_grammar()
github rocky / python-uncompyle6 / uncompyle6 / parsers / parse22.py View on Github external
#  Copyright (c) 2016-2017 Rocky Bernstein
#  Copyright (c) 2000-2002 by hartmut Goebel 

from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
from uncompyle6.parser import PythonParserSingle
from uncompyle6.parsers.parse23 import Python23Parser

class Python22Parser(Python23Parser):

    def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):
        super(Python23Parser, self).__init__(debug_parser)
        self.customized = {}

    def p_misc22(self, args):
        '''
        for_iter  ::= LOAD_CONST FOR_LOOP
        list_iter ::= list_if JUMP_FORWARD
                      COME_FROM POP_TOP COME_FROM
        list_for  ::= expr for_iter store list_iter CONTINUE JUMP_FORWARD
                      COME_FROM POP_TOP COME_FROM

        # Some versions of Python 2.2 have been found to generate
        # PRINT_ITEM_CONT for PRINT_ITEM
        print_items_stmt ::= expr PRINT_ITEM_CONT print_items_opt
github rocky / python-decompile3 / uncompyle6 / parsers / parse23.py View on Github external
if invalid:
            return invalid

        # FiXME: this code never gets called...
        lhs = rule[0]
        if lhs == 'nop_stmt':
            return not int(tokens[first].pattr) == tokens[last].offset

        return False

class Python23ParserSingle(Python23Parser, PythonParserSingle):
    pass

if __name__ == '__main__':
    # Check grammar
    p = Python23Parser()
    p.check_grammar()
    p.dump_grammar()
github rocky / python-uncompyle6 / uncompyle6 / parsers / parse22.py View on Github external
def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):
        super(Python23Parser, self).__init__(debug_parser)
        self.customized = {}
github rocky / python-uncompyle6 / uncompyle6 / parsers / parse23.py View on Github external
def reduce_is_invalid(self, rule, ast, tokens, first, last):
        invalid = super(Python24Parser,
                        self).reduce_is_invalid(rule, ast,
                                                tokens, first, last)
        if invalid:
            return invalid

        # FiXME: this code never gets called...
        lhs = rule[0]
        if lhs == 'nop_stmt':
            return not int(tokens[first].pattr) == tokens[last].offset

        return False

class Python23ParserSingle(Python23Parser, PythonParserSingle):
    pass

if __name__ == '__main__':
    # Check grammar
    p = Python23Parser()
    p.check_grammar()
    p.dump_grammar()
github rocky / python-uncompyle6 / uncompyle6 / parser.py View on Github external
elif version == 2.1:
                import uncompyle6.parsers.parse21 as parse21
                if compile_mode == 'exec':
                    p = parse21.Python21Parser(debug_parser)
                else:
                    p = parse21.Python21ParserSingle(debug_parser)
        elif version == 2.2:
            import uncompyle6.parsers.parse22 as parse22
            if compile_mode == 'exec':
                p = parse22.Python22Parser(debug_parser)
            else:
                p = parse22.Python22ParserSingle(debug_parser)
        elif version == 2.3:
            import uncompyle6.parsers.parse23 as parse23
            if compile_mode == 'exec':
                p = parse23.Python23Parser(debug_parser)
            else:
                p = parse23.Python23ParserSingle(debug_parser)
        elif version == 2.4:
            import uncompyle6.parsers.parse24 as parse24
            if compile_mode == 'exec':
                p = parse24.Python24Parser(debug_parser)
            else:
                p = parse24.Python24ParserSingle(debug_parser)
        elif version == 2.5:
            import uncompyle6.parsers.parse25 as parse25
            if compile_mode == 'exec':
                p = parse25.Python25Parser(debug_parser)
            else:
                p = parse25.Python25ParserSingle(debug_parser)
        elif version == 2.6:
            import uncompyle6.parsers.parse26 as parse26
github rocky / python-uncompyle6 / uncompyle6 / parsers / parse23.py View on Github external
def customize_grammar_rules(self, tokens, customize):
        super(Python23Parser, self).customize_grammar_rules(tokens, customize)
github rocky / python-decompile3 / uncompyle6 / parsers / parse23.py View on Github external
def customize_grammar_rules(self, tokens, customize):
        super(Python23Parser, self).customize_grammar_rules(tokens, customize)