Ejemplo n.º 1
0
  public String getStringValue(int level) {

    String prefix = isStatement ? CodeUtil.getIndent(level) : "";

    switch (type) {
      case TYPE_NULL:
        return "null";
      case TYPE_STRING:
        return prefix + formatString(string);
      case TYPE_FLOAT:
        return prefix + Float.valueOf(getFloat()).toString();
      case TYPE_REGISTER:
        return prefix + "r:" + getRegisterNumber();
      case TYPE_BOOLEAN:
        return prefix + (getBoolean() ? "true" : "false");
      case TYPE_DOUBLE:
        return prefix + ((getDouble() == 0) ? "0" : Double.valueOf(getDouble()).toString());
      case TYPE_INTEGER:
        return prefix + Long.valueOf(getInteger()).toString();
      case TYPE_UNDEFINED:
        return prefix + "undefined";
      case TYPE_CONSTANT_8:
      case TYPE_CONSTANT_16:
      default:
        return prefix + toString();
    }
  }
Ejemplo n.º 2
0
 public String getStringValue(int level) {
   String prefix = isStatement ? CodeUtil.getIndent(level) : "";
   if (TYPE_BOOLEAN == stackValue.getType()) {
     return prefix + (stackValue.getBoolean() ? "false" : "true");
   } else {
     return prefix + "!" + getStringValue(level);
   }
 }
 protected List<Operation> executeWithSameStack(
     ExecutionContext context, List<Action> actions, Operation parentOperation)
     throws StatementBlockException {
   StatementBlock block = CodeUtil.getStatementBlockReader();
   context.getOperationStack().push(parentOperation); // save parent operation in operation stack
   block.setExecutionContext(context);
   block.read(actions);
   context.getOperationStack().pop(); // restore operation stack
   return block.getOperations();
 }
 public String getStringValue(int level) {
   return new StringBuffer()
       .append(CodeUtil.getIndent(level))
       .append("duplicateMovieClip(")
       .append(source.getStringValue(level))
       .append(",")
       .append(target.getStringValue(level))
       .append(",")
       .append(depth.getStringValue(level))
       .append(")")
       .toString();
 }
  protected BlockExecutionResult executeWithCopiedStack(
      ExecutionContext context, List<Action> actions, Operation parentOperation)
      throws StatementBlockException {
    StatementBlock block = CodeUtil.getStatementBlockReader();
    context.getOperationStack().push(parentOperation); // save parent operation in operation stack
    Stack<Operation> currentExecutionStack = context.getExecStack(); // save current execution stack
    context.setExecStack(copyExecutionStack(currentExecutionStack)); // set a copy of current stack

    block.setExecutionContext(context);
    block.read(actions);
    BlockExecutionResult blockExecutionResult =
        new BlockExecutionResult(block.getOperations(), context.getExecStack());

    context.setExecStack(currentExecutionStack); // restore previous execution stack
    context.getOperationStack().pop(); // restore operation stack
    return blockExecutionResult;
  }
Ejemplo n.º 6
0
  public String getStringValue(int level) {
    String val = op.getStringValue(0); // pass 0 as val shouldn't be indented

    return CodeUtil.getIndent(level) + /*"var "+*/ "__R" + registerNumber + " = " + val;
  }
Ejemplo n.º 7
0
 public String getStringValue(int level) {
   return CodeUtil.getIndent(level) + action + "(" + (gotoFrame.getFrame() + 1) + ")";
 }
 public AbstractCompoundOperation(ExecutionContext context) {
   super(context.getExecStack());
   this.context = context;
   this.statementBlock = CodeUtil.getStatementBlockReader();
 }