Package lombok.ast

Examples of lombok.ast.UnaryExpression


        set(node, new NullLiteral());
        return;
      }
     
      if (literal != null) {
        if (negative) set(node, new UnaryExpression().astOperand(setPos(node, literal)).astOperator(UnaryOperator.UNARY_MINUS));
        else set(node, literal);
      } else {
        throw new IllegalArgumentException("Unknown JCLiteral type tag:" + node.typetag);
      }
    }
View Full Code Here


      cast.rawTypeReference(toTree(node.getType(), FlagKey.TYPE_REFERENCE));
      set(node, cast);
    }
   
    @Override public void visitUnary(JCUnary node) {
      UnaryExpression expr = new UnaryExpression();
      expr.rawOperand(toTree(node.getExpression()));
      expr.astOperator(JcTreeBuilder.UNARY_OPERATORS.inverse().get(getTag(node)));
      set(node, expr);
    }
View Full Code Here

      return posify(new Cast().rawOperand(operand).rawTypeReference(opNode.getValue()));
    } else {
      if (symbol != null) symbol = symbol.trim();
      if (!symbol.isEmpty()) {
        UnaryOperator op = UnaryOperator.fromSymbol(symbol, false);
        UnaryExpression expr = new UnaryExpression().rawOperand(operand);
        if (op != null) expr.astOperator(op);
        return posify(expr);
      }
    }
   
    return operand;
View Full Code Here

        if (symbol == null) continue;
        symbol = symbol.trim();
        if (symbol.isEmpty()) continue;
       
        UnaryOperator op = UnaryOperator.fromSymbol(symbol, false);
        UnaryExpression expr = new UnaryExpression().rawOperand(current);
        if (op != null) expr.astOperator(op);
        current = expr;
      }
     
      if (prev != null && !prev.getPosition().isUnplaced() && prev != current && current != null) {
        positionSpan(current, operator, operand);
View Full Code Here

    for (int i = 0; i < operators.size(); i++) {
      String op = operators.get(i);
      if (op == null) continue;
      op = op.trim();
      Node prev = current;
      if (op.equals("++")) current = new UnaryExpression().rawOperand(current).astOperator(UnaryOperator.POSTFIX_INCREMENT);
      else if (op.equals("--")) current = new UnaryExpression().rawOperand(current).astOperator(UnaryOperator.POSTFIX_DECREMENT);
      org.parboiled.Node<Node> p = nodes.get(i);
      if (prev != null && !prev.getPosition().isUnplaced() && p != null) {
        current.setPosition(new Position(prev.getPosition().getStart(), p.getEndIndex()));
      }
    }
View Full Code Here

      @Override public boolean visitIntegralLiteral(IntegralLiteral node) {
        long v = node.astMarkedAsLong() ? node.astLongValue() : node.astIntValue();
        if (node.astLiteralType() != LiteralType.DECIMAL && v < 0) {
          if (node.astMarkedAsLong()) node.astLongValue(Math.abs(node.astLongValue()));
          else node.astIntValue(Math.abs(node.astIntValue()));
          UnaryExpression e = new UnaryExpression().astOperator(UnaryOperator.UNARY_MINUS);
          node.replace(e);
          e.astOperand(node);
          e.setPosition(node.getPosition());
        }
        node.astLiteralType(LiteralType.DECIMAL);
        return false;
      }
     
View Full Code Here

    assertNull(n.getErrorReasonForValue());
    n.astLiteralType(LiteralType.DECIMAL);
    assertFalse("raw value starts with -", n.rawValue().startsWith("-"));
    assertNotNull(n.getErrorReasonForValue());
   
    UnaryExpression unary = new UnaryExpression().astOperand(n);
    assertNotNull(n.getErrorReasonForValue());
    unary.astOperator(UnaryOperator.UNARY_MINUS);
    assertNull(n.getErrorReasonForValue());
    n.astParensPositions().add(Position.UNPLACED);
    assertNotNull(n.getErrorReasonForValue());
  }
View Full Code Here

    assertNull(n.getErrorReasonForValue());
    n.astLiteralType(LiteralType.DECIMAL);
    assertFalse("raw value starts with -", n.rawValue().startsWith("-"));
    assertNotNull(n.getErrorReasonForValue());
   
    new UnaryExpression().astOperator(UnaryOperator.UNARY_MINUS).astOperand(n);
    assertNotNull(n.getErrorReasonForValue());
  }
View Full Code Here

TOP

Related Classes of lombok.ast.UnaryExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.