Exemplo n.º 1
0
 @SuppressWarnings("unchecked")
 private void condition() {
   value();
   if (token == Lexer.GREATER
       || token == Lexer.GREATEROREQUAL
       || token == Lexer.LESS
       || token == Lexer.LESSOREQUAL
       || token == Lexer.EQUAL
       || token == Lexer.NOTEQUAL) {
     NonTerminal condition = NodeFactory.createNonTerminal(token);
     condition.setLeft(root);
     token = lexer.nextToken();
     value();
     condition.setRight(root);
     root = condition;
   } else {
     throw new MalformedExpressionException(
         String.format("Conditional operator instead of <%s> expected.", token));
   }
 }