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 StoreRegisterOperation(ExecutionContext context, StoreRegister action) {
    super(context.getExecStack().peek());
    this.registerNumber = action.getNumber();

    logger.debug("Register number = " + this.registerNumber);
    logger.debug("Adding register " + this.registerNumber + " = " + op);
    this.registerHandle = new RegisterHandle(this.registerNumber, op, this);
    context.getRegisters().set(this.registerNumber, this.registerHandle);
    String regInfo = "REGS:";
    int i = 1;
    for (Operation op : context.getRegisters()) {
      regInfo += (i++) + "=>" + op + ",";
    }
    logger.debug(regInfo);

    handleIncrementDecrement();

    // If operation under Enumerate/Enumerate2 and NullStackValue is assigned to register,
    // set this RegisterHandle as variable in for..in statement and skip this statement.
    if (!context.getOperationStack().isEmpty()
        && (context.getOperationStack().peek() instanceof ForInOperation)
        && op instanceof NullStackValue) {

      ((ForInOperation) context.getOperationStack().peek()).setVariable(registerHandle);
      //			((ForInOperation)context.getOperationStack().peek()).setVariable(op);
      skipOperation = true;
    }
  }
  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;
  }
 public int getPrintOffset() {
   return (context.getActionStack() != null) ? context.getActionStack().size() : 0;
 }
 public AbstractCompoundOperation(ExecutionContext context) {
   super(context.getExecStack());
   this.context = context;
   this.statementBlock = CodeUtil.getStatementBlockReader();
 }