void (final XPathBinaryExpression o) { final XPathExpression operand = o.getLOperand(); if (operand != null && o.getXPathVersion() == XPathVersion.V2) { final XPathElementType operator = o.getOperator(); if (XPath2TokenTypes.COMP_OPS.contains(operator)) { if (operand instanceof XPathBinaryExpression && XPath2TokenTypes.COMP_OPS.contains(((XPathBinaryExpression)operand).getOperator())) { AnnotationBuilder builder = myHolder.newAnnotation(HighlightSeverity.ERROR, XPathBundle.message("annotator.error.consecutive.comparison.not.allowed.in.xpath")); final XPathExpression rOperand = o.getROperand(); if (rOperand != null) { final String replacement = "(" + operand.getText() + ") " + o.getOperationSign() + " " + rOperand.getText(); builder = builder.withFix(new ExpressionReplacementFix(replacement, o)); } builder.create(); } if (XPath2TokenTypes.NODE_COMP_OPS.contains(operator)) { checkApplicability(o, XPath2Type.NODE); } else if (operator == XPath2TokenTypes.WEQ || operator == XPath2TokenTypes.WNE || operator == XPathTokenTypes.EQ || operator == XPathTokenTypes.NE) { checkApplicability(o, XPath2Type.NUMERIC,XPath2Type.BOOLEAN,XPath2Type.STRING, XPath2Type.DATE,XPath2Type.TIME,XPath2Type.DATETIME,XPath2Type.DURATION, XPath2Type.HEXBINARY,XPath2Type.BASE64BINARY,XPath2Type.ANYURI,XPath2Type.QNAME); } else if (operator == XPath2TokenTypes.WGT || operator == XPath2TokenTypes.WGE || operator == XPath2TokenTypes.WLE || operator == XPath2TokenTypes.WLT || operator == XPathTokenTypes.GT || operator == XPathTokenTypes.GE || operator == XPathTokenTypes.LE || operator == XPathTokenTypes.LT) { checkApplicability(o, XPath2Type.NUMERIC,XPath2Type.BOOLEAN,XPath2Type.STRING, XPath2Type.DATE,XPath2Type.TIME,XPath2Type.DATETIME,XPath2Type.DURATION, XPath2Type.ANYURI); } } else if (XPath2TokenTypes.UNION_OPS.contains(operator) || XPath2TokenTypes.INTERSECT_EXCEPT.contains(operator)) { checkApplicability(o, XPath2SequenceType.create(XPath2Type.NODE, XPath2SequenceType.Cardinality.ZERO_OR_MORE)); } else if (operator == XPath2TokenTypes.TO) { checkApplicability(o, XPath2Type.INTEGER); } else if (operator == XPathTokenTypes.AND || operator == XPathTokenTypes.OR) { checkApplicability(o, XPath2Type.BOOLEAN); } else if (XPathTokenTypes.ADD_OPS.contains(operator)) { checkApplicability(o, XPath2Type.NUMERIC, XPath2Type.DURATION, XPath2Type.DATE, XPath2Type.TIME, XPath2Type.DATETIME); } else if (XPath2TokenTypes.MULT_OPS.contains(operator)) { if (operator == XPath2TokenTypes.IDIV || operator == XPathTokenTypes.MOD) { checkApplicability(o, XPath2Type.NUMERIC); } else if (operator == XPathTokenTypes.DIV) { checkApplicability(o, XPath2Type.NUMERIC, XPath2Type.DURATION); } else { assert operator == XPathTokenTypes.MULT; checkApplicability(o, XPath2Type.NUMERIC, XPath2Type.DURATION); } } } checkExpression(myHolder, o); super.visitXPathBinaryExpression(o); }