static boolean isValidRuleExpression(Expression expression) {
if (expression instanceof BinaryExpression) {
if (AstUtils.isArrayItemExpression(expression)) {
return isValidRuleExpression(((BinaryExpression)expression).getLeftExpression());
} else {
BinaryExpression binaryExpression = (BinaryExpression) expression;
boolean isValidLeftExpression = isValidRuleExpression(binaryExpression.getLeftExpression());
boolean isValidRightExpression = isValidRuleExpression(binaryExpression.getRightExpression());
boolean isValidBinaryOperation = RuleExpressionVerifier.isValidRuleBinaryOperation(binaryExpression.getOperation());
return isValidBinaryOperation && isValidLeftExpression && isValidRightExpression;
}
} else if (expression instanceof NotExpression) {
return isValidRuleExpression(((NotExpression)expression).getExpression());
} else if (expression instanceof BitwiseNegationExpression) {