

def _CombineBinaryExpressions(self, operator):
    for i in range(1, (len(self.stack) - 1)):
        item = self.stack[i]
        if (isinstance(item, BinaryExpression) and (item.operator == operator) and isinstance(self.stack[(i - 1)], Expression) and isinstance(self.stack[(i + 1)], Expression)):
            lhs = self.stack[(i - 1)]
            rhs = self.stack[(i + 1)]
            self.stack[i].AddOperands(lhs, rhs)
            self.stack[(i - 1)] = None
            self.stack[(i + 1)] = None
    self.stack = filter(None, self.stack)

dataset/ETHPy150Open google/grr/grr/lib/lexer.py SearchParser._CombineBinaryExpressions/original