|
@@ -145,11 +145,11 @@ namespace NTERA.Interpreter.Compiler
|
|
|
|
|
|
if (Enumerator.Current == Token.Increment)
|
|
|
{
|
|
|
- value = OperateNodes(variable, CreateConstant(1), Token.Plus);
|
|
|
+ value = OperateNodes(variable, CreateConstant(1, CurrentPosition), Token.Plus);
|
|
|
}
|
|
|
else if (Enumerator.Current == Token.Decrement)
|
|
|
{
|
|
|
- value = OperateNodes(variable, CreateConstant(1), Token.Minus);
|
|
|
+ value = OperateNodes(variable, CreateConstant(1, CurrentPosition), Token.Minus);
|
|
|
}
|
|
|
else if (Enumerator.Current != Token.Equal)
|
|
|
{
|
|
@@ -328,7 +328,7 @@ namespace NTERA.Interpreter.Compiler
|
|
|
|
|
|
if (Enumerator.Current == Token.Identifer)
|
|
|
{
|
|
|
- newValue = CreateConstant(Lexer.Identifier);
|
|
|
+ newValue = CreateConstant(Lexer.Identifier, CurrentPosition);
|
|
|
}
|
|
|
else if (Enumerator.Current == Token.OpenBracket)
|
|
|
{
|
|
@@ -413,7 +413,7 @@ namespace NTERA.Interpreter.Compiler
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- node.SubNodes = new[] { CreateConstant(Lexer.Identifier) };
|
|
|
+ node.SubNodes = new[] { CreateConstant(Lexer.Identifier, CurrentPosition) };
|
|
|
|
|
|
return node;
|
|
|
}
|
|
@@ -543,14 +543,14 @@ namespace NTERA.Interpreter.Compiler
|
|
|
}
|
|
|
else if (token == Token.Value)
|
|
|
{
|
|
|
- indices.Add(CreateConstant(Lexer.Value));
|
|
|
+ indices.Add(CreateConstant(Lexer.Value, CurrentPosition));
|
|
|
}
|
|
|
else if (token == Token.Identifer)
|
|
|
{
|
|
|
if (CsvDefinition.VariableIndexDictionary.TryGetValue(variableName, out var varTable)
|
|
|
&& varTable.TryGetValue(Lexer.Identifier, out int index))
|
|
|
{
|
|
|
- indices.Add(CreateConstant(index));
|
|
|
+ indices.Add(CreateConstant(index, CurrentPosition));
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -760,7 +760,7 @@ namespace NTERA.Interpreter.Compiler
|
|
|
{
|
|
|
if (token == Token.Value)
|
|
|
{
|
|
|
- operands.Push(CreateConstant(Lexer.Value));
|
|
|
+ operands.Push(CreateConstant(Lexer.Value, CurrentPosition));
|
|
|
|
|
|
AttemptUnaryConversion(out error);
|
|
|
if (error != null)
|
|
@@ -868,7 +868,7 @@ namespace NTERA.Interpreter.Compiler
|
|
|
if (error != null)
|
|
|
return null;
|
|
|
|
|
|
- return CallMethod("__IMPLICITIF", CurrentPosition, result, resultTrue, resultFalse);
|
|
|
+ return CallMethod("__INLINEIF", CurrentPosition, result, resultTrue, resultFalse);
|
|
|
}
|
|
|
|
|
|
protected ExecutionNode ParseString(out ParserError error, bool implicitString, bool canFormat = false, bool nestedTernary = false)
|
|
@@ -974,7 +974,7 @@ namespace NTERA.Interpreter.Compiler
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- ExecutionNode appendedValue = CreateConstant(currentBlock.ToString());
|
|
|
+ ExecutionNode appendedValue = CreateConstant(currentBlock.ToString(), CurrentPosition);
|
|
|
|
|
|
value = value == null
|
|
|
? appendedValue
|
|
@@ -991,14 +991,14 @@ namespace NTERA.Interpreter.Compiler
|
|
|
[Token.Slash] = "divide",
|
|
|
};
|
|
|
|
|
|
- private static string GetOperationName(Token token)
|
|
|
+ public static string GetOperationName(Token token)
|
|
|
{
|
|
|
return OperationNames.TryGetValue(token, out string result)
|
|
|
? result
|
|
|
: token.ToString();
|
|
|
}
|
|
|
|
|
|
- private ExecutionNode CreateConstant(Value value)
|
|
|
+ public static ExecutionNode CreateConstant(Value value, Marker symbolMarker)
|
|
|
{
|
|
|
return new ExecutionNode
|
|
|
{
|
|
@@ -1008,11 +1008,11 @@ namespace NTERA.Interpreter.Compiler
|
|
|
["type"] = value.Type.ToString(),
|
|
|
["value"] = value.ToString()
|
|
|
},
|
|
|
- Symbol = CurrentPosition
|
|
|
+ Symbol = symbolMarker
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- private static ExecutionNode OperateNodes(ExecutionNode left, ExecutionNode right, Token token)
|
|
|
+ public static ExecutionNode OperateNodes(ExecutionNode left, ExecutionNode right, Token token)
|
|
|
{
|
|
|
return new ExecutionNode
|
|
|
{
|
|
@@ -1029,7 +1029,7 @@ namespace NTERA.Interpreter.Compiler
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- private static ExecutionNode CallMethod(string methodName, Marker symbolMarker, params ExecutionNode[] parameters)
|
|
|
+ public static ExecutionNode CallMethod(string methodName, Marker symbolMarker, params ExecutionNode[] parameters)
|
|
|
{
|
|
|
return new ExecutionNode
|
|
|
{
|