Add YesNt interpreter process and command integration

This commit is contained in:
Stone_Red
2026-06-11 20:44:49 +02:00
parent 160d0559e8
commit cda4dcf097
4 changed files with 68 additions and 12 deletions
+2 -2
View File
@@ -4,7 +4,6 @@ using RemSox.Processes;
using RemSox.Processing;
using RemSox.UI.CLI;
using RemSox.UI.CLI.Commands;
using System.Runtime;
namespace RemSox;
@@ -26,7 +25,8 @@ public class Kernel : Sys.Kernel
new StopProcessCommand(),
new StartGuiCommand(),
new StopGuiCommand(),
new ViewProcessLogs()
new ViewProcessLogs(),
new YesNtCommand()
]);
Sys.Graphics.Canvas canvas = Sys.Graphics.FullScreenCanvas.GetFullScreenCanvas();
+42
View File
@@ -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();
}
}
}
+3 -10
View File
@@ -9,13 +9,10 @@
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" />
<PackageReference Include="Cosmos.Kernel" Version="3.0.58" />
<PackageReference Include="Cosmos.Kernel.System" Version="3.0.58" />
<PackageReference Include="YesNt.Interpreter" Version="1.1.0" />
</ItemGroup>
<UsingTask
TaskName="PatchInteropSysSecureRandomTask"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll"
>
<UsingTask TaskName="PatchInteropSysSecureRandomTask" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<CoreLibPath ParameterType="System.String" Required="true" />
</ParameterGroup>
@@ -72,11 +69,7 @@
</Task>
</UsingTask>
<Target
Name="PatchInteropSysSecureRandom"
AfterTargets="RunPatcher"
BeforeTargets="WriteIlcRsp;CompileWithIlc"
>
<Target Name="PatchInteropSysSecureRandom" AfterTargets="RunPatcher" BeforeTargets="WriteIlcRsp;CompileWithIlc">
<PatchInteropSysSecureRandomTask CoreLibPath="$(IntermediateOutputPath)cosmos\ref\System.Private.CoreLib.dll" />
</Target>
</Project>
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using RemSox.Processing;
namespace RemSox.UI.CLI.Commands
{
public class YesNtCommand : ICommand
{
public string Name => "yesnt";
public string Description => "Start the YesNt interpreter";
public async Task ExecuteAsync(string? arguments, Action<string> printLine)
{
int processId = ProcessManager.SpawnProcess<Processes.YesNtInterpreterProcess>(arguments?.Split(',') ?? []);
await ProcessManager.WaitForProcessExitAsync(processId);
}
}
}