diff --git a/uncompyle6/parser.py b/uncompyle6/parser.py index 3a537647..508c6124 100644 --- a/uncompyle6/parser.py +++ b/uncompyle6/parser.py @@ -32,7 +32,7 @@ class PythonParser(GenericASTBuilder): super(PythonParser, self).__init__(AST, start, debug) # FIXME: customize per python parser version nt_list = [ - 'stmts', 'except_stmts', '_stmts', 'load_attrs', + 'stmts', 'except_stmts', '_stmts', 'attributes', 'exprlist', 'kvlist', 'kwargs', 'come_froms', '_come_froms', 'importlist', # Python < 3 @@ -388,7 +388,7 @@ class PythonParser(GenericASTBuilder): importlist ::= alias alias ::= IMPORT_NAME store alias ::= IMPORT_FROM store - alias ::= IMPORT_NAME load_attrs store + alias ::= IMPORT_NAME attributes store import ::= LOAD_CONST LOAD_CONST alias import_from_star ::= LOAD_CONST LOAD_CONST IMPORT_NAME IMPORT_STAR @@ -398,7 +398,7 @@ class PythonParser(GenericASTBuilder): imports_cont ::= import_cont+ import_cont ::= LOAD_CONST LOAD_CONST alias - load_attrs ::= LOAD_ATTR+ + attributes ::= LOAD_ATTR+ """ def p_list_comprehension(self, args): @@ -433,7 +433,7 @@ class PythonParser(GenericASTBuilder): expr ::= LOAD_CONST expr ::= LOAD_GLOBAL expr ::= LOAD_DEREF - expr ::= load_attr + expr ::= attribute expr ::= binary_expr expr ::= list expr ::= compare @@ -471,8 +471,8 @@ class PythonParser(GenericASTBuilder): subscript ::= expr expr BINARY_SUBSCR - load_attr ::= expr LOAD_ATTR - get_iter ::= expr GET_ITER + attribute ::= expr LOAD_ATTR + get_iter ::= expr GET_ITER yield ::= expr YIELD_VALUE diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index a6972b9d..358f2745 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -367,7 +367,7 @@ class Python2Parser(PythonParser): continue elif opname == 'LOOKUP_METHOD': # A PyPy speciality - DRY with parse3 - self.add_unique_rule("load_attr ::= expr LOOKUP_METHOD", + self.add_unique_rule("attribute ::= expr LOOKUP_METHOD", opname, v, customize) continue elif opname_base == 'MAKE_FUNCTION': diff --git a/uncompyle6/parsers/parse23.py b/uncompyle6/parsers/parse23.py index 56178e92..e7537e21 100644 --- a/uncompyle6/parsers/parse23.py +++ b/uncompyle6/parsers/parse23.py @@ -48,9 +48,7 @@ class Python23Parser(Python24Parser): expr ::= and2 and2 ::= _jump jmp_false COME_FROM expr COME_FROM - alias ::= IMPORT_NAME load_attrs store - load_attrs ::= LOAD_ATTR+ - + alias ::= IMPORT_NAME attributes store conditional ::= expr jmp_false expr JUMP_FORWARD expr COME_FROM ''' diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 8df248cb..ac3271f6 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -595,7 +595,7 @@ class Python3Parser(PythonParser): mklambda ::= {pos_arg}^n LOAD_LAMBDA [LOAD_CONST] MAKE_FUNCTION_n For PYPY: - load_attr ::= expr LOOKUP_METHOD + attribute ::= expr LOOKUP_METHOD call ::= expr CALL_METHOD """ is_pypy = False @@ -796,7 +796,7 @@ class Python3Parser(PythonParser): self.add_make_function_rule(rule_pat, opname, token.attr, customize) elif opname == 'LOOKUP_METHOD': # A PyPy speciality - DRY with parse2 - self.add_unique_rule("load_attr ::= expr LOOKUP_METHOD", + self.add_unique_rule("attribute ::= expr LOOKUP_METHOD", opname, token.attr, customize) continue elif opname.startswith('MAKE_CLOSURE'): diff --git a/uncompyle6/semantics/consts.py b/uncompyle6/semantics/consts.py index bb59fc60..1521a905 100644 --- a/uncompyle6/semantics/consts.py +++ b/uncompyle6/semantics/consts.py @@ -125,7 +125,7 @@ TABLE_DIRECT = { (1, 100), (2, 100) ), 'IMPORT_FROM': ( '%{pattr}', ), - 'load_attr': ( '%c.%[1]{pattr}', + 'attribute': ( '%c.%[1]{pattr}', (0, 'expr')), 'LOAD_FAST': ( '%{pattr}', ), 'LOAD_NAME': ( '%{pattr}', ), @@ -155,7 +155,7 @@ TABLE_DIRECT = { 'unpack_w_parens': ( '(%C%,)', (1, maxint, ', ') ), # This nonterminal we create on the fly in semantic routines - 'load_attr_w_parens': ( '(%c).%[1]{pattr}', + 'attribute_w_parens': ( '(%c).%[1]{pattr}', (0, 'expr')), 'unpack_list': ( '[%C]', @@ -312,7 +312,7 @@ PRECEDENCE = { 'list_comp': 0, 'generator_exp': 0, - 'load_attr': 2, + 'attribute': 2, 'subscript': 2, 'subscript2': 2, 'slice0': 2, diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index e9d1e2c7..7840fff1 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -1878,10 +1878,10 @@ class SourceWalker(GenericASTTraversal, object): n_unpack_w_parens = n_unpack - def n_load_attr(self, node): + def n_attribute(self, node): if (node[0] == 'LOAD_CONST' or node[0] == 'expr' and node[0][0] == 'LOAD_CONST'): - node.kind = 'load_attr_w_parens' + node.kind = 'attribute_w_parens' self.default(node) def n_assign(self, node):