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

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


  public ASPrefixExpression newNotExpression(Expression sub) {
    return newPrefixExpression(TokenBuilder.newNot(), sub);
  }

  private ASPostfixExpression newPostfixExpression(LinkedListToken op, Expression sub) {
    LinkedListTree ast = ASTUtils.newAST(op);
    LinkedListTree subExpr = ast(sub);
    ASTBuilder.assertNoParent("sub-expression", subExpr);
    ast.addChild(subExpr);
    ast.setStartToken(subExpr.getStartToken());
    subExpr.getStopToken().setNext(op);
    return new ASTASPostfixExpression(ast);
  }
View Full Code Here


  public ASPostfixExpression newPostIncExpression(Expression sub) {
    return newPostfixExpression(TokenBuilder.newPostInc(), sub);
  }

  public ASNewExpression newNewExpression(Expression subexpression, List args) {
    LinkedListTree ast = ASTUtils.newAST(AS3Parser.NEW, "new");
    ast.appendToken(TokenBuilder.newSpace());
    LinkedListTree subExpr = ast(subexpression);
    ASTBuilder.assertNoParent("sub-expression", subExpr);
    // TODO: recursively check the given subexpression
    ast.addChildWithTokens(subExpr);
    LinkedListTree arguments = ASTUtils.newParentheticAST(AS3Parser.ARGUMENTS, AS3Parser.LPAREN, "(", AS3Parser.RPAREN, ")");
    ast.addChildWithTokens(arguments);
    ASTASNewExpression result = new ASTASNewExpression(ast);
    result.setArguments(args);
    return result;
  }
View Full Code Here

    result.setArguments(args);
    return result;
  }

  public ASInvocationExpression newInvocationExpression(Expression sub, List args) {
    LinkedListTree ast = ASTUtils.newImaginaryAST(AS3Parser.METHOD_CALL);
    LinkedListTree subExpr = ast(sub);
    ASTBuilder.assertNoParent("sub-expression", subExpr);
    // TODO: recursively check the given subexpression
    ast.addChildWithTokens(subExpr);
    LinkedListTree arguments = ASTUtils.newParentheticAST(AS3Parser.ARGUMENTS, AS3Parser.LPAREN, "(", AS3Parser.RPAREN, ")");
    ast.addChildWithTokens(arguments);
    ASTASInvocationExpression result = new ASTASInvocationExpression(ast);
    result.setArguments(args);
    return result;
  }
View Full Code Here

  }

  public ASArrayAccessExpression newArrayAccessExpression(Expression target,
                                                          Expression subscript)
  {
    LinkedListTree ast = ASTUtils.newImaginaryAST(AS3Parser.ARRAY_ACC);
    LinkedListTree targetExpr = ast(target);
    ASTBuilder.assertNoParent("target expression", targetExpr);
    // TODO: recursively check the given subexpression
    ast.addChildWithTokens(targetExpr);
    ast.appendToken(TokenBuilder.newLBrack());
    LinkedListTree subscriptExpr = ast(subscript);
    ASTBuilder.assertNoParent("subscript expression", subscriptExpr);
    ast.addChildWithTokens(subscriptExpr);
    ast.appendToken(TokenBuilder.newRBrack());
    ASTASArrayAccessExpression result = new ASTASArrayAccessExpression(ast);
    return result;
View Full Code Here

    return ASTBuilder.newAssignExpression(TokenBuilder.newSubAssign(),
                                          left, right);
  }

  public ASFieldAccessExpression newFieldAccessExpression(Expression target, String name) {
    LinkedListTree ast
      = ASTBuilder.newFieldAccessExpression(ast(target),
                                                  ASTUtils.newAST(AS3Parser.IDENT, name));
    return new ASTASFieldAccessExpression(ast);
  }
View Full Code Here

  public ASConditionalExpression newConditionalExpression(Expression conditionExpr,
                                                          Expression thenExpr,
                                                          Expression elseExpr)
  {
    LinkedListTree ast
      = ASTBuilder.newConditionalExpression(ast(conditionExpr),
                                                  ast(thenExpr),
                                                  ast(elseExpr));
    return new ASTASConditionalExpression(ast);
  }
View Full Code Here

  private static LinkedListTree ast(Expression expr) {
    return ASTUtils.ast(expr);
  }

  public ASFunctionExpression newFunctionExpression() {
    LinkedListTree ast = ASTBuilder.newFunctionExpression();
    return new ASTASFunctionExpression(ast);
  }
View Full Code Here

    super(ast);
  }

  public List getSuperInterfaces() {
    List results = new LinkedList();
    LinkedListTree impls = ASTUtils.findChildByType(ast, AS3Parser.EXTENDS);
    if (impls != null) {
      for (ASTIterator i=new ASTIterator(impls); i.hasNext(); ) {
        results.add(ASTUtils.identText(i.next()));
      }
    }
View Full Code Here

  /**
   * @param entries a list of {@link Expression} objects.
   */
  public ASArrayLiteral newArrayLiteral() {
    LinkedListTree ast = ASTBuilder.newArrayLiteral();
    return new ASTASArrayLiteral(ast);
  }
View Full Code Here

    }
    return Collections.unmodifiableList(results);
  }

  public void addSuperInterface(String interfaceName) {
    LinkedListTree iface = AS3FragmentParser.parseIdent(interfaceName);
    LinkedListTree ext = ASTUtils.findChildByType(ast, AS3Parser.EXTENDS);
    if (ext == null) {
      ext = ASTUtils.newAST(AS3Parser.EXTENDS, "extends");
      ext.appendToken(TokenBuilder.newSpace());
      // hack a space in at the right point,
      LinkedListToken sp = TokenBuilder.newSpace();
      ext.getStartToken().beforeInsert(sp);
      ext.setStartToken(sp);
      ast.addChildWithTokens(EXTENDS_INDEX, ext);
    } else {
      ext.appendToken(TokenBuilder.newComma());
    }
    ext.appendToken(TokenBuilder.newSpace());
    ext.addChildWithTokens(iface);
  }
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.