Ver Fonte

Support ! unary operator

StuffedAnon há 6 anos atrás
pai
commit
9e9feb873c
2 ficheiros alterados com 5 adições e 1 exclusões
  1. 1 1
      NTERA.Core/IConsole.cs
  2. 4 0
      NTERA.Engine/Runtime/EraRuntime.cs

+ 1 - 1
NTERA.Core/IConsole.cs

@@ -26,7 +26,7 @@ namespace NTERA.Core
 		bool noOutputLog { get; set; }
 		void ThrowTitleError(bool something);
 		void PrintBar();
-		void PrintSingleLine(string line, bool temporary = false);
+		void PrintSingleLine(string line, bool temporary = false); // This means to not word-wrap
 		void NewLine();
 		void RefreshStrings(bool something);
 		void SetWindowTitle(string title);

+ 4 - 0
NTERA.Engine/Runtime/EraRuntime.cs

@@ -421,6 +421,9 @@ namespace NTERA.Engine.Runtime
 						case "multiply":
 							operatorToken = Token.Asterisk;
 							break;
+						case "Not":
+							operatorToken = Token.Not;
+							break;
 						default: throw new EraRuntimeException($"Unknown operation type: '{operationType}'");
 					}
 
@@ -432,6 +435,7 @@ namespace NTERA.Engine.Runtime
 						{
 							case Token.Plus: return innerValue;
 							case Token.Minus: return innerValue * -1;
+							case Token.Not: return !innerValue;
 							default: throw new EraRuntimeException($"Unsupported unary operation type: '{operationType}'");
 						}
 					}