diff --git a/YesNt.Interpreter/Statements/ProcessingStatements.cs b/YesNt.Interpreter/Statements/ProcessingStatements.cs index 00649f8..3396163 100644 --- a/YesNt.Interpreter/Statements/ProcessingStatements.cs +++ b/YesNt.Interpreter/Statements/ProcessingStatements.cs @@ -15,7 +15,7 @@ namespace YesNt.Interpreter.Statements [Statement("!calc", SearchMode.EndOfLine, SpaceAround.Start, ConsoleColor.DarkYellow, Priority = Priority.High, ExecuteInSearchMode = true)] public void Calculate(string args) { - MatchCollection matches = Regex.Matches(args, @"((\)?)+(\(?)+[0-9]+(((\s?)+(\)?)(\s?)+\+(\s?)+(\(?)+(\s?)+|(\s?)+(\)?)(\s?)+\-(\s?)+(\(?)+(\s?)+|(\s?)+(\)?)(\s?)+\*(\s?)+(\(?)+(\s?)+|(\s?)+(\)?)(\s?)+\/(\s?)+(\(?)+(\s?)+)|[,.])(?=[0-9])+)+[0-9]+(\)?)+"); + MatchCollection matches = Regex.Matches(args.FromSaveString(), @"((\)?)+(\(?)+[0-9]+(((\s?)+(\)?)(\s?)+\+(\s?)+(\(?)+(\s?)+|(\s?)+(\)?)(\s?)+\-(\s?)+(\(?)+(\s?)+|(\s?)+(\)?)(\s?)+\*(\s?)+(\(?)+(\s?)+|(\s?)+(\)?)(\s?)+\/(\s?)+(\(?)+(\s?)+)|[,.])(?=[0-9])+)+[0-9]+(\)?)+"); for (int i = 0; i < matches.Count; i++) { @@ -25,7 +25,7 @@ namespace YesNt.Interpreter.Statements RuntimeInfo.Exit("Invalid operation", true); return; } - args = args.Replace(matches[0].Value, res); + args = args.FromSaveString().Replace(matches[0].Value, res); } RuntimeInfo.CurrentLine = args; diff --git a/YesNt.Interpreter/Utilities/Evaluator.cs b/YesNt.Interpreter/Utilities/Evaluator.cs index c6dfccd..2c6c8e1 100644 --- a/YesNt.Interpreter/Utilities/Evaluator.cs +++ b/YesNt.Interpreter/Utilities/Evaluator.cs @@ -74,8 +74,6 @@ namespace YesNt.Interpreter.Utilities return part1 < part2; } - - return null; } @@ -86,6 +84,8 @@ namespace YesNt.Interpreter.Utilities return null; } + input = input.FromSaveString(); + MatchCollection matches = Regex.Matches(input, @"\(([^()]+)\)"); while (matches.Count > 0) {