You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Grammar reduction for load_attrs
This commit is contained in:
@@ -401,7 +401,6 @@ class PythonParser(GenericASTBuilder):
|
||||
importlist ::= importlist import_as
|
||||
importlist ::= import_as
|
||||
import_as ::= IMPORT_NAME designator
|
||||
import_as ::= IMPORT_NAME load_attrs designator
|
||||
import_as ::= IMPORT_FROM designator
|
||||
|
||||
importstmt ::= LOAD_CONST LOAD_CONST import_as
|
||||
@@ -411,8 +410,6 @@ class PythonParser(GenericASTBuilder):
|
||||
|
||||
imports_cont ::= import_cont+
|
||||
import_cont ::= LOAD_CONST LOAD_CONST import_as
|
||||
|
||||
load_attrs ::= LOAD_ATTR+
|
||||
"""
|
||||
|
||||
def p_list_comprehension(self, args):
|
||||
|
@@ -360,9 +360,10 @@ class Python2Parser(PythonParser):
|
||||
rule = 'mkfunc ::= %s LOAD_CONST %s' % ('expr '*v, opname)
|
||||
elif opname_base == 'MAKE_CLOSURE':
|
||||
# FIXME: use add_unique_rules to tidy this up.
|
||||
if i > 0 and tokens[i-1] == 'LOAD_LAMBDA':
|
||||
self.addRule('mklambda ::= %s load_closure LOAD_LAMBDA %s' %
|
||||
('expr '*v, opname), nop_func)
|
||||
self.add_unique_rules([
|
||||
('mklambda ::= %s load_closure LOAD_LAMBDA %s' %
|
||||
('expr '*v, opname)),
|
||||
('genexpr ::= %s load_closure LOAD_GENEXPR %s expr'
|
||||
' GET_ITER CALL_FUNCTION_1' %
|
||||
('expr '*v, opname)),
|
||||
|
@@ -33,6 +33,9 @@ class Python24Parser(Python25Parser):
|
||||
importmultiple ::= filler LOAD_CONST import_as imports_cont
|
||||
import_cont ::= filler LOAD_CONST import_as
|
||||
|
||||
import_as ::= IMPORT_NAME load_attrs designator
|
||||
load_attrs ::= LOAD_ATTR+
|
||||
|
||||
# Python 2.5+ omits POP_TOP POP_BLOCK
|
||||
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_TOP POP_BLOCK COME_FROM
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_TOP POP_BLOCK COME_FROM
|
||||
|
Reference in New Issue
Block a user