This commit is contained in:
Jordan Wages 2025-06-12 04:32:18 -05:00
commit eb3bbcb69e
6 changed files with 134 additions and 21 deletions

View file

@ -1,7 +1,69 @@
namespace csmic
using System.Runtime.CompilerServices;
namespace csmic
{
public class InputInterpreter
{
#region Members
private decimal numericValue = 0;
private string stringValue = string.Empty;
#endregion
#region Properties
public decimal NumericValue
{
get
{
return numericValue;
}
}
public string StringValue
{
get
{
return stringValue;
}
}
#endregion
#region Methods
internal void ProduceOutput(decimal numericValue, string stringValue)
{
this.numericValue = numericValue;
this.stringValue = stringValue;
}
internal void ProduceOutput(FunctionValue functionValue)
{
switch (functionValue.Type)
{
case ValueType.Numeric:
decimal numericValue = Convert.ToDecimal(functionValue.Value);
ProduceOutput(numericValue, string.Empty);
break;
case ValueType.String:
if (functionValue.Value != null && functionValue.Value is string)
{
ProduceOutput(0, functionValue.Value!.ToString());
}
else
{
ProduceOutput(0, string.Empty);
}
break;
case ValueType.None:
default:
ProduceOutput(0, string.Empty);
break;
}
}
#endregion
}
}