2016-12-19 13:05:53 -05:00
|
|
|
package function.builtin;
|
2016-12-07 16:38:26 -05:00
|
|
|
|
2017-03-02 09:54:23 -05:00
|
|
|
import static sexpression.Nil.NIL;
|
|
|
|
|
2017-02-06 13:39:05 -05:00
|
|
|
import environment.RuntimeEnvironment;
|
2017-01-16 13:38:49 -05:00
|
|
|
import function.*;
|
2016-12-15 15:33:48 -05:00
|
|
|
import sexpression.*;
|
2016-12-07 16:38:26 -05:00
|
|
|
|
2017-02-26 16:47:06 -05:00
|
|
|
@FunctionNames({ "EXIT" })
|
2016-12-07 16:38:26 -05:00
|
|
|
public class EXIT extends LispFunction {
|
|
|
|
|
2017-01-16 13:38:49 -05:00
|
|
|
private ArgumentValidator argumentValidator;
|
2017-02-06 13:39:05 -05:00
|
|
|
private RuntimeEnvironment environment;
|
2016-12-07 16:38:26 -05:00
|
|
|
|
2017-01-16 13:38:49 -05:00
|
|
|
public EXIT() {
|
|
|
|
this.argumentValidator = new ArgumentValidator("EXIT");
|
|
|
|
this.argumentValidator.setMaximumNumberOfArguments(0);
|
2017-02-06 13:39:05 -05:00
|
|
|
this.environment = RuntimeEnvironment.getInstance();
|
2017-01-16 13:38:49 -05:00
|
|
|
}
|
2016-12-07 16:38:26 -05:00
|
|
|
|
2017-01-16 13:38:49 -05:00
|
|
|
public SExpression call(Cons argumentList) {
|
|
|
|
argumentValidator.validate(argumentList);
|
2017-01-18 16:25:09 -05:00
|
|
|
environment.terminateSuccessfully();
|
2017-01-16 13:38:49 -05:00
|
|
|
|
2017-03-02 09:54:23 -05:00
|
|
|
return NIL;
|
2016-12-07 16:38:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|