26 lines
626 B
Java
26 lines
626 B
Java
package function.builtin;
|
|
|
|
import environment.Environment;
|
|
import function.*;
|
|
import sexpression.*;
|
|
|
|
public class EXIT extends LispFunction {
|
|
|
|
private ArgumentValidator argumentValidator;
|
|
private Environment environment;
|
|
|
|
public EXIT() {
|
|
this.argumentValidator = new ArgumentValidator("EXIT");
|
|
this.argumentValidator.setMaximumNumberOfArguments(0);
|
|
this.environment = Environment.getInstance();
|
|
}
|
|
|
|
public SExpression call(Cons argumentList) {
|
|
argumentValidator.validate(argumentList);
|
|
environment.terminateSuccessfully();
|
|
|
|
return Nil.getInstance();
|
|
}
|
|
|
|
}
|