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));
    }

}
