Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2018-03-02 10:07:20 -05:00
4 changed files with 20 additions and 6 deletions

View File

@@ -170,7 +170,7 @@ class Python27Parser(Python2Parser):
""")
super(Python27Parser, self).customize_grammar_rules(tokens, customize)
self.check_reduce['and'] = 'AST'
self.check_reduce['conditional_true'] = 'AST'
# self.check_reduce['conditional_true'] = 'AST'
return
def reduce_is_invalid(self, rule, ast, tokens, first, last):
@@ -186,11 +186,11 @@ class Python27Parser(Python2Parser):
jmp_target = jmp_false.offset + jmp_false.attr + 3
return not (jmp_target == tokens[last].offset or
tokens[last].pattr == jmp_false.pattr)
elif rule[0] == ('conditional_true'):
# FIXME: the below is a hack: we check expr for
# nodes that could have possibly been a been a Boolean.
# We should also look for the presence of dead code.
return ast[0] == 'expr' and ast[0] == 'or'
# elif rule[0] == ('conditional_true'):
# # FIXME: the below is a hack: we check expr for
# # nodes that could have possibly been a been a Boolean.
# # We should also look for the presence of dead code.
# return ast[0] == 'expr' and ast[0] == 'or'
return False