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