mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-10-07 10:13:39 +00:00
Hack around grammar weakness in 3.5..3.6 for now
This commit is contained in:
parent
f6f2d8dd05
commit
58f2e19539
@ -27,6 +27,9 @@ def test_grammar():
|
|||||||
expect_lhs.add("attribute")
|
expect_lhs.add("attribute")
|
||||||
|
|
||||||
expect_lhs.add("get_iter")
|
expect_lhs.add("get_iter")
|
||||||
|
|
||||||
|
if PYTHON_VERSION > 3.7 or PYTHON_VERSION < 3.0:
|
||||||
|
expect_lhs.add("stmts_opt")
|
||||||
else:
|
else:
|
||||||
expect_lhs.add("async_with_as_stmt")
|
expect_lhs.add("async_with_as_stmt")
|
||||||
expect_lhs.add("async_with_stmt")
|
expect_lhs.add("async_with_stmt")
|
||||||
|
@ -89,7 +89,7 @@ class PythonParser(GenericASTBuilder):
|
|||||||
# singleton reduction that we can simplify. It also happens to be optional
|
# singleton reduction that we can simplify. It also happens to be optional
|
||||||
# in its other derivation
|
# in its other derivation
|
||||||
self.optional_nt |= frozenset(
|
self.optional_nt |= frozenset(
|
||||||
("come_froms", "suite_stmts", "l_stmts_opt", "c_stmts_opt")
|
("come_froms", "suite_stmts", "l_stmts_opt", "c_stmts_opt", "stmts_opt")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Reduce singleton reductions in these nonterminals:
|
# Reduce singleton reductions in these nonterminals:
|
||||||
|
@ -17,6 +17,12 @@ class Python35Parser(Python34Parser):
|
|||||||
def p_35on(self, args):
|
def p_35on(self, args):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# FIXME! isolate this to only loops!
|
||||||
|
_ifstmts_jump ::= c_stmts_opt come_froms
|
||||||
|
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD
|
||||||
|
ifelsestmt ::= testexpr c_stmts_opt jump_forward_else else_suite _come_froms
|
||||||
|
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_froms
|
||||||
|
|
||||||
pb_ja ::= POP_BLOCK JUMP_ABSOLUTE
|
pb_ja ::= POP_BLOCK JUMP_ABSOLUTE
|
||||||
|
|
||||||
# The number of canned instructions in new statements is mind boggling.
|
# The number of canned instructions in new statements is mind boggling.
|
||||||
|
Loading…
Reference in New Issue
Block a user