2019-12-14 02:42:25 +00:00
|
|
|
package serene.simple;
|
|
|
|
|
|
|
|
public class QuoteSpecialForm extends SpecialForm {
|
2019-12-18 17:45:43 +00:00
|
|
|
|
|
|
|
// public QuoteSpecialForm(Node node) {
|
|
|
|
// this.x = node;
|
|
|
|
// }
|
|
|
|
|
|
|
|
public QuoteSpecialForm(ListNode<Node> node) throws SereneException {
|
2019-12-14 02:42:25 +00:00
|
|
|
super(node);
|
2019-12-18 17:45:43 +00:00
|
|
|
|
|
|
|
if (this.node.rest().length != 1) {
|
|
|
|
throw new SereneException("quote expects only one arguement");
|
|
|
|
}
|
2019-12-14 02:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Object eval(final Scope scope) {
|
2019-12-18 17:45:43 +00:00
|
|
|
return this.node.rest().first();
|
2019-12-14 02:42:25 +00:00
|
|
|
}
|
|
|
|
}
|