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

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


  protected StatementContainer getStatementContainer() {
    return new ASTStatementList(ast.getFirstChild());
  }

  public ASCatchClause newCatchClause(String var, String type) {
    LinkedListTree catchClause = ASTBuilder.newCatchClause(var, type);
    LinkedListToken space = TokenBuilder.newSpace();
    catchClause.getStartToken().beforeInsert(space);
    catchClause.setStartToken(space);
    if (finallyClause() == null) {
      ast.addChildWithTokens(catchClause);
    } else {
      ast.addChildWithTokens(ast.getChildCount()-1, catchClause);
    }
View Full Code Here


  }
 
  public List getMethods() {
    List results = new LinkedList();
    for (ASTIterator i=blockIter(); i.hasNext(); ) {
      LinkedListTree member = i.next();
      if (member.getType() == AS3Parser.METHOD_DEF) {
        results.add(new ASTASMethod(member));
      }
    }
    return Collections.unmodifiableList(results);
  }
View Full Code Here

   */
  public ASMethod getMethod(String name) {
    // TODO: does AS3 do overloading?  This method will be no use
    //       if it does.
    for (ASTIterator i=blockIter(); i.hasNext(); ) {
      LinkedListTree member = i.next();
      if (member.getType() == AS3Parser.METHOD_DEF) {
        ASMethod meth = new ASTASMethod(member);
        if (meth.getName().equals(name)) {
          return meth;
        }
      }
View Full Code Here

  public void removeMethod(String name) {
    // TODO: does AS3 do overloading?  This method will be no use
    //       if it does.
    for (ASTIterator i=blockIter(); i.hasNext(); ) {
      LinkedListTree member = i.next();
      if (member.getType() == AS3Parser.METHOD_DEF) {
        ASMethod meth = new ASTASMethod(member);
        if (meth.getName().equals(name)) {
          i.remove();
          return;
        }
View Full Code Here

        return;
      }
      ast.deleteChild(0);
      return;
    }
    LinkedListTree expression = AS3FragmentParser.parseExpr(expr);
    setExpr(expression);
  }
View Full Code Here

                                  field.getType());
    return new ASTField(field);
  }

  public Field newField(String name, Expression value) {
    LinkedListTree field = ASTBuilder.newObjectField(name, ast(value));
    String indent = ASTUtils.findIndent(ast) + "\t";
    ASTUtils.increaseIndent(field, indent);
    if (ast.getChildCount() > 0) {
      ast.appendToken(TokenBuilder.newComma());
    }
View Full Code Here

  /**
   * Creates a new ActionScript block statement.  Can be supplied to an
   * {@link uk.co.badgersinfoil.metaas.dom.ASIfStatement}, for instance.
   */
  public ASBlock newBlock() {
    LinkedListTree block = ASTBuilder.newBlock();
    return new ASTStatementList(block);
  }
View Full Code Here

  public ASNullLiteral newNullLiteral() {
    return new ASTASNullLiteral(ASTUtils.newAST(AS3Parser.NULL, "null"));
  }

  public ASBooleanLiteral newBooleanLiteral(boolean b) {
    LinkedListTree ast = b ? ASTUtils.newAST(AS3Parser.TRUE, "true")
                           : ASTUtils.newAST(AS3Parser.FALSE, "false");
    return new ASTASBooleanLiteral(ast);
  }
View Full Code Here

   *
   * @throws SyntaxException if the given string is not a vaild
   *         ActionScript 3 expression.
   */
  public Expression newExpression(String expr) {
    LinkedListTree ast = AS3FragmentParser.parseExpr(expr);
    // ANTLR creates a 'nil' parent node (in case the result is a
    // list).  We break the link to that parent because we assert
    // the parent is null when child nodes are attached elsewhere
    // in the tree.
    ast.setParent(null);
    return ExpressionBuilder.build(ast);
  }
View Full Code Here

    ast.setParent(null);
    return ExpressionBuilder.build(ast);
  }

  private ASPrefixExpression newPrefixExpression(LinkedListToken op, Expression sub) {
    LinkedListTree ast = ASTUtils.newAST(op);
    LinkedListTree subExpr = ast(sub);
    ASTBuilder.assertNoParent("sub-expression", subExpr);
    ast.addChildWithTokens(subExpr);
    return new ASTASPrefixExpression(ast);
  }
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.