2024-01-26 05:37:51 +00:00
|
|
|
namespace KumiScript.Interpreter
|
|
|
|
{
|
2024-07-12 00:17:00 +00:00
|
|
|
public class NilExpression : Expression
|
2024-01-26 05:37:51 +00:00
|
|
|
{
|
|
|
|
private static NilExpression? _instance;
|
|
|
|
private NilExpression()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public static NilExpression GetInstance()
|
|
|
|
{
|
|
|
|
if (_instance is null)
|
|
|
|
_instance = new NilExpression();
|
|
|
|
|
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Expression Car()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2024-07-12 00:17:00 +00:00
|
|
|
public override Expression Cdr()
|
2024-01-26 05:37:51 +00:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override ProperListExpression Cons(Expression expr)
|
|
|
|
{
|
|
|
|
return new ProperListExpression(new List<Expression> {expr});
|
|
|
|
}
|
|
|
|
|
|
|
|
public override List<Expression> EvalMembers(Environment env)
|
|
|
|
{
|
|
|
|
return new List<Expression>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override List<Expression> GetMembers()
|
|
|
|
{
|
|
|
|
return new List<Expression>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return "null";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|