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

22 lines
496 B
Java
Raw Normal View History

2019-12-14 02:42:25 +00:00
package serene.simple;
public class QuoteSpecialForm extends SpecialForm {
// public QuoteSpecialForm(Node node) {
// this.x = node;
// }
public QuoteSpecialForm(ListNode<Node> node) throws SereneException {
2019-12-14 02:42:25 +00:00
super(node);
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) {
return this.node.rest().first();
2019-12-14 02:42:25 +00:00
}
}