IMplement STOP
This commit is contained in:
@@ -2747,3 +2747,11 @@ class CallBG : Code
|
||||
callback(vm);
|
||||
}
|
||||
}
|
||||
|
||||
class Stop : Code
|
||||
{
|
||||
override void execute(VM vm)
|
||||
{
|
||||
vm.petitcomputer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1294,6 +1294,15 @@ class Compiler
|
||||
case NodeType.CallBG:
|
||||
compileCallBG(cast(otya.smilebasic.node.CallBG)i, s);
|
||||
break;
|
||||
case NodeType.StopStatement:
|
||||
{
|
||||
if (isDirectMode)
|
||||
{
|
||||
throw new CantUseFromDirectMode();
|
||||
}
|
||||
genCode(new Stop());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
stderr.writeln("Compile:NotImpl ", i.type);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,6 @@ class Console
|
||||
imEditInfo.editingText = e;
|
||||
imEditInfo.start = s;
|
||||
imEditInfo.length = l;
|
||||
writefln("%s,%s,%s", e, s, l);
|
||||
}
|
||||
|
||||
bool showCursor;
|
||||
|
||||
@@ -53,6 +53,7 @@ enum NodeType
|
||||
Linput,
|
||||
CallSprite,
|
||||
CallBG,
|
||||
StopStatement,
|
||||
}
|
||||
abstract class Node
|
||||
{
|
||||
@@ -715,3 +716,11 @@ class CallBG : Statement
|
||||
this.type = NodeType.CallBG;
|
||||
}
|
||||
}
|
||||
class StopStatement : Statement
|
||||
{
|
||||
this(SourceLocation loc)
|
||||
{
|
||||
super.location = loc;
|
||||
this.type = NodeType.StopStatement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ class Lexical
|
||||
reserved["UNTIL"] = TokenType.Until;
|
||||
reserved["SWAP"] = TokenType.Swap;
|
||||
reserved["LINPUT"] = TokenType.Linput;
|
||||
reserved["STOP"] = TokenType.Stop;
|
||||
reserved.rehash();
|
||||
}
|
||||
this(wstring input)
|
||||
@@ -1144,6 +1145,9 @@ class Parser
|
||||
return swapStatement();
|
||||
case TokenType.Linput:
|
||||
return linputStatement();
|
||||
case TokenType.Stop:
|
||||
node = new StopStatement(lex.location);
|
||||
break;
|
||||
default:
|
||||
syntaxError();
|
||||
break;
|
||||
|
||||
@@ -77,6 +77,7 @@ enum TokenType
|
||||
Dim,
|
||||
Constant,
|
||||
Linput,
|
||||
Stop,
|
||||
}
|
||||
|
||||
enum TokenValueType
|
||||
|
||||
Reference in New Issue
Block a user