Remove manual variable declaration highlighting from SyntaxHighlighter and add color to VariableStatements

This commit is contained in:
Stone_Red
2026-03-04 14:48:15 +01:00
parent 317bca84d3
commit 36d8735fbb
2 changed files with 2 additions and 20 deletions
-18
View File
@@ -111,18 +111,6 @@ internal partial class SyntaxHighlighter(ReadOnlyCollection<StatementInformation
{ {
input = AddColorInformation(input, matches[i].Value, ConsoleColor.Cyan, SearchMode.Contains); input = AddColorInformation(input, matches[i].Value, ConsoleColor.Cyan, SearchMode.Contains);
} }
matches = VariableDeclarationRegex().Matches(input);
for (int i = 0; i < matches.Count; i++)
{
input = AddColorInformation(input, matches[i].Value, ConsoleColor.DarkCyan, SearchMode.StartOfLine);
}
matches = GlobalVariableDeclarationRegex().Matches(input);
for (int i = 0; i < matches.Count; i++)
{
input = AddColorInformation(input, matches[i].Value, ConsoleColor.Blue, SearchMode.StartOfLine);
}
} }
foreach (string part in input.Split("\0")) foreach (string part in input.Split("\0"))
@@ -167,12 +155,6 @@ internal partial class SyntaxHighlighter(ReadOnlyCollection<StatementInformation
return result; return result;
} }
[GeneratedRegex("^let\\s+[a-zA-Z0-9]+")]
private static partial Regex VariableDeclarationRegex();
[GeneratedRegex("^global\\s+[a-zA-Z0-9]+")]
private static partial Regex GlobalVariableDeclarationRegex();
[GeneratedRegex("\\$\\{[a-zA-Z0-9]+\\}")] [GeneratedRegex("\\$\\{[a-zA-Z0-9]+\\}")]
private static partial Regex VariableRegex(); private static partial Regex VariableRegex();
@@ -8,7 +8,7 @@ namespace YesNt.Interpreter.Statements;
internal partial class VariableStatements : StatementRuntimeInformation internal partial class VariableStatements : StatementRuntimeInformation
{ {
[Statement("let", SearchMode.StartOfLine, SpaceAround.End, Priority = Priority.VeryLow)] [Statement("let", SearchMode.StartOfLine, SpaceAround.End, System.ConsoleColor.DarkBlue, Priority = Priority.VeryLow, Separator = "=")]
public void DefineVariable(string args) public void DefineVariable(string args)
{ {
string[] parts = args.Split('='); string[] parts = args.Split('=');
@@ -35,7 +35,7 @@ internal partial class VariableStatements : StatementRuntimeInformation
} }
} }
[Statement("global", SearchMode.StartOfLine, SpaceAround.End, Priority = Priority.VeryLow)] [Statement("global", SearchMode.StartOfLine, SpaceAround.End, System.ConsoleColor.DarkBlue, Priority = Priority.VeryLow, Separator = "=")]
public void DefineGlobalVariable(string args) public void DefineGlobalVariable(string args)
{ {
string[] parts = args.Split('='); string[] parts = args.Split('=');