2016-12-19 13:05:53 -05:00
|
|
|
package function.builtin;
|
2016-12-07 16:38:26 -05:00
|
|
|
|
2017-01-18 16:25:09 -05:00
|
|
|
import environment.Environment;
|
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
|
|
|
|
|
|
|
public class EXIT extends LispFunction {
|
|
|
|
|
2017-01-16 13:38:49 -05:00
|
|
|
private ArgumentValidator argumentValidator;
|
2017-01-18 16:25:09 -05:00
|
|
|
private Environment 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-01-18 16:25:09 -05:00
|
|
|
this.environment = Environment.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-01-18 16:25:09 -05:00
|
|
|
return Nil.getInstance();
|
2016-12-07 16:38:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|