mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 09:06:23 +02:00
Add YesNt interpreter process and command integration
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using RemSox.Processing;
|
||||
using YesNt.Interpreter.Runtime;
|
||||
using YesNt.Interpreter.Utilities;
|
||||
|
||||
namespace RemSox.Processes
|
||||
{
|
||||
public class YesNtInterpreterProcess() : Process("YesNtInterpreter")
|
||||
{
|
||||
YesNtInterpreter interpreter = null!;
|
||||
|
||||
internal override void Start(string[] args)
|
||||
{
|
||||
interpreter = new();
|
||||
interpreter.AddStatement(new StatementInformation("%test", YesNt.Interpreter.Enums.SearchMode.Contains, YesNt.Interpreter.Enums.SpaceAround.None) { KeepStatementInArgs = true, Priority = YesNt.Interpreter.Enums.Priority.PreProcessing }, (args, context) =>
|
||||
{
|
||||
context.CurrentLine = TemplateProcessor.ProcessSimplePlaceholders(args, "%test", "Test successful!");
|
||||
});
|
||||
interpreter.Prepare([.. args]);
|
||||
}
|
||||
|
||||
internal override void Tick()
|
||||
{
|
||||
if (interpreter.IsRunning)
|
||||
{
|
||||
interpreter.Step();
|
||||
}
|
||||
else
|
||||
{
|
||||
RequestStop();
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Stop()
|
||||
{
|
||||
interpreter.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user