Package uk.co.badgersinfoil.metaas.impl.antlr

Examples of uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTree


    ext.appendToken(TokenBuilder.newSpace());
    ext.addChildWithTokens(iface);
  }

  public void removeSuperInterface(String interfaceName) {
    LinkedListTree impls = ASTUtils.findChildByType(ast, AS3Parser.EXTENDS);
    int count = 0;
    for (ASTIterator i=new ASTIterator(impls); i.hasNext(); ) {
      LinkedListTree iface = i.next();
      String name = ASTUtils.identText(iface);
      if (name.equals(interfaceName)) {
        if (i.hasNext()) {
          ASTUtils.removeTrailingWhitespaceAndComma(iface.getStopToken());
        } else if (count == 0) {
          // no interfaces left, so remove the
          // 'implements' clause completely,
          ast.deleteChild(ast.getIndexOfChild(impls));
          break;
View Full Code Here


  public Expression getIterated() {
    return ExpressionBuilder.build(iterated());
  }

  public void setVar(String expr) {
    LinkedListTree var = AS3FragmentParser.parseForInVar(expr);
    ast.setChildWithTokens(INDEX_VAR, var);
  }
View Full Code Here

    LinkedListToken targetNext;
    if (index == 0) {
      target = findOpen(tree);
      targetNext = target.getNext();
    } else {
      LinkedListTree prev = (LinkedListTree)tree.getChild(index - 1);
      target = prev.getStopToken();
      targetNext = target.getNext();
    }
    insertAfter(target, targetNext,
                child.getStartToken(), child.getStopToken());
  }
View Full Code Here

    LinkedListToken targetNext;
    if (index == 0) {
      target = findOpen(parent);
      targetNext = target.getNext();
    } else {
      LinkedListTree beforeChild = (LinkedListTree)parent.getChild(index);
      targetNext = beforeChild.getStartToken();
      target = targetNext.getPrev();
    }
    insertAfter(target, targetNext,
                append, append);
  }
View Full Code Here

      setInitAST(ast(expr));
    }
  }

  private void setInitAST(LinkedListTree exp) {
    LinkedListTree decl = findDecl();
    LinkedListTree init = ASTUtils.findChildByType(decl, AS3Parser.ASSIGN);
    if (init == null) {
      init = ASTUtils.newAST(AS3Parser.ASSIGN, "=");
      decl.addChildWithTokens(init);
    } else {
      init.deleteChild(0);
    }
    init.addChildWithTokens(exp);
  }
View Full Code Here

    }
    init.addChildWithTokens(exp);
  }

  private void removeInitializer() {
    LinkedListTree decl = findDecl();
    ASTIterator i = new ASTIterator(decl);
    if (i.search(AS3Parser.ASSIGN) != null) {
      i.remove();
    }
  }
View Full Code Here

      i.remove();
    }
  }

  public Expression getInitializer() {
    LinkedListTree decl = findDecl();
    LinkedListTree init = ASTUtils.findChildByType(decl, AS3Parser.ASSIGN);
    if (init == null) {
      return null;
    }
    return ExpressionBuilder.build(init.getFirstChild());
  }
View Full Code Here

    }
    ast.setChildWithTokens(INDEX_DEF, ASTUtils.newAST(node));
  }

  public String getType() {
    LinkedListTree decl = findDecl();
    LinkedListTree typeSpec = decl.getFirstChild();
    if (typeSpec == null) return null;
    return ASTUtils.typeSpecText(typeSpec);
  }
View Full Code Here

  private LinkedListTree findDecl() {
    return (LinkedListTree)ast.getChild(INDEX_DECL);
  }

  public void setType(String typeName) {
    LinkedListTree decl = findDecl();
    LinkedListTree typeSpec = decl.getFirstChild();
    if (typeSpec == null) {
      if (typeName != null) {
        decl.addChildWithTokens(AS3FragmentParser.parseTypeSpec(typeName));
      }
    } else {
View Full Code Here

  private LinkedListTree findModifiers() {
    return ASTUtils.findChildByType(ast, AS3Parser.MODIFIERS);
  }
 
  public String getSuperclass() {
    LinkedListTree ext = ASTUtils.findChildByType(ast, AS3Parser.EXTENDS);
    if (ext == null) return null;
    return ASTUtils.identText(ext.getFirstChild());
  }
View Full Code Here

TOP

Related Classes of uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTree

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.