@Test public void precedence() throws Exception { assertEquals("{-1 ADD {2 DIV 3}}", parseExpression("-1 add 2 div 3").toString()); assertEquals("{true OR {{NOT false} AND true}}", parseExpression("true or not false and true").toString()); }
private Expression parseExpression() throws UriParserException, UriValidationException { Expression left = parseAnd(); while (tokenizer.next(TokenKind.OrOperator)) { checkType(left, EdmPrimitiveTypeKind.Boolean); checkNoCollection(left); final Expression right = parseAnd(); checkType(right, EdmPrimitiveTypeKind.Boolean); checkNoCollection(right); left = new BinaryImpl(left, BinaryOperatorKind.OR, right, odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean)); } return left; }
ExpressionParser { private Expression parseExpression() throws UriParserException, UriValidationException { Expression left = parseAnd(); while (tokenizer.next(TokenKind.OrOperator)) { checkType(left, EdmPrimitiveTypeKind.Boolean); checkNoCollection(left); final Expression right = parseAnd(); checkType(right, EdmPrimitiveTypeKind.Boolean); checkNoCollection(right); left = new BinaryImpl(left, BinaryOperatorKind.OR, right, odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean)); } return left; } }
ExpressionParser { private Expression parseExpression() throws UriParserException, UriValidationException { Expression left = parseAnd(); while (tokenizer.next(TokenKind.OrOperator)) { checkType(left, EdmPrimitiveTypeKind.Boolean); checkNoCollection(left); final Expression right = parseAnd(); checkType(right, EdmPrimitiveTypeKind.Boolean); checkNoCollection(right); left = new BinaryImpl(left, BinaryOperatorKind.OR, right, odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean)); } return left; } ExpressionParser(final Edm edm, final OData odata); }
ExpressionParser { private Expression parseExpression() throws UriParserException, UriValidationException { Expression left = parseAnd(); while (tokenizer.next(TokenKind.OrOperator)) { checkType(left, EdmPrimitiveTypeKind.Boolean); checkNoCollection(left); final Expression right = parseAnd(); checkType(right, EdmPrimitiveTypeKind.Boolean); checkNoCollection(right); left = new BinaryImpl(left, BinaryOperatorKind.OR, right, odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean)); } return left; } ExpressionParser(final Edm edm, final OData odata); Expression parse(UriTokenizer tokenizer, final EdmType referringType,
      final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases); }
ExpressionParser { private Expression parseExpression() throws UriParserException, UriValidationException { Expression left = parseAnd(); while (tokenizer.next(TokenKind.OrOperator)) { checkType(left, EdmPrimitiveTypeKind.Boolean); checkNoCollection(left); final Expression right = parseAnd(); checkType(right, EdmPrimitiveTypeKind.Boolean); checkNoCollection(right); left = new BinaryImpl(left, BinaryOperatorKind.OR, right, odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean)); } return left; } ExpressionParser(final Edm edm, final OData odata); Expression parse(UriTokenizer tokenizer, final EdmType referringType,
      final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases);  }