diff --git a/YesNt.CodeEditor/YesNt.CodeEditor.csproj b/YesNt.CodeEditor/YesNt.CodeEditor.csproj
index 5b45dec..3282c31 100644
--- a/YesNt.CodeEditor/YesNt.CodeEditor.csproj
+++ b/YesNt.CodeEditor/YesNt.CodeEditor.csproj
@@ -2,8 +2,10 @@
Exe
- net8.0
+ net10.0
AnyCPU;x64
+ True
+ yesntcode
@@ -11,7 +13,7 @@
-
+
diff --git a/YesNt.Interpreter.App/YesNt.Interpreter.App.csproj b/YesNt.Interpreter.App/YesNt.Interpreter.App.csproj
index 018aab7..22c4adc 100644
--- a/YesNt.Interpreter.App/YesNt.Interpreter.App.csproj
+++ b/YesNt.Interpreter.App/YesNt.Interpreter.App.csproj
@@ -1,9 +1,11 @@
- net8.0
+ net10.0
Exe
AnyCPU;x64
+ True
+ yesnt
diff --git a/YesNt.Interpreter.Generator/StatementRegistryGenerator.cs b/YesNt.Interpreter.Generator/StatementRegistryGenerator.cs
index 8d296be..242902d 100644
--- a/YesNt.Interpreter.Generator/StatementRegistryGenerator.cs
+++ b/YesNt.Interpreter.Generator/StatementRegistryGenerator.cs
@@ -8,19 +8,20 @@ using System.Text;
namespace YesNt.Interpreter.Generator;
[Generator]
-public sealed class StatementRegistryGenerator : ISourceGenerator
+public sealed class StatementRegistryGenerator : IIncrementalGenerator
{
private const string StatementAttributeName = "YesNt.Interpreter.Attributes.StatementAttribute";
private const string StaticStatementAttributeName = "YesNt.Interpreter.Attributes.StaticStatementAttribute";
- public void Initialize(GeneratorInitializationContext context)
+ public void Initialize(IncrementalGeneratorInitializationContext context)
{
+ context.RegisterSourceOutput(
+ context.CompilationProvider,
+ Execute);
}
- public void Execute(GeneratorExecutionContext context)
+ private static void Execute(SourceProductionContext context, Compilation compilation)
{
- Compilation compilation = context.Compilation;
-
List statementMethods = [];
List staticStatementMethods = [];
diff --git a/YesNt.Interpreter.Generator/YesNt.Interpreter.Generator.csproj b/YesNt.Interpreter.Generator/YesNt.Interpreter.Generator.csproj
index 4be3731..8a70f90 100644
--- a/YesNt.Interpreter.Generator/YesNt.Interpreter.Generator.csproj
+++ b/YesNt.Interpreter.Generator/YesNt.Interpreter.Generator.csproj
@@ -1,6 +1,6 @@
- netstandard2.0
+ netstandard2.1
latest
enable
true
@@ -8,6 +8,6 @@
-
+
diff --git a/YesNt.Interpreter.Tests/AddStatementTests.cs b/YesNt.Interpreter.Tests/AddStatementTests.cs
index bbfe7d6..5add554 100644
--- a/YesNt.Interpreter.Tests/AddStatementTests.cs
+++ b/YesNt.Interpreter.Tests/AddStatementTests.cs
@@ -4,7 +4,6 @@ using System.Collections.Generic;
using YesNt.Interpreter.Attributes;
using YesNt.Interpreter.Enums;
-using YesNt.Interpreter.Runtime;
namespace YesNt.Interpreter.Tests;
@@ -21,7 +20,7 @@ public class AddStatementTests
string? capturedArgs = null;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
interpreter.AddStatement("my_command", SearchMode.StartOfLine, SpaceAround.End, args =>
{
@@ -42,7 +41,7 @@ public class AddStatementTests
bool handlerCalled = false;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
interpreter.AddStatement("custom_cmd", SearchMode.StartOfLine, SpaceAround.End, _ =>
{
@@ -63,9 +62,9 @@ public class AddStatementTests
bool handlerCalled = false;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
- var attr = new StatementAttribute("attr_cmd", SearchMode.StartOfLine, SpaceAround.End);
+ StatementAttribute attr = new StatementAttribute("attr_cmd", SearchMode.StartOfLine, SpaceAround.End);
interpreter.AddStatement(attr, _ =>
{
handlerCalled = true;
@@ -85,7 +84,7 @@ public class AddStatementTests
bool handlerCalled = false;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
interpreter.AddStatement("exact_cmd", SearchMode.Exact, SpaceAround.None, _ =>
{
@@ -106,7 +105,7 @@ public class AddStatementTests
bool handlerCalled = false;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
interpreter.AddStatement(" ~mark~ ", SearchMode.Contains, SpaceAround.None, _ =>
{
@@ -127,7 +126,7 @@ public class AddStatementTests
bool handlerCalled = false;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
interpreter.AddStatement(" !end", SearchMode.EndOfLine, SpaceAround.None, _ =>
{
@@ -148,7 +147,7 @@ public class AddStatementTests
string? capturedArgs = null;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
interpreter.AddStatement("capture_cmd", SearchMode.StartOfLine, SpaceAround.End, args =>
{
@@ -279,7 +278,7 @@ public class AddStatementTests
int highPriorityOrder = -1;
int normalPriorityOrder = -1;
- YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
+ _ = YesNtAssert.GetLastLineWithSetup(lines, interpreter =>
{
interpreter.AddStatement(
new StatementAttribute("priority_cmd", SearchMode.StartOfLine, SpaceAround.End) { Priority = Priority.High },
diff --git a/YesNt.Interpreter.Tests/CodeFlowTests.cs b/YesNt.Interpreter.Tests/CodeFlowTests.cs
index ff52902..663de90 100644
--- a/YesNt.Interpreter.Tests/CodeFlowTests.cs
+++ b/YesNt.Interpreter.Tests/CodeFlowTests.cs
@@ -217,7 +217,6 @@ public class CodeFlowTests
YesNtAssert.IsLastLineEqual(lines, "yes");
}
-
[TestMethod]
public void LabelWithoutColonFailsTest()
{
diff --git a/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs b/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs
index 1f9d6cd..6c9fed9 100644
--- a/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs
+++ b/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs
@@ -46,7 +46,7 @@ public class ConsoleStatementsTests
"clear"
];
- _ = Assert.ThrowsException(() => YesNtAssert.GetLastLine(lines));
+ _ = Assert.Throws(() => YesNtAssert.GetLastLine(lines));
}
[TestMethod]
@@ -80,7 +80,7 @@ public class ConsoleStatementsTests
{
YesNtInterpreter interpreter = new YesNtInterpreter();
- AutoResetEvent onDone= new AutoResetEvent(false);
+ AutoResetEvent onDone = new AutoResetEvent(false);
StringBuilder output = new StringBuilder();
interpreter.OnDebugOutput += (s) => _ = output.Append(s);
diff --git a/YesNt.Interpreter.Tests/FunctionStatementsTests.cs b/YesNt.Interpreter.Tests/FunctionStatementsTests.cs
index 134b6e3..65011bf 100644
--- a/YesNt.Interpreter.Tests/FunctionStatementsTests.cs
+++ b/YesNt.Interpreter.Tests/FunctionStatementsTests.cs
@@ -150,7 +150,6 @@ public class FunctionStatementsTests
YesNtAssert.IsLastLineEqual(lines, "outer");
}
-
[TestMethod]
public void ClearCallStackRunsTest()
{
diff --git a/YesNt.Interpreter.Tests/ProcessingStatementsTests.cs b/YesNt.Interpreter.Tests/ProcessingStatementsTests.cs
index c845d2c..d4062a0 100644
--- a/YesNt.Interpreter.Tests/ProcessingStatementsTests.cs
+++ b/YesNt.Interpreter.Tests/ProcessingStatementsTests.cs
@@ -88,7 +88,6 @@ public class ProcessingStatementsTests
YesNtAssert.IsLastLineEqual(lines, "ok");
}
-
[TestMethod]
public void SleepInvalidValueFailsTest()
{
diff --git a/YesNt.Interpreter.Tests/VariableStatementsTests.cs b/YesNt.Interpreter.Tests/VariableStatementsTests.cs
index 9bf890b..5df7d8a 100644
--- a/YesNt.Interpreter.Tests/VariableStatementsTests.cs
+++ b/YesNt.Interpreter.Tests/VariableStatementsTests.cs
@@ -118,7 +118,6 @@ public class VariableStatementsTests
YesNtAssert.IsLastLineEqual(lines, "0");
}
-
[TestMethod]
public void MissingVariableReferenceFailsTest()
{
diff --git a/YesNt.Interpreter.Tests/YesNt.Interpreter.Tests.csproj b/YesNt.Interpreter.Tests/YesNt.Interpreter.Tests.csproj
index 3090b90..592c72d 100644
--- a/YesNt.Interpreter.Tests/YesNt.Interpreter.Tests.csproj
+++ b/YesNt.Interpreter.Tests/YesNt.Interpreter.Tests.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
enable
false
@@ -10,10 +10,13 @@
-
-
-
-
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/YesNt.Interpreter/Runtime/ExitMessages.cs b/YesNt.Interpreter/Runtime/ExitMessages.cs
index 4d08b09..74b1dea 100644
--- a/YesNt.Interpreter/Runtime/ExitMessages.cs
+++ b/YesNt.Interpreter/Runtime/ExitMessages.cs
@@ -26,15 +26,58 @@ internal static class ExitMessages
internal const string NoInArgumentInStack = "No in argument in stack";
internal const string NoFunctionInStack = "No function in stack";
- internal static string LabelNotFound(string label) => $"Label \"{label}\" not found";
- internal static string FunctionNotFound(string function) => $"Function \"{function}\" not found";
- internal static string VariableNotFound(string variable) => $"Variable \"{variable}\" not found";
- internal static string ListNotFound(string list) => $"List \"{list}\" not found";
- internal static string InvalidIndex(string rawIndex) => $"\"{rawIndex}\" is not a valid index";
- internal static string IndexOutOfRange(int index) => $"Index {index} out of range";
- internal static string InvalidTimeoutValue(string value) => $"\"{value}\" is not a valid time-out value";
- internal static string CouldNotLoadFile(string path) => $"Could not load file \"{path}\"";
- internal static string CouldNotFindFile(string path) => $"Could not find file \"{path}\"";
- internal static string CannotFindFile(string path) => $"Cannot find file \"{path}\".";
- internal static string FailedToStart(string program, string message) => $"Failed to start \"{program}\". {message}";
+ internal static string LabelNotFound(string label)
+ {
+ return $"Label \"{label}\" not found";
+ }
+
+ internal static string FunctionNotFound(string function)
+ {
+ return $"Function \"{function}\" not found";
+ }
+
+ internal static string VariableNotFound(string variable)
+ {
+ return $"Variable \"{variable}\" not found";
+ }
+
+ internal static string ListNotFound(string list)
+ {
+ return $"List \"{list}\" not found";
+ }
+
+ internal static string InvalidIndex(string rawIndex)
+ {
+ return $"\"{rawIndex}\" is not a valid index";
+ }
+
+ internal static string IndexOutOfRange(int index)
+ {
+ return $"Index {index} out of range";
+ }
+
+ internal static string InvalidTimeoutValue(string value)
+ {
+ return $"\"{value}\" is not a valid time-out value";
+ }
+
+ internal static string CouldNotLoadFile(string path)
+ {
+ return $"Could not load file \"{path}\"";
+ }
+
+ internal static string CouldNotFindFile(string path)
+ {
+ return $"Could not find file \"{path}\"";
+ }
+
+ internal static string CannotFindFile(string path)
+ {
+ return $"Cannot find file \"{path}\".";
+ }
+
+ internal static string FailedToStart(string program, string message)
+ {
+ return $"Failed to start \"{program}\". {message}";
+ }
}
diff --git a/YesNt.Interpreter/Runtime/RuntimeInformation.cs b/YesNt.Interpreter/Runtime/RuntimeInformation.cs
index 3216be3..306f40a 100644
--- a/YesNt.Interpreter/Runtime/RuntimeInformation.cs
+++ b/YesNt.Interpreter/Runtime/RuntimeInformation.cs
@@ -23,9 +23,7 @@ internal sealed class RuntimeInformation
private static int internalTaskId = 0;
private readonly Dictionary topVariables = [];
private readonly Dictionary> topLists = [];
- private readonly Dictionary topLabels = [];
- private RuntimeInformation parentRuntimeInformation;
- private int taskId = 0;
+
public Dictionary GlobalVariables { get; set; } = [];
public Dictionary Functions { get; } = [];
public Stack FunctionCallStack { get; } = new();
@@ -41,7 +39,7 @@ internal sealed class RuntimeInformation
public bool IsDebugMode { get; set; } = false;
public string WorkingDirectory { get; set; } = string.Empty;
public bool IsTask => ParentRuntimeInformation is not null;
- public int TaskId => IsTask ? taskId : 0;
+ public int TaskId { get => IsTask ? field : 0; private set; } = 0;
public bool InternalIsInFunction { get; set; }
public bool IsInFunction
@@ -53,18 +51,15 @@ internal sealed class RuntimeInformation
public Dictionary Variables => FunctionCallStack.Count == 0 ? topVariables : FunctionCallStack.Peek().Variables;
public Dictionary> Lists => FunctionCallStack.Count == 0 ? topLists : FunctionCallStack.Peek().Lists;
- public Dictionary Labels => FunctionCallStack.Count == 0 ? topLabels : FunctionCallStack.Peek().Labels;
+ public Dictionary Labels { get => FunctionCallStack.Count == 0 ? field : FunctionCallStack.Peek().Labels; } = [];
public RuntimeInformation ParentRuntimeInformation
{
- get => parentRuntimeInformation;
+ get;
set
{
- parentRuntimeInformation = value;
- if (parentRuntimeInformation is not null)
- {
- parentRuntimeInformation.OnExit += ParentRuntimeInformation_OnExit;
- }
+ field = value;
+ field?.OnExit += ParentRuntimeInformation_OnExit;
}
}
@@ -73,7 +68,7 @@ internal sealed class RuntimeInformation
public void WriteLine(string output, bool forceWrite = false)
{
- if ((Stop && !forceWrite) || (parentRuntimeInformation?.StopAllTasks == true && !forceWrite))
+ if ((Stop && !forceWrite) || (ParentRuntimeInformation?.StopAllTasks == true && !forceWrite))
{
return;
}
@@ -82,7 +77,7 @@ internal sealed class RuntimeInformation
{
if (IsTask)
{
- parentRuntimeInformation!.WriteLine(output.FromSafeString(), forceWrite);
+ ParentRuntimeInformation!.WriteLine(output.FromSafeString(), forceWrite);
}
else
{
@@ -97,7 +92,7 @@ internal sealed class RuntimeInformation
public void Write(string output, bool forceWrite = false)
{
- if ((Stop && !forceWrite) || (parentRuntimeInformation?.StopAllTasks == true && !forceWrite))
+ if ((Stop && !forceWrite) || (ParentRuntimeInformation?.StopAllTasks == true && !forceWrite))
{
return;
}
@@ -106,7 +101,7 @@ internal sealed class RuntimeInformation
{
if (IsTask)
{
- parentRuntimeInformation!.Write(output.FromSafeString(), forceWrite);
+ ParentRuntimeInformation!.Write(output.FromSafeString(), forceWrite);
}
else
{
@@ -154,7 +149,7 @@ internal sealed class RuntimeInformation
{
StopAllTasks = true;
OnExit?.Invoke(message, StopAllTasks);
- parentRuntimeInformation?.Exit(ExitMessages.TerminatedByChildTask, true);
+ ParentRuntimeInformation?.Exit(ExitMessages.TerminatedByChildTask, true);
}
}
@@ -162,7 +157,7 @@ internal sealed class RuntimeInformation
{
if (IsTask)
{
- parentRuntimeInformation.LineExecuted(debugEventArgs);
+ ParentRuntimeInformation.LineExecuted(debugEventArgs);
}
else
{
@@ -192,10 +187,8 @@ internal sealed class RuntimeInformation
IsInFunction = false;
IsLocalSearch = false;
LineNumber = 0;
- taskId = internalTaskId + 1;
-#pragma warning disable S2696 // Instance members should not write to "static" fields
+ TaskId = internalTaskId + 1;
internalTaskId++;
-#pragma warning restore S2696 // Instance members should not write to "static" fields
}
private void ParentRuntimeInformation_OnExit(string exitMessage, bool stopAllTasks)
diff --git a/YesNt.Interpreter/Runtime/YesNtInterpreter.cs b/YesNt.Interpreter/Runtime/YesNtInterpreter.cs
index 6f06dac..e918c78 100644
--- a/YesNt.Interpreter/Runtime/YesNtInterpreter.cs
+++ b/YesNt.Interpreter/Runtime/YesNtInterpreter.cs
@@ -44,7 +44,7 @@ public class YesNtInterpreter
private readonly RuntimeInformation runtimeInfo = new RuntimeInformation();
private Dictionary> statements;
private readonly List> staticStatements;
- private readonly Dictionary>>> disabledStatements = new();
+ private readonly Dictionary>>> disabledStatements = [];
///
/// Gets a read-only snapshot of all currently registered statements.
@@ -138,10 +138,10 @@ public class YesNtInterpreter
{
foreach (StatementAttribute key in statements.Keys.Where(k => k.Name == name).ToList())
{
- statements.Remove(key);
+ _ = statements.Remove(key);
}
- disabledStatements.Remove(name);
+ _ = disabledStatements.Remove(name);
}
///
@@ -191,7 +191,7 @@ public class YesNtInterpreter
statements[kv.Key] = kv.Value;
}
- disabledStatements.Remove(name);
+ _ = disabledStatements.Remove(name);
}
///
diff --git a/YesNt.Interpreter/Statements/ProcessingStatements.cs b/YesNt.Interpreter/Statements/ProcessingStatements.cs
index 3cfd3d9..010389d 100644
--- a/YesNt.Interpreter/Statements/ProcessingStatements.cs
+++ b/YesNt.Interpreter/Statements/ProcessingStatements.cs
@@ -50,7 +50,7 @@ internal partial class ProcessingStatements : StatementRuntimeInformation
_ = Task.Run(() =>
{
YesNtInterpreter interpreter = new YesNtInterpreter();
- interpreter.Execute(lines, RuntimeInfo.GlobalVariables, lineNumber, RuntimeInfo);
+ interpreter.Execute(lines, RuntimeInfo.GlobalVariables, lineNumber, RuntimeInfo);
});
RuntimeInfo.CurrentLine = string.Empty;
diff --git a/YesNt.Interpreter/YesNt.Interpreter.csproj b/YesNt.Interpreter/YesNt.Interpreter.csproj
index 67e7926..a396e7d 100644
--- a/YesNt.Interpreter/YesNt.Interpreter.csproj
+++ b/YesNt.Interpreter/YesNt.Interpreter.csproj
@@ -1,18 +1,54 @@
- net8.0
+ net10.0
YesNt.Interpreter
Library
AnyCPU;x64
+ True
+ README.md
+ https://github.com/Stone-Red-Code/YesNt-Interpreter/
+ scripting, modding, language
+ Logo.png
+ True
+ LICENSE
+
+
+
+ True
+
+
+
+ True
+
+
+
+ True
+
+
+
+ True
-
+
+ True
+ \
+
+
+ True
+ \
+
+
+ True
+ \
+
+
+
+
+
diff --git a/assets/Logo.png b/assets/Logo.png
new file mode 100644
index 0000000..1ae3f41
Binary files /dev/null and b/assets/Logo.png differ