Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.ASTNode


    this.scribe.enterAlignment(binaryExpressionAlignment);
    boolean ok = false;
    do {
      try {
        for (int i = 0; i < fragmentsSize - 1; i++) {
          ASTNode fragment = fragments[i];
          fragment.traverse(this, scope);
          this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
          if (this.scribe.lastNumberOfNewLines == 1) {
            // a new line has been inserted by printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT)
            this.scribe.indentationLevel = binaryExpressionAlignment.breakIndentationLevel;
          }
View Full Code Here


    }

    traversedContext.recordReturnFrom(flowInfo.unconditionalInits());

    if (traversedContext instanceof InsideSubRoutineFlowContext) {
      ASTNode node = traversedContext.associatedNode;
      if (node instanceof TryStatement) {
        TryStatement tryStatement = (TryStatement) node;
        flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
      }
    }
View Full Code Here

      return;

    traversedContext.recordReturnFrom(flowInfo.unconditionalInits());

    if (traversedContext instanceof InsideSubRoutineFlowContext) {
      ASTNode node = traversedContext.associatedNode;
      if (node instanceof TryStatement) {
        TryStatement tryStatement = (TryStatement) node;
        flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
      }
    }
View Full Code Here

   
    // notify the nodes in the syntactical order
    if (length > 0) {
      quickSort(nodes, 0, length-1);
      for (int i=0;i<length;i++) {
        ASTNode node = nodes[i];
        if (node instanceof ImportReference) {
          ImportReference importRef = (ImportReference)node;
          if (node == parsedUnit.currentPackage) {
            notifySourceElementRequestor(importRef, true);
          } else {
View Full Code Here

* Sort the given ast nodes by their positions.
*/
private static void quickSort(ASTNode[] sortedCollection, int left, int right) {
  int original_left = left;
  int original_right = right;
  ASTNode mid = sortedCollection[left +  (right - left) / 2];
  do {
    while (sortedCollection[left].sourceStart < mid.sourceStart) {
      left++;
    }
    while (mid.sourceStart < sortedCollection[right].sourceStart) {
      right--;
    }
    if (left <= right) {
      ASTNode tmp = sortedCollection[left];
      sortedCollection[left] = sortedCollection[right];
      sortedCollection[right] = tmp;
      left++;
      right--;
    }
View Full Code Here

        return collector.getComments();
    }

    @Override
    public Node createDeclarationTree(JavaStructureNode node) {
        ASTNode astNode = node.getASTNode();
        Node root = createRootNode(node, astNode);
        return createDeclarationTree(astNode, root);
    }
View Full Code Here

        return root;
    }

    @Override
    public Node createDeclarationTree(JavaStructureNode node, String qualifiedName) {
        ASTNode astNode = node.getASTNode();
        Node root = createRootNode(node, astNode);
        root.setValue(qualifiedName);
        return createDeclarationTree(astNode, root);
    }
View Full Code Here

        return root;
    }

    @Override
    public Node createMethodBodyTree(JavaStructureNode node) {
        ASTNode astNode = node.getASTNode();
        if (astNode instanceof AbstractMethodDeclaration) {
            Node root = createRootNode(node, astNode);
            fBodyConverter.initialize(root, astNode, fComments, fCompilation.getScanner());
            ((AbstractMethodDeclaration) astNode).traverse(fBodyConverter, (ClassScope) null);
            return root;
View Full Code Here

    public void postVisit(ASTNode node) {
        if (isUnusableNode(node)) {
            return;
        }
        if (!fLastAssociationCandidate.isEmpty() && (node == fLastAssociationCandidate.peek()[2])) {
            ASTNode preceedingNode = fLastAssociationCandidate.peek()[0];
            ASTNode commentNode = fLastAssociationCandidate.peek()[1];
            ASTNode succeedingNode = fLastAssociationCandidate.peek()[2];

            if ((preceedingNode != null) && (succeedingNode != null)) {
                String preceedingNodeString = getASTString(preceedingNode);
                String succeedingNodeString = getASTString(succeedingNode);
                String commentNodeString = getCommentString(commentNode);
View Full Code Here

     * @return <code>2</code> if the comment node is on the same line as the other node, <code>1</code> if they are on
     *         adjacent line, <code>0</code> otherwise (times two)
     */
    private int proximityRating(ASTNode left, ASTNode right) {
        int result = 0;
        ASTNode nodeOne = left;
        ASTNode nodeTwo = right;
        // swap code, if nodeOne is not before nodeTwo
        if ((nodeTwo.sourceStart() - nodeOne.sourceStart()) < 0) {
            ASTNode tmpNode = nodeOne;
            nodeOne = nodeTwo;
            nodeTwo = tmpNode;
        }

        int endOfNodePosition = nodeOne.sourceEnd();
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.ASTNode

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.