35 lines
No EOL
725 B
C#
35 lines
No EOL
725 B
C#
namespace KumiScript.Interpreter
|
|
{
|
|
public class NumberExpression : Expression
|
|
{
|
|
decimal _value;
|
|
|
|
public NumberExpression(decimal value)
|
|
{
|
|
_value = value;
|
|
}
|
|
|
|
public override decimal GetValueAsFloat()
|
|
{
|
|
return _value;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return _value.ToString();
|
|
}
|
|
|
|
public override bool Equals(Expression expr)
|
|
{
|
|
try
|
|
{
|
|
decimal d = expr.GetValueAsFloat();
|
|
return d == _value;
|
|
}
|
|
catch (InterpreterTypingException)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |