Package lombok.ast

Examples of lombok.ast.Position


            //We don't have to check if this char is a backslash and set state to 1; JLS says backslash-u is not recursively applied.
            state = 0;
          }
        } else {
          //Invalid unicode escape.
          problems.add(new ParseProblem(new Position(idx-buffer.length(), idx), "Invalid backslash-u escape: \\u is supposed to be followed by 4 hex digits."));
          out.append(buffer.toString());
          state = 0;
        }
        break;
      }
View Full Code Here


      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()));
      }
    }
    return current;
  }
View Full Code Here

    return posify(ai);
  }
 
  public Node createDimension(Node dimExpr, org.parboiled.Node<Node> arrayOpen) {
    ArrayDimension d = new ArrayDimension().rawDimension(dimExpr);
    if (arrayOpen != null) d.setPosition(new Position(arrayOpen.getStartIndex(), currentPos()));
    return d;
  }
View Full Code Here

    return posify(ac);
  }
 
  public Node addParens(Node v) {
    if (v instanceof Expression) {
      ((Expression)v).astParensPositions().add(new Position(startPos(), currentPos()));
    }
    return v;
  }
View Full Code Here

    id.setPosition(pos);
    return id;
  }
 
  private Position toPosition(int start, int end) {
    return new Position(start, end + 1);
  }
View Full Code Here

  private Position toPosition(int start, int end) {
    return new Position(start, end + 1);
  }
 
  private Position toPosition(long pos) {
    return new Position((int) (pos >> 32), (int) (pos & 0xFFFFFFFFL) + 1);
  }
View Full Code Here

 
  private lombok.ast.Modifiers toModifiers(int modifiers, Annotation[] annotations, int start, int end) {
    lombok.ast.Modifiers m = new lombok.ast.Modifiers();
    for (KeywordModifier mod : KeywordModifier.fromReflectModifiers(modifiers)) m.astKeywords().addToEnd(mod);
    fillList(annotations, m.rawAnnotations());
    m.setPosition(new Position(start, end));
    return m;
  }
View Full Code Here

 
  private void registerNode(Node node) {
    nodeStack.add(node);
    if (node == null) return;
   
    Position p = node.getPosition();
    if (p.isUnplaced()) problems.add(new AstException(node, String.format(
        "this node is unplaced [%s]", node.getClass().getSimpleName())));
    else {
      int delta = p.getStart() - getCurrentPosition(true);
      if (delta != 0) {
        int actualPos = getCurrentPosition(true);
        int repPos = p.getStart();
        reportError(node, "start", actualPos, repPos);
      }
    }
  }
View Full Code Here

  }
 
  private void checkNodeClose() {
    Node node = nodeStack.pop();
    if (node == null) return;
    Position p = node.getPosition();
    if (p.isUnplaced()) return//opener already generated error.
    if (p.getStart() > p.getEnd()) problems.add(new AstException(node, "Node ends before it starts."));
    int delta = p.getEnd() - Math.max(getCurrentPosition(false), p.getStart());
    if (delta != 0) {
      int actualPos = getCurrentPosition(false);
      int repPos = p.getEnd();
      reportError(node, "end", actualPos, repPos);
    }
  }
View Full Code Here

          String left = ((StringLiteral) node.rawLeft()).astValue();
          String right = ((StringLiteral) node.rawRight()).astValue();
          int start = node.rawLeft().getPosition().getStart();
          int end = node.rawRight().getPosition().getEnd();
          if (left != null && right != null && node.getParent() != null) {
            node.getParent().replaceChild(node, new StringLiteral().astValue(left + right).setPosition(new Position(start, end)));
          }
        }
        return true;
      }
    });
View Full Code Here

TOP

Related Classes of lombok.ast.Position

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.