mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-04 09:06:41 +02:00
Remove Initialize calls and add AddStatement tests
This commit is contained in:
@@ -11,7 +11,6 @@ internal static class Program
|
||||
if (args.Length == 1)
|
||||
{
|
||||
YesNtInterpreter interpreter = new YesNtInterpreter();
|
||||
interpreter.Initialize();
|
||||
interpreter.Execute(args[0]);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -60,21 +60,19 @@ public class YesNtInterpreter
|
||||
AddStatement(new StatementAttribute(name, searchMode, spaceAround, consoleColor), handler);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
public YesNtInterpreter()
|
||||
{
|
||||
runtimeInfo.Exit("Terminated by external process", true);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
statements.Clear();
|
||||
staticStatements.Clear();
|
||||
GeneratedStatementRegistry.Register(runtimeInfo, out statements, out staticStatements);
|
||||
|
||||
runtimeInfo.OnDebugOutput += (s) => OnDebugOutput?.Invoke(s);
|
||||
runtimeInfo.OnLineExecuted += (DebugEventArgs e) => OnLineExecuted?.Invoke(e);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
runtimeInfo.Exit("Terminated by external process", true);
|
||||
}
|
||||
|
||||
public void Execute(string path, bool isDebugMode = false)
|
||||
{
|
||||
runtimeInfo.Reset();
|
||||
|
||||
@@ -50,8 +50,7 @@ internal partial class ProcessingStatements : StatementRuntimeInformation
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
YesNtInterpreter interpreter = new YesNtInterpreter();
|
||||
interpreter.Initialize();
|
||||
interpreter.Execute(lines, RuntimeInfo.GlobalVariables, lineNumber, RuntimeInfo);
|
||||
interpreter.Execute(lines, RuntimeInfo.GlobalVariables, lineNumber, RuntimeInfo);
|
||||
});
|
||||
|
||||
RuntimeInfo.CurrentLine = string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user