/** * Returns true if the current Node has lower precedence than the one * we compare with. * * In case of a tie, we also consider the associativity. * (Left associative operators are lower precedence in this context.) * * @param Node $other Node to compare to. * @retval boolean */ public function lowerPrecedenceThan($other) { if (!$other instanceof ExpressionNode) { return false; } if ($this->getPrecedence() < $other->getPrecedence()) { return true; } if ($this->getPrecedence() > $other->getPrecedence()) { return false; } if ($this->associativity == self::LEFT_ASSOC) { return true; } return false; }