Package org.eclipse.dltk.ast

Examples of org.eclipse.dltk.ast.ASTNode


    if (s instanceof RutaStringExpression && ((RutaExpression) s).getExpression() != null) {
      RutaStringExpression tmse = (RutaStringExpression) s;
      List<?> childs = tmse.getExpression().getChilds();
      Object object2 = childs.get(0);
      if (object2 instanceof ASTNode) {
        ASTNode astnode = (ASTNode) object2;
        List<?> childs2 = astnode.getChilds();
        for (Object object : childs2) {
          if (object instanceof RutaExpression) {
            RutaExpression expr = (RutaExpression) object;
            // if (expr.isInParantheses()) {
            // append(PAR_OPEN);
View Full Code Here


    // print Quantifiers
    List<? extends ASTNode> quantifierExpressions = ruleEl.getQuantifierExpressions();
    if (quantifierExpressions != null && !quantifierExpressions.isEmpty()) {
      if (quantifierExpressions.size() == 1) {
        ASTNode astNode = quantifierExpressions.get(0);
        if (astNode instanceof RutaQuantifierLiteralExpression) {
          append(astNode);
        } else {
          append(BRACK_OPEN);
          append(astNode);
View Full Code Here

    if (astnodes == null) {
      return;
    }
    Iterator iterator2 = astnodes.iterator();
    while (iterator2.hasNext()) {
      ASTNode node = (ASTNode) iterator2.next();
      try {
        node.traverse(this);
      } catch (Exception e) {
        e.printStackTrace();
      }
      if (iterator2.hasNext()) {
        appendSeparator(separator);
View Full Code Here

      }
    }

    if (s instanceof RutaDeclareDeclarationsStatement) {
      RutaDeclareDeclarationsStatement dds = (RutaDeclareDeclarationsStatement) s;
      ASTNode parent = dds.getParent();
      if (parent != null && parent instanceof RutaVariableReference) {
        RutaVariableReference p = (RutaVariableReference) parent;
        String name = p.getName();
        name = expand(name);
        parentTypeInDeclaration = name;
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

      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

    List statements = getStatements(node);

    if (statements != null) {
      int len = statements.size();
      for (int i = 0; i < len; ++i) {
        ASTNode nde = (ASTNode) statements.get(i);

        extendStatement(nde, content);
        extendStatements(nde, content);
      }
    }
View Full Code Here

    if (statements == null) {
      return;
    }
    Iterator i = statements.iterator();
    while (i.hasNext()) {
      ASTNode n = (ASTNode) i.next();
      if (n.equals(node)) {
        elements.add(n);
        return;
      }
      if (n.sourceStart() <= node.sourceStart() && node.sourceEnd() <= n.sourceEnd()) {
        elements.add(n);
        findElementsTo(RutaASTUtil.getStatements(n), node, elements);
        return;
      }
    }
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

      } catch (CoreException e) {
        RutaIdeCorePlugin.error(e);
      }
    }

    ASTNode node;
    if (parsed != null) {
      try {
        RutaReferenceVisitor referenceVisitor = new RutaReferenceVisitor(actualCompletionPosition);
        parsed.traverse(referenceVisitor);
        node = referenceVisitor.getResult();
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.