Added support for support for Python 3.6 CALL_FUNCTION_KW

This commit is contained in:
Daniel Bradburn
2017-05-10 21:49:42 +02:00
parent 8d084ed358
commit ca1679e636
6 changed files with 128 additions and 46 deletions

View File

@@ -58,6 +58,17 @@ class Python36Parser(Python35Parser):
""" % (fstring_expr_or_str_n, fstring_expr_or_str_n, "fstring_expr_or_str " * v)
self.add_unique_doc_rules(rules_str, customize)
def custom_classfunc_rule(self, opname, token, customize):
if opname.startswith('CALL_FUNCTION_KW'):
values = 'expr ' * token.attr
rule = 'call_function ::= expr kwargs_only_36 {token.type}'.format(**locals())
self.add_unique_rule(rule, token.type, token.attr, customize)
rule = 'kwargs_only_36 ::= {values} LOAD_CONST'.format(**locals())
self.add_unique_rule(rule, token.type, token.attr, customize)
else:
super(Python36Parser, self).custom_classfunc_rule(opname, token, customize)
class Python36ParserSingle(Python36Parser, PythonParserSingle):
pass