serene-simple/src/main/java/serene/simple/QuoteSpecialForm.java

22 lines
496 B
Java

package serene.simple;
public class QuoteSpecialForm extends SpecialForm {
// public QuoteSpecialForm(Node node) {
// this.x = node;
// }
public QuoteSpecialForm(ListNode<Node> node) throws SereneException {
super(node);
if (this.node.rest().length != 1) {
throw new SereneException("quote expects only one arguement");
}
}
@Override
public Object eval(final Scope scope) {
return this.node.rest().first();
}
}