package token;

import java.util.function.Supplier;

import error.LineColumnException;
import file.FilePosition;
import sexpression.SExpression;

public class Eof extends Token {

    public Eof(String text, FilePosition position) {
        super(text, position);
    }

    @Override
    public SExpression parseSExpression(Supplier<Token> getNextToken) {
        throw new EofEncounteredException(getPosition());
    }

    public static class EofEncounteredException extends LineColumnException {

        private static final long serialVersionUID = 1L;

        public EofEncounteredException(FilePosition position) {
            super(position);
        }

        @Override
        public String getMessagePrefix() {
            return "end-of-file encountered";
        }
    }

}
