mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-04 00:56:31 +02:00
New features and bug fixes
- Fix import (`imp`) bug- - Add is in parameter available (`isi`) statement - Add is out parameter available (`iso`) statement
This commit is contained in:
@@ -62,6 +62,15 @@ namespace YesNt.Interpreter.Statements
|
||||
}
|
||||
}
|
||||
|
||||
[Statement("%iso", SearchMode.Contains, SpaceAround.End, ConsoleColor.Yellow, KeepStatementInArgs = true, Priority = Priority.Highest)]
|
||||
public void CheckIfOutParameterAvalible(string args)
|
||||
{
|
||||
args += " ";
|
||||
args = args.Replace("%iso ", $"{RuntimeInfo.OutParametersStack.Count > 0} ");
|
||||
|
||||
RuntimeInfo.CurrentLine = args.TrimEnd();
|
||||
}
|
||||
|
||||
[Statement("cal", SearchMode.StartOfLine, SpaceAround.End, ConsoleColor.DarkYellow, Priority = Priority.Low, Seperator = "|")]
|
||||
public void Call(string args)
|
||||
{
|
||||
@@ -119,6 +128,21 @@ namespace YesNt.Interpreter.Statements
|
||||
}
|
||||
}
|
||||
|
||||
[Statement("%isi", SearchMode.Contains, SpaceAround.End, ConsoleColor.Yellow, KeepStatementInArgs = true, Priority = Priority.Highest)]
|
||||
public void CheckIfInParameterAvalible(string args)
|
||||
{
|
||||
if (!RuntimeInfo.IsInFunction)
|
||||
{
|
||||
RuntimeInfo.Exit("Statement not allowed outside of function", true);
|
||||
return;
|
||||
}
|
||||
|
||||
args += " ";
|
||||
args = args.Replace("%isi ", $"{RuntimeInfo.FunctionCallStack.Peek().Arguemtns.Count > 0} ");
|
||||
|
||||
RuntimeInfo.CurrentLine = args.TrimEnd();
|
||||
}
|
||||
|
||||
[Statement("put", SearchMode.StartOfLine, SpaceAround.End, ConsoleColor.Yellow)]
|
||||
public void AddOutParameter(string args)
|
||||
{
|
||||
|
||||
@@ -27,8 +27,6 @@ namespace YesNt.Interpreter.Statements
|
||||
public void GetPi(string args)
|
||||
{
|
||||
args += " ";
|
||||
|
||||
|
||||
args = args.Replace("%pi ", $"{Math.PI} ");
|
||||
|
||||
RuntimeInfo.CurrentLine = args.TrimEnd();
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace YesNt.Interpreter.Statements
|
||||
{
|
||||
try
|
||||
{
|
||||
RuntimeInfo.Lines.RemoveAt(0);
|
||||
RuntimeInfo.Lines.RemoveAt(RuntimeInfo.LineNumber);
|
||||
string[] lines = File.ReadAllLines(path);
|
||||
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
@@ -85,12 +85,12 @@ namespace YesNt.Interpreter.Statements
|
||||
}
|
||||
catch
|
||||
{
|
||||
RuntimeInfo.Exit($"Could not load file {path}", true);
|
||||
RuntimeInfo.Exit($"Could not load file \"{path}\"", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RuntimeInfo.Exit($"Could not find file {path}", true);
|
||||
RuntimeInfo.Exit($"Could not find file \"{path}\"", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,15 @@ namespace YesNt.Interpreter.Utilities
|
||||
{
|
||||
public static bool? EvaluateCondition(string input)
|
||||
{
|
||||
if (input.ToLower().FromSaveString().Trim() == "true")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (input.ToLower().FromSaveString().Trim() == "false")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string[] parts = input.Split("==");
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user