已经完成While、Continue、Break指令的调试

This commit is contained in:
zengwenjie
2025-10-16 14:44:30 +08:00
parent fb3db24b90
commit 2efc34846c
2 changed files with 27 additions and 12 deletions

View File

@@ -29,6 +29,18 @@ ifth true 4 3 <
else else
letp result 80 letp result 80
endi endi
letp var1 1
letp var2 1
whil false @var1 10 <
math var1 @var1 ++
ifth false @var2 4 !=
math var2 @var2 ++
cont
var var3 xxx
else
brea
endi
endw
"; ";
Todo todo = new Todo(); Todo todo = new Todo();
todo.Init(script); todo.Init(script);

View File

@@ -291,7 +291,7 @@ namespace Deedy.Testing
string cmd = Pre_Hand(this.Script[index]); string cmd = Pre_Hand(this.Script[index]);
if (cmd == "endw") if (cmd == "endw")
{ {
this.Control_CurrentLine = index; this.Control_CurrentLine = index + 1;
return; return;
} }
} }
@@ -308,7 +308,7 @@ namespace Deedy.Testing
string cmd = Pre_Hand(this.Script[index]); string cmd = Pre_Hand(this.Script[index]);
if (cmd == "whil") if (cmd == "whil")
{ {
this.Control_CurrentLine = index + 1; this.Control_CurrentLine = index;
return; return;
} }
} }
@@ -378,9 +378,12 @@ namespace Deedy.Testing
{ {
string cmdArgs = this.Script[index][cmd.Length..].Trim(); string cmdArgs = this.Script[index][cmd.Length..].Trim();
if (this.CmdP_Cond(cmdArgs)) if (this.CmdP_Cond(cmdArgs))
{
this.Control_CurrentLine = index + 1; this.Control_CurrentLine = index + 1;
return; return;
} }
else break;
}
else if (cmd == "letp") else if (cmd == "letp")
{ {
//HACK清除方法定义中使用「LetP」声明的所有局部变量 //HACK清除方法定义中使用「LetP」声明的所有局部变量
@@ -807,7 +810,7 @@ namespace Deedy.Testing
if (Pre_Math(numStack, 1)) if (Pre_Math(numStack, 1))
{ {
double lParam = numStack.Pop(); double lParam = numStack.Pop();
numStack.Push(lParam++); numStack.Push(++lParam);
} }
} }
/// <summary> /// <summary>
@@ -818,7 +821,7 @@ namespace Deedy.Testing
if (Pre_Math(numStack, 1)) if (Pre_Math(numStack, 1))
{ {
double lParam = numStack.Pop(); double lParam = numStack.Pop();
numStack.Push(lParam--); numStack.Push(--lParam);
} }
} }
/// <summary> /// <summary>