Examples of ForwardingAstVisitor


Examples of lombok.ast.ForwardingAstVisitor

   
    Node result = getResult();
    if (javadocs.isEmpty()) return result;
   
    val nodePositions = new TreeMap<Integer, Node>();
    result.accept(new ForwardingAstVisitor() {
      private void addToMap(Node positionNode, Node linked) {
        if (positionNode == null) return;
       
        int start = positionNode.getPosition().getStart();
        if (start == -1) return;
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

    /* Process actual whitespace in preprocessed source data */ {
      char[] chars = preprocessed.toCharArray();
      for (int i = 0; i < chars.length; i++) if (Character.isWhitespace(chars[i])) whitespace[i] = true;
    }
   
    for (Node node : nodes) node.accept(new ForwardingAstVisitor() {
      @Override public boolean visitNode(Node node) {
        Position p = node.getPosition();
        if (p.isUnplaced()) return false;
       
        int trimmed = Math.min(whitespace.length, p.getEnd());
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

      }
    });
  }
 
  private void fixPositions(List<? extends Node> nodes) {
    for (Node node : nodes) node.accept(new ForwardingAstVisitor() {
      @Override public boolean visitNode(Node node) {
        Position p = node.getPosition();
        if (!p.isUnplaced()) {
          node.setPosition(new Position(mapPosition(p.getStart()), mapPosition(p.getEnd())));
        }
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

  /**
   * Associates comments that are javadocs to the node they belong to, by checking if the node that immediately follows a javadoc node is a JavadocContainer.
   */
  private void associateJavadoc(List<Comment> comments, List<Node> nodes) {
    final TreeMap<Integer, Node> startPosMap = Maps.newTreeMap();
    for (Node node : nodes) node.accept(new ForwardingAstVisitor() {
      @Override public boolean visitNode(Node node) {
        if (node.isGenerated()) return false;
        int startPos = node.getPosition().getStart();
        Node current = startPosMap.get(startPos);
        if (current == null || !(current instanceof JavadocContainer)) {
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

      fail(source.getProblems().get(0).toString());
    }
   
    Node node = source.getNodes().get(0);
    node.accept(new SyntacticValidityVisitor(true));
    node.accept(new ForwardingAstVisitor() {
      @Override public boolean visitNode(Node node) {
        for (Message m : node.getMessages()) if (m.isError()) {
          fail(String.format("Source: %s[%s]: %s: %s\n", source.getName(), node.getPosition(), node, m.getMessage()));
         
        }
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

  public boolean testJcTreeConverter(Source source) throws Exception {
    return testCompiler(source);
  }
 
  private static void normalizeNumberLiterals(Node tree) {
    tree.accept(new ForwardingAstVisitor() {
      @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()));
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

      }
    });
  }
 
  private static void foldStringConcats(Node tree) {
    tree.accept(new ForwardingAstVisitor() {
      @Override public boolean visitBinaryExpression(BinaryExpression node) {
        if (node.rawLeft() != null) node.rawLeft().accept(this);
        if (node.rawRight() != null) node.rawRight().accept(this);
        if (
            node.rawLeft() instanceof StringLiteral && node.rawRight() instanceof StringLiteral &&
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

    tree.accept(new SourcePrinter(formatter));
    return formatter.finish();
  }
 
  private static void deleteComments(Node tree) {
    tree.accept(new ForwardingAstVisitor() {
      @Override public boolean visitComment(Comment node) {
        node.unparent();
        return false;
      }
    });
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

      }
    });
  }
 
  private void splitVariableDefinitionEntries(Node node) {
    node.accept(new ForwardingAstVisitor() {
     
      @Override public boolean visitVariableDefinition(VariableDefinition node) {
       
        if (node.astVariables().size() == 1) {
          return true;
View Full Code Here

Examples of lombok.ast.ForwardingAstVisitor

 
  /*
   * Dependent on splitVariableDefinitionEntries().
   */
  private void simplifyArrayDecls(Node node) {
    node.accept(new ForwardingAstVisitor() {
      @Override public boolean visitVariableDefinition(VariableDefinition node) {
        VariableDefinitionEntry varDefEntry = node.astVariables().first();
        int arrayDimensions = varDefEntry.astArrayDimensions();
        if (arrayDimensions == 0) {
          return true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.