Package org.eclipse.dltk.ast

Examples of org.eclipse.dltk.ast.ASTNode


  @Override
  public void traverse(ASTVisitor visitor) throws Exception {
    if (visitor.visit(this)) {
      if (this.expressions != null) {
        for (int i = 0; i < this.expressions.size(); i++) {
          ASTNode node = this.expressions.get(i);
          if (node != null) {
            node.traverse(visitor);
          }
        }
      }
      visitor.endvisit(this);
    }
View Full Code Here


  public void printNode(CorePrinter output) {
    if (this.expressions != null) {
      output.formatPrintLn("");
      Iterator i = this.expressions.iterator();
      while (i.hasNext()) {
        ASTNode node = (ASTNode) i.next();
        node.printNode(output);
        output.formatPrintLn(" ");
      }
    }
  }
View Full Code Here

  public String toString() {
    String value = "";
    if (this.expressions != null) {
      Iterator i = this.expressions.iterator();
      while (i.hasNext()) {
        ASTNode node = (ASTNode) i.next();
        value += node.toString();
        value += " ";
      }
    }

    return value;
View Full Code Here

  public static RutaFeatureDeclaration createFeatureDeclaration(Object eachTO, Token eachName) {
    int declBounds[] = { 0, 0 };
    String type = "";
    if (eachTO instanceof ASTNode) {
      ASTNode node = (ASTNode) eachTO;
      type = node.toString();
      declBounds = getBounds(eachName, node);
    } else if (eachTO instanceof Token) {
      Token token = (Token) eachTO;
      type = token.getText();
      declBounds = getBounds(eachName, token);
View Full Code Here

        ModuleDeclaration moduleDeclaration = parser.parse(sm);
        String word = document.get(wordRegion.getOffset(), wordRegion.getLength());
        RutaReferenceVisitor referenceVisitor = new RutaReferenceVisitor(wordRegion
                .getOffset());
        moduleDeclaration.traverse(referenceVisitor);
        ASTNode node = referenceVisitor.getResult();
        if (node instanceof RutaVariableReference
                && moduleDeclaration instanceof RutaModuleDeclaration) {
          RutaVariableReference vr = (RutaVariableReference) node;
          RutaModuleDeclaration parsed = (RutaModuleDeclaration) moduleDeclaration;
          if (vr.getType() == RutaTypeConstants.RUTA_TYPE_AT) {
View Full Code Here

    // 090813:
    RutaModuleDeclaration parsed = (RutaModuleDeclaration) this.parser.parse(module);

    // types = getShortNames(types);

    ASTNode node;
    if (parsed != null) {
      try {
        RutaReferenceVisitor referenceVisitor = new RutaReferenceVisitor(
                actualCompletionPosition);
        parsed.traverse(referenceVisitor);
View Full Code Here

    if (statements == null || element == null) {
      return;
    }
    Iterator i = statements.iterator();
    while (i.hasNext()) {
      ASTNode nde = (ASTNode) i.next();
      if (nde.equals(node)) {
        if (node instanceof MethodDeclaration) {
          String oName = ((MethodDeclaration) node).getName();
          if (oName.indexOf("::") != -1) {
            String pName = oName.substring(0, oName.lastIndexOf("::"));
            pName = pName.replaceAll("::", "\\$");

            if (pName.startsWith("$")) {
              if (pName.equals("$")) {
                element = sourceModule;
              } else {
                try {
                  element = findTypeFrom(sourceModule.getChildren(), "", pName, '$');
                } catch (ModelException e) {
                  if (DLTKCore.DEBUG) {
                    e.printStackTrace();
                  }
                }
              }
            } else {
              pName = "$" + pName;
              try {
                element = findTypeFrom(element.getChildren(), "", pName, '$');
                if (element == null) {
                  return;
                }
              } catch (ModelException e) {
                e.printStackTrace();
                return;
              }
            }
          }
        }
        String nodeName = getNodeChildName(node);
        if (nodeName != null) {
          IModelElement e = null;
          if (nodeName.startsWith("::")) {
            nodeName = nodeName.substring(2);
            e = findChildrenByName(nodeName, sourceModule);
          } else {
            e = findChildrenByName(nodeName, element);
          }
          if (e == null && resolver != null) {
            e = resolver.findElementParent(node, nodeName, element);

          }
          if (e != null) {
            List toRemove = new ArrayList();
            for (int k = 0; k < selectionElements.size(); ++k) {
              IModelElement ke = (IModelElement) selectionElements.get(k);
              String keName = ke.getElementName();
              if (keName.equals(nodeName)) {
                toRemove.add(ke);
              }
            }
            for (int k = 0; k < toRemove.size(); ++k) {
              selectionElements.remove(toRemove.get(k));
            }
            selectionElements.add(e);
          }
        }
        return;
      }
      if (nde.sourceStart() <= node.sourceStart() && node.sourceEnd() <= nde.sourceEnd()) {
        if (element instanceof IParent) {
          if (nde instanceof TypeDeclaration) {
            TypeDeclaration type = (TypeDeclaration) nde;
            String typeName = getNodeChildName(type);
            IModelElement e = findChildrenByName(typeName, element);
View Full Code Here

      for (int i = 0; i < astnodeListArray.length; i++) {
        List<ASTNode> list = astnodeListArray[i];
        if (list == null || list.isEmpty()) {
          continue;
        }
        ASTNode firstNode = list.get(0);
        if (firstNode != null) {
          bounds[0] = Math.min(bounds[0], firstNode.sourceStart());
        }
       
        ASTNode lastNode = list.get(list.size() - 1);
        if (lastNode != null) {
          bounds[1] = Math.max(bounds[0], lastNode.sourceEnd());
        }
      }
    }
    return bounds;
  }
View Full Code Here

  @Override
  public void traverse(ASTVisitor visitor) throws Exception {
    if (visitor.visit(this)) {
      if (this.expressions != null) {
        for (int i = 0; i < this.expressions.size(); i++) {
          ASTNode node = this.expressions.get(i);
          if (node != null) {
            node.traverse(visitor);
          }
        }
      }
      visitor.endvisit(this);
    }
View Full Code Here

  public void printNode(CorePrinter output) {
    if (this.expressions != null) {
      output.formatPrintLn("");
      Iterator i = this.expressions.iterator();
      while (i.hasNext()) {
        ASTNode node = (ASTNode) i.next();
        node.printNode(output);
        output.formatPrintLn(" ");
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.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.