Exemple #1
0
 private BooleanExpression parseBooleanExpression() {
   Expression left = parseExpression();
   TokenType type = myLexer.nextToken();
   ComparisonOperation operation = BOOLEAN_OPERATIONS.get(type);
   if (operation == null) {
     throw new ParsingException(
         "'<', '>', '<=', '>=', '!=' or '==' expected but " + myLexer.getToken() + " found");
   }
   Expression right = parseExpression();
   return new ComparisonExpression(operation, left, right);
 }
Exemple #2
0
 static {
   BOOLEAN_OPERATIONS.put(TokenType.EQUAL, Operations.EQUAL);
   BOOLEAN_OPERATIONS.put(TokenType.LESS, Operations.LESS);
   BOOLEAN_OPERATIONS.put(TokenType.GREATER, Operations.GREATER);
   BOOLEAN_OPERATIONS.put(TokenType.GREATER_EQ, Operations.GREATER_EQ);
   BOOLEAN_OPERATIONS.put(TokenType.LESS_EQ, Operations.LESS_EQ);
   BOOLEAN_OPERATIONS.put(TokenType.NOT_EQ, Operations.NOT_EQ);
 }