Start to narrow 3.7 FUNCTION_EX grammar

This commit is contained in:
rocky
2018-04-23 15:16:03 -04:00
parent cd62e54c88
commit 037648577f

View File

@@ -294,20 +294,30 @@ class Python36Parser(Python35Parser):
call_ex ::= expr starred CALL_FUNCTION_EX call_ex ::= expr starred CALL_FUNCTION_EX
""", nop_func) """, nop_func)
if self.version > 3.6: if self.version > 3.6:
self.addRule(""" if 'BUILD_TUPLE_UNPACK_WITH_CALL' in self.seen_ops:
expr ::= call_ex_kw self.addRule("""
expr ::= call_ex_kw3 expr ::= call_ex_kw3
expr ::= call_ex_kw4
call_ex_kw3 ::= expr call_ex_kw3 ::= expr
build_tuple_unpack_with_call build_tuple_unpack_with_call
expr %s
CALL_FUNCTION_EX CALL_FUNCTION_EX
""" % 'expr '* token.attr, nop_func)
elif 'BUILD_MAP_UNPACK_WITH_CALL' in self.seen_ops:
# FIXME: Is this right?
self.addRule("""
expr ::= call_ex_kw
call_ex_kw ::= expr expr
build_map_unpack_with_call CALL_FUNCTION_EX
""", nop_func)
pass
# FIXME: Is this right?
self.addRule("""
expr ::= call_ex_kw4
call_ex_kw4 ::= expr call_ex_kw4 ::= expr
expr expr
expr expr
CALL_FUNCTION_EX CALL_FUNCTION_EX
call_ex_kw ::= expr expr
build_map_unpack_with_call CALL_FUNCTION_EX
""", nop_func) """, nop_func)
pass pass
else: else: