private void PauseButton_Click(object sender, RoutedEventArgs e) { _interpreter.Pause(); PauseButton.Visibility = Visibility.Collapsed; NextStepButton.Visibility = Visibility.Visible; ResumeButton.Visibility = Visibility.Visible; }
private void RunStatement(Code.AbstractSyntaxTree.Statement statement) { if (BaZicInterpreter.Verbose) { VerboseLog(L.BaZic.Runtime.Interpreters.BlockInterpreter.FormattedExecutingStatement(statement.GetType().Name)); } switch (statement) { case AssignStatement assign: new AssignInterpreter(BaZicInterpreter, this, ExecutionFlowId, assign).Run(); break; case BreakStatement @break: new BreakInterpreter(BaZicInterpreter, this, ExecutionFlowId, @break).Run(); break; case CommentStatement comment: // Just ignore break; case ConditionStatement condition: var conditionInterpreter = new ConditionInterpreter(BaZicInterpreter, this, ExecutionFlowId, condition); conditionInterpreter.Run(); ApplyChildBlockState(conditionInterpreter.ChildBlockState); break; case GoToLabelStatement goToLabel: JumpToLabel(goToLabel.Name.Identifier); break; case IterationStatement iteration: var iterationInterpreter = new IterationInterpreter(BaZicInterpreter, this, ExecutionFlowId, iteration); iterationInterpreter.Run(); ApplyChildBlockState(iterationInterpreter.ChildBlockState); break; case LabelConditionStatement labelCondition: var labelConditionInterpreter = new LabelConditionInterpreter(BaZicInterpreter, this, ExecutionFlowId, labelCondition); labelConditionInterpreter.Run(); if (!IsAborted && labelConditionInterpreter.ConditionValidated) { JumpToLabel(labelCondition.LabelName.Identifier); } break; case LabelDeclaration labelDeclaration: // Just ignore break; case ReturnStatement @return: new ReturnInterpreter(BaZicInterpreter, this, ExecutionFlowId, @return).Run(); break; case ThrowStatement @throw: new ThrowInterpreter(BaZicInterpreter, this, ExecutionFlowId, @throw).Run(); break; case TryCatchStatement tryCatch: var tryCatchInterpreter = new TryCatchInterpreter(BaZicInterpreter, this, ExecutionFlowId, tryCatch); tryCatchInterpreter.Run(); ApplyChildBlockState(tryCatchInterpreter.ChildBlockState); break; case VariableDeclaration variableDeclaration: new VariableDeclarationInterpreter(BaZicInterpreter, this, ExecutionFlowId, variableDeclaration).Run(); break; case ExpressionStatement expressionStatement: new ExpressionStatementInterpreter(BaZicInterpreter, this, ExecutionFlowId, expressionStatement).Run(); break; case BreakpointStatement breakpoint: if (BaZicInterpreter.Verbose) { VerboseLog(L.BaZic.Runtime.Interpreters.BlockInterpreter.BreakpointIntercepted); } BaZicInterpreter.Pause(); Task.Delay(100).Wait(); break; default: BaZicInterpreter.ChangeState(this, new InternalException(L.BaZic.Runtime.Interpreters.BlockInterpreter.FormattedInterpreterNotFound(statement.GetType().FullName)), statement); break; } if (BaZicInterpreter.Verbose && (State.ExitMethod || State.ExitIteration || State.ExitBlockBecauseOfLabelJump)) { VerboseLog(L.BaZic.Runtime.Interpreters.BlockInterpreter.ExitingBlock); } }