transcendental-lisp/src/token/QuoteMark.java

27 lines
624 B
Java

package token;
import static sexpression.Nil.NIL;
import java.util.function.Supplier;
import file.FilePosition;
import sexpression.Cons;
import sexpression.SExpression;
import sexpression.Symbol;
public class QuoteMark extends Token {
public QuoteMark(String text, FilePosition position) {
super(text, position);
}
@Override
public SExpression parseSExpression(Supplier<Token> getNextToken) {
Token nextToken = getNextToken.get();
SExpression argument = nextToken.parseSExpression(getNextToken);
return new Cons(Symbol.createQuote(), new Cons(argument, NIL));
}
}