已经完成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

@@ -16,19 +16,31 @@ namespace Deedy
@"
VarP var1 111
VarP var2 222
Func Add var1x var2x
LetP AddResult -1
math AddResult @var1x 777 + @var2 - @var2x -
retu AddResult
Func Add var1x var2x
LetP AddResult -1
math AddResult @var1x 777 + @var2 - @var2x -
retu AddResult
EndF
//调用自定义方法
Call Add @var1 99
PopV result
ifth true 4 3 <
letp result 248
letp result 248
else
letp result 80
letp result 80
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.Init(script);

View File

@@ -291,7 +291,7 @@ namespace Deedy.Testing
string cmd = Pre_Hand(this.Script[index]);
if (cmd == "endw")
{
this.Control_CurrentLine = index;
this.Control_CurrentLine = index + 1;
return;
}
}
@@ -308,7 +308,7 @@ namespace Deedy.Testing
string cmd = Pre_Hand(this.Script[index]);
if (cmd == "whil")
{
this.Control_CurrentLine = index + 1;
this.Control_CurrentLine = index;
return;
}
}
@@ -378,8 +378,11 @@ namespace Deedy.Testing
{
string cmdArgs = this.Script[index][cmd.Length..].Trim();
if (this.CmdP_Cond(cmdArgs))
{
this.Control_CurrentLine = index + 1;
return;
return;
}
else break;
}
else if (cmd == "letp")
{
@@ -807,7 +810,7 @@ namespace Deedy.Testing
if (Pre_Math(numStack, 1))
{
double lParam = numStack.Pop();
numStack.Push(lParam++);
numStack.Push(++lParam);
}
}
/// <summary>
@@ -818,7 +821,7 @@ namespace Deedy.Testing
if (Pre_Math(numStack, 1))
{
double lParam = numStack.Pop();
numStack.Push(lParam--);
numStack.Push(--lParam);
}
}
/// <summary>
@@ -909,7 +912,7 @@ namespace Deedy.Testing
int index = 1;
while (index < conParts.Length)
{
{
switch (conParts[index])
{
case "!": this.Cond_Nega(stack); break;