Package org.eclipse.cdt.core.dom.ast

Examples of org.eclipse.cdt.core.dom.ast.IASTNode


      children = ((IASTCompositeTypeSpecifier) node).getDeclarations(true);
    } else {
      children = node.getChildren();
    }
    for (int i = children.length; --i >= 0;) {
      final IASTNode child = getReplacementNode(children[i]);
      if (child != null) {
        return child;
      }
    }
    return null;
View Full Code Here


    }
    return node;
  }

  private IASTNode getPreviousSiblingNode(final IASTNode node) {
    final IASTNode parent = node.getParent();
    IASTNode[] siblings;
    if (parent instanceof ICPPASTNamespaceDefinition) {
      siblings = ((ICPPASTNamespaceDefinition) parent).getDeclarations(true);
    } else if (parent instanceof IASTCompositeTypeSpecifier) {
      siblings = ((IASTCompositeTypeSpecifier) parent).getDeclarations(true);
    } else {
      siblings = parent.getChildren();
    }
    boolean beforeNode = false;
    for (int i = siblings.length; --i >= 0;) {
      final IASTNode sibling = siblings[i];
      if (sibling == node) {
        beforeNode = true;
      } else if (beforeNode && (getReplacementNode(sibling) != null)) {
        return sibling;
      }
View Full Code Here

    final IASTPreprocessorStatement[] preprocessorStatements = ast.getAllPreprocessorStatements();
    int low = 0;
    int high = preprocessorStatements.length;
    while (low < high) {
      final int mid = (low + high) / 2;
      final IASTNode statement = preprocessorStatements[mid];
      if (statement.isPartOfTranslationUnitFile() && (endOffset(statement) > offset)) {
        high = mid;
      } else {
        low = mid + 1;
      }
    }
    final IASTNode statement = --low >= 0 ? preprocessorStatements[low] : null;

    final IASTNode originalSibling = getPreviousSiblingNode(node);
    final IASTNode sibling = originalSibling == null ? null : getReplacementNode(originalSibling);
    if ((statement == null) || !statement.isPartOfTranslationUnitFile()) {
      return sibling;
    }
    if (sibling == null) {
      final IASTNode parent = node.getParent();
      if (offset(parent) >= endOffset(statement)) {
        return null;
      }
      return statement;
    }
View Full Code Here

    return endOffset(originalSibling) >= endOffset(statement) ? sibling : statement;
  }

  private IASTNode getNextSiblingNode(final IASTNode node) {
    final IASTNode parent = node.getParent();
    IASTNode[] siblings;
    if (parent instanceof ICPPASTNamespaceDefinition) {
      siblings = ((ICPPASTNamespaceDefinition) parent).getDeclarations(true);
    } else if (parent instanceof IASTCompositeTypeSpecifier) {
      siblings = ((IASTCompositeTypeSpecifier) parent).getDeclarations(true);
    } else {
      siblings = parent.getChildren();
    }
    boolean beforeNode = false;
    for (final IASTNode sibling : siblings) {
      if (sibling == node) {
        beforeNode = true;
View Full Code Here

    final IASTPreprocessorStatement[] preprocessorStatements = ast.getAllPreprocessorStatements();
    int low = 0;
    int high = preprocessorStatements.length;
    while (low < high) {
      final int mid = (low + high) / 2;
      final IASTNode statement = preprocessorStatements[mid];
      if (statement.isPartOfTranslationUnitFile() && (offset(statement) > endOffset)) {
        high = mid;
      } else {
        low = mid + 1;
      }
    }
    final IASTNode statement = high < preprocessorStatements.length ? preprocessorStatements[high] : null;

    final IASTNode originalSibling = getNextSiblingNode(node);
    final IASTNode sibling = originalSibling == null ? null : getReplacementNode(originalSibling);
    if ((statement == null) || !statement.isPartOfTranslationUnitFile()) {
      return sibling;
    }
    if (sibling == null) {
      final IASTNode parent = node.getParent();
      if (endOffset(parent) <= offset(statement)) {
        return null;
      }
      return statement;
    }
View Full Code Here

  private boolean isAppendable(final ASTModification modification) {
    if (modification.getKind() != ModificationKind.APPEND_CHILD) {
      return false;
    }
    final IASTNode node = modification.getNewNode();
    if (node instanceof ContainerNode) {
      for (final IASTNode containedNode : ((ContainerNode) node).getNodes()) {
        if (!((containedNode instanceof IASTDeclaration) || (containedNode instanceof IASTStatement))) {
          return false;
        }
View Full Code Here

    }
  }

  private List<IASTComment> getLeadingComments(final IASTNode node) {
    final List<IASTComment> leadingComments = commentMap.getLeadingCommentsForNode(node);
    final IASTNode originalNode = node.getOriginalNode();
    if (originalNode != node) {
      leadingComments.addAll(commentMap.getLeadingCommentsForNode(originalNode));
    }
    return leadingComments;
  }
View Full Code Here

    return !getTrailingComments(node).isEmpty();
  }

  private List<IASTComment> getTrailingComments(final IASTNode node) {
    final List<IASTComment> trailingComments = commentMap.getTrailingCommentsForNode(node);
    final IASTNode originalNode = node.getOriginalNode();
    if (originalNode != node) {
      trailingComments.addAll(commentMap.getTrailingCommentsForNode(originalNode));
    }
    return trailingComments;
  }
View Full Code Here

    return !getFreestandingComments(node).isEmpty();
  }

  private List<IASTComment> getFreestandingComments(final IASTNode node) {
    final List<IASTComment> freestandingComments = commentMap.getFreestandingCommentsForNode(node);
    final IASTNode originalNode = node.getOriginalNode();
    if (originalNode != node) {
      freestandingComments.addAll(commentMap.getFreestandingCommentsForNode(originalNode));
    }
    return freestandingComments;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.dom.ast.IASTNode

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.