From 92b8d9c50855728d6767bec8aa88ea62a484d23c Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 6 May 2022 03:02:30 -0400 Subject: [PATCH] Grammar lint adjustments --- pytest/test_grammar.py | 5 +++++ uncompyle6/parsers/parse3.py | 5 ++--- uncompyle6/parsers/parse37.py | 1 - uncompyle6/parsers/parse38.py | 1 - 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pytest/test_grammar.py b/pytest/test_grammar.py index 75ff86bd..44d75e53 100644 --- a/pytest/test_grammar.py +++ b/pytest/test_grammar.py @@ -74,6 +74,11 @@ def test_grammar(): pass pass + if PYTHON_VERSION_TRIPLE >= (3, 7): + expect_lhs.add("set_for") + unused_rhs.add("set_iter") + pass + pass # FIXME if PYTHON_VERSION_TRIPLE < (3, 8): assert expect_lhs == set(lhs) diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 5e3c74f2..0cc6fc05 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -1072,9 +1072,8 @@ class Python3Parser(PythonParser): # A PyPy speciality - DRY with parse3 self.addRule( """ - expr ::= attribute - attribute ::= expr LOOKUP_METHOD - """, + attribute ::= expr LOOKUP_METHOD + """, nop_func, ) custom_ops_processed.add(opname) diff --git a/uncompyle6/parsers/parse37.py b/uncompyle6/parsers/parse37.py index d27cca1a..b1dcb6db 100644 --- a/uncompyle6/parsers/parse37.py +++ b/uncompyle6/parsers/parse37.py @@ -725,7 +725,6 @@ class Python37Parser(Python37BaseParser): store set_iter jb_or_c _come_froms - list_if_not_end ::= pjump_ift _come_froms # This is seen in PyPy, but possibly it appears on other Python 3? list_if ::= expr jmp_false list_iter COME_FROM list_if_not ::= expr jmp_true list_iter COME_FROM diff --git a/uncompyle6/parsers/parse38.py b/uncompyle6/parsers/parse38.py index fc70eb71..e29accbf 100644 --- a/uncompyle6/parsers/parse38.py +++ b/uncompyle6/parsers/parse38.py @@ -138,7 +138,6 @@ class Python38Parser(Python37Parser): # while1elsestmt ::= l_stmts JUMP_BACK whileTruestmt ::= _come_froms l_stmts JUMP_BACK POP_BLOCK - while1stmt ::= _come_froms l_stmts COME_FROM_LOOP while1stmt ::= _come_froms l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP whileTruestmt38 ::= _come_froms l_stmts JUMP_BACK whileTruestmt38 ::= _come_froms l_stmts JUMP_BACK COME_FROM_EXCEPT_CLAUSE