فهرست منبع

Misc parenthesis and CSV fixes

Bepsi 6 سال پیش
والد
کامیت
088149014c
3فایلهای تغییر یافته به همراه14 افزوده شده و 8 حذف شده
  1. 2 1
      NTERA.Compiler/Compiler.cs
  2. 8 5
      NTERA.Interpreter/Compiler/Parser.cs
  3. 4 2
      NTERA.Interpreter/Compiler/Preprocessor.cs

+ 2 - 1
NTERA.Compiler/Compiler.cs

@@ -129,7 +129,8 @@ namespace NTERA.Compiler
 				["DITEMTYPE"] = "",
 				["NO"] = "",
 				["RELATION"] = "",
-				["IS"] = ""
+				["IS"] = "",
+				["GOTJUEL"] = "",
 			};
 
 			foreach (char c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ")

+ 8 - 5
NTERA.Interpreter/Compiler/Parser.cs

@@ -135,7 +135,7 @@ namespace NTERA.Interpreter.Compiler
 							return null;
 						}
 
-						ExecutionNode value = null;
+						ExecutionNode value;
 
 						if (Enumerator.Current == Token.Increment)
 						{
@@ -260,7 +260,8 @@ namespace NTERA.Interpreter.Compiler
 						Enumerator.MoveNext();
 
 						while (Enumerator.Current != Token.NewLine
-							   && Enumerator.Current != Token.EOF)
+							   && Enumerator.Current != Token.EOF
+							   && Enumerator.Current != Token.RParen)
 						{
 							parameters.Add(Expression(out error));
 							if (error != null)
@@ -413,8 +414,9 @@ namespace NTERA.Interpreter.Compiler
 						{
 							return node;
 						}
-						else if (GetNextToken(true) == Token.Colon
-								 || GetNextToken(true) == Token.Equal)
+
+						if (GetNextToken(true) == Token.Colon
+							|| GetNextToken(true) == Token.Equal)
 						{
 							error = new ParserError($"Undeclared variable: {statementName}", node.Symbol);
 							return null;
@@ -697,6 +699,7 @@ namespace NTERA.Interpreter.Compiler
 				   && token != Token.Colon
 				   && token != Token.Format
 				   && token != Token.CloseBracket
+				   && token != Token.RParen
 				   && (useModulo || token != Token.Modulo))
 			{
 				if (token == Token.Value)
@@ -824,7 +827,7 @@ namespace NTERA.Interpreter.Compiler
 						formatParams.Add(tempValue);
 					} while (Enumerator.Current == Token.Comma);
 
-					var formattedValue = CallMethod("_FORMAT", symbolMarker, formatParams.ToArray());
+					var formattedValue = CallMethod("__FORMAT", symbolMarker, formatParams.ToArray());
 
 					value = value == null
 						? formattedValue

+ 4 - 2
NTERA.Interpreter/Compiler/Preprocessor.cs

@@ -236,7 +236,6 @@ namespace NTERA.Interpreter.Compiler
 							   && enumerator.Current != Token.EOF
 							   && enumerator.MoveNext())
 						{
-							
 						}
 					}
 				} while (enumerator.MoveNext());
@@ -264,7 +263,10 @@ namespace NTERA.Interpreter.Compiler
 				if (commentIndex >= 0)
 					newLine = line.Substring(0, commentIndex);
 
-				string[] split = newLine.Split(',');
+				string[] split = newLine.Split(new[] { ',' }, StringSplitOptions.None);
+
+				if (split.Length == 1)
+					continue;
 
 				csv.Add(split.ToList());
 			}