Possibly addresses issue #215

This commit is contained in:
rocky
2019-01-26 18:18:21 -05:00
parent 9a14db567b
commit e1628d4d3a
2 changed files with 13 additions and 8 deletions

View File

@@ -85,15 +85,17 @@ class Python25Parser(Python26Parser):
super(Python25Parser, self).customize_grammar_rules(tokens, customize)
if self.version == 2.5:
self.check_reduce['try_except'] = 'tokens'
self.check_reduce['aug_assign1'] = 'AST'
## Don't need this for 2.5 yet..
# def reduce_is_invalid(self, rule, ast, tokens, first, last):
# invalid = super(Python25Parser,
# self).reduce_is_invalid(rule, ast,
# tokens, first, last)
# if invalid or tokens is None:
# return invalid
# return False
def reduce_is_invalid(self, rule, ast, tokens, first, last):
invalid = super(Python25Parser,
self).reduce_is_invalid(rule, ast,
tokens, first, last)
if invalid or tokens is None:
return invalid
if rule == ('aug_assign1', ('expr', 'expr', 'inplace_op', 'store')):
return ast[0][0] == 'and'
return False
class Python25ParserSingle(Python26Parser, PythonParserSingle):