Add more statements and bug fixes

- Add `Execute(List<string>...` method to interpreter
- Add escape sequence (`!!`)
- Fix `Evaluator.Calulate` method not correctly handling `-` and `+` prefixes
This commit is contained in:
Stone_Red
2022-03-31 13:01:31 +02:00
parent 29bbcebf74
commit 510d2d910c
11 changed files with 101 additions and 41 deletions
+14 -1
View File
@@ -99,6 +99,19 @@ namespace YesNt.Interpreter
Execute();
}
public void Execute(List<string> lines, bool isDebugMode = false)
{
runtimeInfo.Reset();
runtimeInfo.IsDebugMode = isDebugMode;
for (int i = 0; i < lines.Count; i++)
{
runtimeInfo.Lines.Add(new Line(lines[i], Path.GetFileName("#Memory#"), i));
}
Execute();
}
internal void Execute(List<Line> lines, Dictionary<string, string> gloablVariables, int startLine, RuntimeInformation parentRuntimeInformation)
{
runtimeInfo.Reset();
@@ -142,7 +155,7 @@ namespace YesNt.Interpreter
foreach (KeyValuePair<StaticStatementAttribute, Action> staticStatement in staticStatements)
{
StaticStatementAttribute staticStatementAttribute = staticStatement.Key;
if (!staticStatementAttribute.ExecuteInSearchLabelMode && runtimeInfo.IsSearching)
if (!staticStatementAttribute.ExecuteInSearchMode && runtimeInfo.IsSearching)
{
continue;
}