Пример #1
0
 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;
 }
Пример #2
0
 /**
  * @param argumentNode the ARGUMENTS AST node
  * @param args list of ASExpression objects to be used as the new argument list
  */
 public static void overwriteArgsWithExpressionList(LinkedListTree argumentNode, List args) {
   // get rid of any old arguments,
   ASTUtils.deleteAllChildren(argumentNode);
   // add the new arguments,
   for (Iterator i = args.iterator(); i.hasNext(); ) {
     ASTExpression arg = (ASTExpression) i.next();
     argumentNode.addChildWithTokens(arg.getAST());
     if (i.hasNext()) {
       argumentNode.appendToken(TokenBuilder.newComma());
       argumentNode.appendToken(TokenBuilder.newSpace());
     }
   }
 }
Пример #3
0
 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;
 }