Code structure and speed imporvments

This commit is contained in:
Stone_Red
2022-04-28 19:58:30 +02:00
parent 3c78755858
commit 3c98c2b26f
3 changed files with 32 additions and 9 deletions
@@ -9,6 +9,8 @@ namespace YesNt.Interpreter.Statements
{
internal class VariableStatements : StatementRuntimeInformation
{
private static readonly Regex variableStatementRegex = new Regex(@">[a-zA-Z0-9]+");
[Statement("<", SearchMode.StartOfLine, SpaceAround.None, Priority = Priority.VeryLow)]
public void DefineVariable(string args)
{
@@ -105,7 +107,7 @@ namespace YesNt.Interpreter.Statements
return;
}
MatchCollection matches = Regex.Matches(RuntimeInfo.CurrentLine, @">[a-zA-Z0-9]+");
MatchCollection matches = variableStatementRegex.Matches(RuntimeInfo.CurrentLine);
for (int i = 0; i < matches.Count; i++)
{